diff options
| author | Dmitry Antipov | 2012-12-03 12:06:02 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-12-03 12:06:02 +0400 |
| commit | 62c2e5ed3a9c991cef2594b44afc74893f6ce26b (patch) | |
| tree | 336fec5e4e929d0505889deefe3f4f484e9fc38a /src/alloc.c | |
| parent | 1c960c45ac19595af7a4a741da7837d2057d977a (diff) | |
| download | emacs-62c2e5ed3a9c991cef2594b44afc74893f6ce26b.tar.gz emacs-62c2e5ed3a9c991cef2594b44afc74893f6ce26b.zip | |
* alloc.c (free_save_value): New function.
(safe_alloca_unwind): Use it.
* lisp.h (free_save_value): New prototype.
* editfns.c (save_excursion_save): Use Lisp_Misc_Save_Value.
Add comment.
(save_excursion_restore): Adjust to match saved data structure.
Use free_save_value to offload some work from GC. Drop obsolete
#if 0 code.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/alloc.c b/src/alloc.c index e504b3d93ec..0f105f87207 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -826,12 +826,7 @@ xstrdup (const char *s) | |||
| 826 | Lisp_Object | 826 | Lisp_Object |
| 827 | safe_alloca_unwind (Lisp_Object arg) | 827 | safe_alloca_unwind (Lisp_Object arg) |
| 828 | { | 828 | { |
| 829 | register struct Lisp_Save_Value *p = XSAVE_VALUE (arg); | 829 | free_save_value (arg); |
| 830 | |||
| 831 | p->dogc = 0; | ||
| 832 | xfree (p->pointer); | ||
| 833 | p->pointer = 0; | ||
| 834 | free_misc (arg); | ||
| 835 | return Qnil; | 830 | return Qnil; |
| 836 | } | 831 | } |
| 837 | 832 | ||
| @@ -3365,6 +3360,19 @@ make_save_value (void *pointer, ptrdiff_t integer) | |||
| 3365 | return val; | 3360 | return val; |
| 3366 | } | 3361 | } |
| 3367 | 3362 | ||
| 3363 | /* Free a Lisp_Misc_Save_Value object. */ | ||
| 3364 | |||
| 3365 | void | ||
| 3366 | free_save_value (Lisp_Object save) | ||
| 3367 | { | ||
| 3368 | register struct Lisp_Save_Value *p = XSAVE_VALUE (save); | ||
| 3369 | |||
| 3370 | p->dogc = 0; | ||
| 3371 | xfree (p->pointer); | ||
| 3372 | p->pointer = NULL; | ||
| 3373 | free_misc (save); | ||
| 3374 | } | ||
| 3375 | |||
| 3368 | /* Return a Lisp_Misc_Overlay object with specified START, END and PLIST. */ | 3376 | /* Return a Lisp_Misc_Overlay object with specified START, END and PLIST. */ |
| 3369 | 3377 | ||
| 3370 | Lisp_Object | 3378 | Lisp_Object |