3246 |
: Fcons ((el), (check))))) |
: Fcons ((el), (check))))) |
3247 |
|
|
3248 |
|
|
3249 |
|
/* SAFE_ALLOCA normally allocates memory on the stack, but if size is |
3250 |
|
larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */ |
3251 |
|
|
3252 |
|
#define MAX_ALLOCA 16*1024 |
3253 |
|
|
3254 |
|
extern Lisp_Object safe_alloca_unwind (Lisp_Object); |
3255 |
|
|
3256 |
|
#define USE_SAFE_ALLOCA \ |
3257 |
|
int sa_count = SPECPDL_INDEX () |
3258 |
|
|
3259 |
|
#define SAFE_ALLOCA(buf, type, size) \ |
3260 |
|
do { \ |
3261 |
|
if ((size) < MAX_ALLOCA) \ |
3262 |
|
buf = (type) alloca (size); \ |
3263 |
|
else \ |
3264 |
|
{ \ |
3265 |
|
buf = (type) xmalloc (size); \ |
3266 |
|
record_unwind_protect (safe_alloca_unwind, \ |
3267 |
|
make_save_value (buf, 0)); \ |
3268 |
|
} \ |
3269 |
|
} while (0) |
3270 |
|
|
3271 |
|
#define SAFE_FREE(size) \ |
3272 |
|
do { \ |
3273 |
|
if ((size) >= MAX_ALLOCA) \ |
3274 |
|
unbind_to (sa_count, Qnil); \ |
3275 |
|
} while (0) |
3276 |
|
|
3277 |
|
|
3278 |
|
|
3279 |
|
|
3280 |
#endif /* EMACS_LISP_H */ |
#endif /* EMACS_LISP_H */ |
3281 |
|
|
3282 |
/* arch-tag: 9b2ed020-70eb-47ac-94ee-e1c2a5107d5e |
/* arch-tag: 9b2ed020-70eb-47ac-94ee-e1c2a5107d5e |