Mercurial > emacs
comparison src/alloc.c @ 56202:db1817b88294
(safe_alloca_unwind): Clear dogc and pointer members.
(make_save_value): Init new dogc member.
(mark_object): Mark Lisp_Save_Value pointer array if dogc is set.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Tue, 22 Jun 2004 13:56:34 +0000 |
parents | e3720731abbb |
children | a446552d2240 dbcd0af66869 |
comparison
equal
deleted
inserted
replaced
56201:10ec6b8cf09a | 56202:db1817b88294 |
---|---|
583 | 583 |
584 Lisp_Object | 584 Lisp_Object |
585 safe_alloca_unwind (arg) | 585 safe_alloca_unwind (arg) |
586 Lisp_Object arg; | 586 Lisp_Object arg; |
587 { | 587 { |
588 xfree (XSAVE_VALUE (arg)->pointer); | 588 register struct Lisp_Save_Value *p = XSAVE_VALUE (arg); |
589 | |
590 p->dogc = 0; | |
591 xfree (p->pointer); | |
592 p->pointer = 0; | |
589 return Qnil; | 593 return Qnil; |
590 } | 594 } |
591 | 595 |
592 | 596 |
593 /* Like malloc but used for allocating Lisp data. NBYTES is the | 597 /* Like malloc but used for allocating Lisp data. NBYTES is the |
2943 val = allocate_misc (); | 2947 val = allocate_misc (); |
2944 XMISCTYPE (val) = Lisp_Misc_Save_Value; | 2948 XMISCTYPE (val) = Lisp_Misc_Save_Value; |
2945 p = XSAVE_VALUE (val); | 2949 p = XSAVE_VALUE (val); |
2946 p->pointer = pointer; | 2950 p->pointer = pointer; |
2947 p->integer = integer; | 2951 p->integer = integer; |
2952 p->dogc = 0; | |
2948 return val; | 2953 return val; |
2949 } | 2954 } |
2950 | 2955 |
2951 DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, | 2956 DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, |
2952 doc: /* Return a newly allocated marker which does not point at any place. */) | 2957 doc: /* Return a newly allocated marker which does not point at any place. */) |
4976 case Lisp_Misc: | 4981 case Lisp_Misc: |
4977 CHECK_ALLOCATED_AND_LIVE (live_misc_p); | 4982 CHECK_ALLOCATED_AND_LIVE (live_misc_p); |
4978 if (XMARKER (obj)->gcmarkbit) | 4983 if (XMARKER (obj)->gcmarkbit) |
4979 break; | 4984 break; |
4980 XMARKER (obj)->gcmarkbit = 1; | 4985 XMARKER (obj)->gcmarkbit = 1; |
4986 | |
4981 switch (XMISCTYPE (obj)) | 4987 switch (XMISCTYPE (obj)) |
4982 { | 4988 { |
4983 case Lisp_Misc_Buffer_Local_Value: | 4989 case Lisp_Misc_Buffer_Local_Value: |
4984 case Lisp_Misc_Some_Buffer_Local_Value: | 4990 case Lisp_Misc_Some_Buffer_Local_Value: |
4985 { | 4991 { |
5000 | 5006 |
5001 case Lisp_Misc_Marker: | 5007 case Lisp_Misc_Marker: |
5002 /* DO NOT mark thru the marker's chain. | 5008 /* DO NOT mark thru the marker's chain. |
5003 The buffer's markers chain does not preserve markers from gc; | 5009 The buffer's markers chain does not preserve markers from gc; |
5004 instead, markers are removed from the chain when freed by gc. */ | 5010 instead, markers are removed from the chain when freed by gc. */ |
5011 break; | |
5012 | |
5005 case Lisp_Misc_Intfwd: | 5013 case Lisp_Misc_Intfwd: |
5006 case Lisp_Misc_Boolfwd: | 5014 case Lisp_Misc_Boolfwd: |
5007 case Lisp_Misc_Objfwd: | 5015 case Lisp_Misc_Objfwd: |
5008 case Lisp_Misc_Buffer_Objfwd: | 5016 case Lisp_Misc_Buffer_Objfwd: |
5009 case Lisp_Misc_Kboard_Objfwd: | 5017 case Lisp_Misc_Kboard_Objfwd: |
5010 /* Don't bother with Lisp_Buffer_Objfwd, | 5018 /* Don't bother with Lisp_Buffer_Objfwd, |
5011 since all markable slots in current buffer marked anyway. */ | 5019 since all markable slots in current buffer marked anyway. */ |
5012 /* Don't need to do Lisp_Objfwd, since the places they point | 5020 /* Don't need to do Lisp_Objfwd, since the places they point |
5013 are protected with staticpro. */ | 5021 are protected with staticpro. */ |
5022 break; | |
5023 | |
5014 case Lisp_Misc_Save_Value: | 5024 case Lisp_Misc_Save_Value: |
5025 { | |
5026 register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj); | |
5027 /* If DOGC is set, POINTER is the address of a memory | |
5028 area containing INTEGER potential Lisp_Objects. */ | |
5029 if (ptr->dogc) | |
5030 { | |
5031 Lisp_Object *p = (Lisp_Object *) ptr->pointer; | |
5032 int nelt; | |
5033 for (nelt = ptr->integer; nelt > 0; nelt--, p++) | |
5034 mark_maybe_object (*p); | |
5035 } | |
5036 } | |
5015 break; | 5037 break; |
5016 | 5038 |
5017 case Lisp_Misc_Overlay: | 5039 case Lisp_Misc_Overlay: |
5018 { | 5040 { |
5019 struct Lisp_Overlay *ptr = XOVERLAY (obj); | 5041 struct Lisp_Overlay *ptr = XOVERLAY (obj); |