diff options
| author | Karoly Lorentey | 2004-06-24 07:44:13 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-06-24 07:44:13 +0000 |
| commit | 3fa701994755105d1fb4b0b802338fc04e8a6937 (patch) | |
| tree | 02ec9152f5f6e95bbb0b02265f51b832e712e8b5 /src/lisp.h | |
| parent | 8c8d5f3503a2fb4918414c0b0b9dacd81c50f1a9 (diff) | |
| parent | bb72b9d0b5248404a55b599d99c0be5454704e4a (diff) | |
| download | emacs-3fa701994755105d1fb4b0b802338fc04e8a6937.tar.gz emacs-3fa701994755105d1fb4b0b802338fc04e8a6937.zip | |
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-409
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-410
Make sure image types are initialized for lookup too
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-411
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-412
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-413
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-414
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-415
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-416
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-417
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-418
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-419
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-202
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/src/lisp.h b/src/lisp.h index fdf76399e5d..ba2508e827b 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1199,7 +1199,10 @@ struct Lisp_Save_Value | |||
| 1199 | { | 1199 | { |
| 1200 | int type : 16; /* = Lisp_Misc_Save_Value */ | 1200 | int type : 16; /* = Lisp_Misc_Save_Value */ |
| 1201 | unsigned gcmarkbit : 1; | 1201 | unsigned gcmarkbit : 1; |
| 1202 | int spacer : 15; | 1202 | int spacer : 14; |
| 1203 | /* If DOGC is set, POINTER is the address of a memory | ||
| 1204 | area containing INTEGER potential Lisp_Objects. */ | ||
| 1205 | unsigned int dogc : 1; | ||
| 1203 | void *pointer; | 1206 | void *pointer; |
| 1204 | int integer; | 1207 | int integer; |
| 1205 | }; | 1208 | }; |
| @@ -3248,6 +3251,64 @@ extern Lisp_Object Vdirectory_sep_char; | |||
| 3248 | : Fcons ((el), (check))))) | 3251 | : Fcons ((el), (check))))) |
| 3249 | 3252 | ||
| 3250 | 3253 | ||
| 3254 | /* SAFE_ALLOCA normally allocates memory on the stack, but if size is | ||
| 3255 | larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */ | ||
| 3256 | |||
| 3257 | #define MAX_ALLOCA 16*1024 | ||
| 3258 | |||
| 3259 | extern Lisp_Object safe_alloca_unwind (Lisp_Object); | ||
| 3260 | |||
| 3261 | #define USE_SAFE_ALLOCA \ | ||
| 3262 | int sa_count = SPECPDL_INDEX () | ||
| 3263 | |||
| 3264 | /* SAFE_ALLOCA allocates a simple buffer. */ | ||
| 3265 | |||
| 3266 | #define SAFE_ALLOCA(buf, type, size) \ | ||
| 3267 | do { \ | ||
| 3268 | if ((size) < MAX_ALLOCA) \ | ||
| 3269 | buf = (type) alloca (size); \ | ||
| 3270 | else \ | ||
| 3271 | { \ | ||
| 3272 | buf = (type) xmalloc (size); \ | ||
| 3273 | record_unwind_protect (safe_alloca_unwind, \ | ||
| 3274 | make_save_value (buf, 0)); \ | ||
| 3275 | } \ | ||
| 3276 | } while (0) | ||
| 3277 | |||
| 3278 | /* SAFE_FREE frees xmalloced memory and enables GC as needed. */ | ||
| 3279 | |||
| 3280 | #define SAFE_FREE(size) \ | ||
| 3281 | do { \ | ||
| 3282 | if ((size) >= MAX_ALLOCA) \ | ||
| 3283 | unbind_to (sa_count, Qnil); \ | ||
| 3284 | } while (0) | ||
| 3285 | |||
| 3286 | |||
| 3287 | /* SAFE_ALLOCA_LISP allocates an array of Lisp_Objects. */ | ||
| 3288 | |||
| 3289 | #define SAFE_ALLOCA_LISP(buf, nelt) \ | ||
| 3290 | do { \ | ||
| 3291 | int size_ = (nelt) * sizeof (Lisp_Object); \ | ||
| 3292 | if (size_ < MAX_ALLOCA) \ | ||
| 3293 | buf = (Lisp_Object *) alloca (size_); \ | ||
| 3294 | else \ | ||
| 3295 | { \ | ||
| 3296 | Lisp_Object arg_; \ | ||
| 3297 | buf = (Lisp_Object *) xmalloc (size_); \ | ||
| 3298 | arg_ = make_save_value (buf, nelt); \ | ||
| 3299 | XSAVE_VALUE (arg_)->dogc = 1; \ | ||
| 3300 | record_unwind_protect (safe_alloca_unwind, arg_); \ | ||
| 3301 | } \ | ||
| 3302 | } while (0) | ||
| 3303 | |||
| 3304 | #define SAFE_FREE_LISP(nelt) \ | ||
| 3305 | do { \ | ||
| 3306 | if (((nelt) * sizeof (Lisp_Object)) >= MAX_ALLOCA) \ | ||
| 3307 | unbind_to (sa_count, Qnil); \ | ||
| 3308 | } while (0) | ||
| 3309 | |||
| 3310 | |||
| 3311 | |||
| 3251 | #endif /* EMACS_LISP_H */ | 3312 | #endif /* EMACS_LISP_H */ |
| 3252 | 3313 | ||
| 3253 | /* arch-tag: 9b2ed020-70eb-47ac-94ee-e1c2a5107d5e | 3314 | /* arch-tag: 9b2ed020-70eb-47ac-94ee-e1c2a5107d5e |