diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c index 3a3628f40fd..baf7afa0094 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -580,6 +580,21 @@ xstrdup (s) | |||
| 580 | } | 580 | } |
| 581 | 581 | ||
| 582 | 582 | ||
| 583 | /* Unwind for SAFE_ALLOCA */ | ||
| 584 | |||
| 585 | Lisp_Object | ||
| 586 | safe_alloca_unwind (arg) | ||
| 587 | Lisp_Object arg; | ||
| 588 | { | ||
| 589 | register struct Lisp_Save_Value *p = XSAVE_VALUE (arg); | ||
| 590 | |||
| 591 | p->dogc = 0; | ||
| 592 | xfree (p->pointer); | ||
| 593 | p->pointer = 0; | ||
| 594 | return Qnil; | ||
| 595 | } | ||
| 596 | |||
| 597 | |||
| 583 | /* Like malloc but used for allocating Lisp data. NBYTES is the | 598 | /* Like malloc but used for allocating Lisp data. NBYTES is the |
| 584 | number of bytes to allocate, TYPE describes the intended use of the | 599 | number of bytes to allocate, TYPE describes the intended use of the |
| 585 | allcated memory block (for strings, for conses, ...). */ | 600 | allcated memory block (for strings, for conses, ...). */ |
| @@ -2935,6 +2950,7 @@ make_save_value (pointer, integer) | |||
| 2935 | p = XSAVE_VALUE (val); | 2950 | p = XSAVE_VALUE (val); |
| 2936 | p->pointer = pointer; | 2951 | p->pointer = pointer; |
| 2937 | p->integer = integer; | 2952 | p->integer = integer; |
| 2953 | p->dogc = 0; | ||
| 2938 | return val; | 2954 | return val; |
| 2939 | } | 2955 | } |
| 2940 | 2956 | ||
| @@ -4969,6 +4985,7 @@ mark_object (arg) | |||
| 4969 | if (XMARKER (obj)->gcmarkbit) | 4985 | if (XMARKER (obj)->gcmarkbit) |
| 4970 | break; | 4986 | break; |
| 4971 | XMARKER (obj)->gcmarkbit = 1; | 4987 | XMARKER (obj)->gcmarkbit = 1; |
| 4988 | |||
| 4972 | switch (XMISCTYPE (obj)) | 4989 | switch (XMISCTYPE (obj)) |
| 4973 | { | 4990 | { |
| 4974 | case Lisp_Misc_Buffer_Local_Value: | 4991 | case Lisp_Misc_Buffer_Local_Value: |
| @@ -4993,6 +5010,8 @@ mark_object (arg) | |||
| 4993 | /* DO NOT mark thru the marker's chain. | 5010 | /* DO NOT mark thru the marker's chain. |
| 4994 | The buffer's markers chain does not preserve markers from gc; | 5011 | The buffer's markers chain does not preserve markers from gc; |
| 4995 | instead, markers are removed from the chain when freed by gc. */ | 5012 | instead, markers are removed from the chain when freed by gc. */ |
| 5013 | break; | ||
| 5014 | |||
| 4996 | case Lisp_Misc_Intfwd: | 5015 | case Lisp_Misc_Intfwd: |
| 4997 | case Lisp_Misc_Boolfwd: | 5016 | case Lisp_Misc_Boolfwd: |
| 4998 | case Lisp_Misc_Objfwd: | 5017 | case Lisp_Misc_Objfwd: |
| @@ -5002,7 +5021,21 @@ mark_object (arg) | |||
| 5002 | since all markable slots in current buffer marked anyway. */ | 5021 | since all markable slots in current buffer marked anyway. */ |
| 5003 | /* Don't need to do Lisp_Objfwd, since the places they point | 5022 | /* Don't need to do Lisp_Objfwd, since the places they point |
| 5004 | are protected with staticpro. */ | 5023 | are protected with staticpro. */ |
| 5024 | break; | ||
| 5025 | |||
| 5005 | case Lisp_Misc_Save_Value: | 5026 | case Lisp_Misc_Save_Value: |
| 5027 | { | ||
| 5028 | register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj); | ||
| 5029 | /* If DOGC is set, POINTER is the address of a memory | ||
| 5030 | area containing INTEGER potential Lisp_Objects. */ | ||
| 5031 | if (ptr->dogc) | ||
| 5032 | { | ||
| 5033 | Lisp_Object *p = (Lisp_Object *) ptr->pointer; | ||
| 5034 | int nelt; | ||
| 5035 | for (nelt = ptr->integer; nelt > 0; nelt--, p++) | ||
| 5036 | mark_maybe_object (*p); | ||
| 5037 | } | ||
| 5038 | } | ||
| 5006 | break; | 5039 | break; |
| 5007 | 5040 | ||
| 5008 | case Lisp_Misc_Overlay: | 5041 | case Lisp_Misc_Overlay: |