comparison src/alloc.c @ 83162:dbcd0af66869

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
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 24 Jun 2004 07:44:13 +0000
parents 9fb10038ca55 db1817b88294
children 8e4ea1e2c254
comparison
equal deleted inserted replaced
83161:8d62eda26760 83162:dbcd0af66869
578 bcopy (s, p, len); 578 bcopy (s, p, len);
579 return p; 579 return p;
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, ...). */
586 601
587 static void *lisp_malloc_loser; 602 static void *lisp_malloc_loser;
2933 val = allocate_misc (); 2948 val = allocate_misc ();
2934 XMISCTYPE (val) = Lisp_Misc_Save_Value; 2949 XMISCTYPE (val) = Lisp_Misc_Save_Value;
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
2941 DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, 2957 DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0,
2942 doc: /* Return a newly allocated marker which does not point at any place. */) 2958 doc: /* Return a newly allocated marker which does not point at any place. */)
4967 case Lisp_Misc: 4983 case Lisp_Misc:
4968 CHECK_ALLOCATED_AND_LIVE (live_misc_p); 4984 CHECK_ALLOCATED_AND_LIVE (live_misc_p);
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:
4975 case Lisp_Misc_Some_Buffer_Local_Value: 4992 case Lisp_Misc_Some_Buffer_Local_Value:
4976 { 4993 {
4991 5008
4992 case Lisp_Misc_Marker: 5009 case Lisp_Misc_Marker:
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:
4999 case Lisp_Misc_Buffer_Objfwd: 5018 case Lisp_Misc_Buffer_Objfwd:
5000 case Lisp_Misc_Kboard_Objfwd: 5019 case Lisp_Misc_Kboard_Objfwd:
5001 /* Don't bother with Lisp_Buffer_Objfwd, 5020 /* Don't bother with Lisp_Buffer_Objfwd,
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:
5009 { 5042 {
5010 struct Lisp_Overlay *ptr = XOVERLAY (obj); 5043 struct Lisp_Overlay *ptr = XOVERLAY (obj);