Mercurial > emacs
comparison src/alloc.c @ 90381:65ca8fb66a0d
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-54
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 190-203)
- Update from CVS
- Undo incorrect merge of etc/images/README from Gnus 5.10
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 74-80)
- Update from CVS
- Update from CVS: README: Addition from 5.10.6 tar ball.
| author | Miles Bader <miles@gnu.org> |
|---|---|
| date | Sun, 09 Apr 2006 00:38:22 +0000 |
| parents | 494bf720eaf0 272487a77b8e |
| children | 8a8e69664178 |
comparison
equal
deleted
inserted
replaced
| 90380:4bf7966e0788 | 90381:65ca8fb66a0d |
|---|---|
| 20 Boston, MA 02110-1301, USA. */ | 20 Boston, MA 02110-1301, USA. */ |
| 21 | 21 |
| 22 #include <config.h> | 22 #include <config.h> |
| 23 #include <stdio.h> | 23 #include <stdio.h> |
| 24 #include <limits.h> /* For CHAR_BIT. */ | 24 #include <limits.h> /* For CHAR_BIT. */ |
| 25 | |
| 26 #ifdef STDC_HEADERS | |
| 27 #include <stddef.h> /* For offsetof, used by PSEUDOVECSIZE. */ | |
| 28 #endif | |
| 25 | 29 |
| 26 #ifdef ALLOC_DEBUG | 30 #ifdef ALLOC_DEBUG |
| 27 #undef INLINE | 31 #undef INLINE |
| 28 #endif | 32 #endif |
| 29 | 33 |
| 3001 | 3005 |
| 3002 | 3006 |
| 3003 struct Lisp_Process * | 3007 struct Lisp_Process * |
| 3004 allocate_process () | 3008 allocate_process () |
| 3005 { | 3009 { |
| 3006 EMACS_INT len = VECSIZE (struct Lisp_Process); | 3010 /* Memory-footprint of the object in nb of Lisp_Object fields. */ |
| 3007 struct Lisp_Vector *v = allocate_vectorlike (len, MEM_TYPE_PROCESS); | 3011 EMACS_INT memlen = VECSIZE (struct Lisp_Process); |
| 3012 /* Size if we only count the actual Lisp_Object fields (which need to be | |
| 3013 traced by the GC). */ | |
| 3014 EMACS_INT lisplen = PSEUDOVECSIZE (struct Lisp_Process, pid); | |
| 3015 struct Lisp_Vector *v = allocate_vectorlike (memlen, MEM_TYPE_PROCESS); | |
| 3008 EMACS_INT i; | 3016 EMACS_INT i; |
| 3009 | 3017 |
| 3010 for (i = 0; i < len; ++i) | 3018 for (i = 0; i < lisplen; ++i) |
| 3011 v->contents[i] = Qnil; | 3019 v->contents[i] = Qnil; |
| 3012 v->size = len; | 3020 v->size = lisplen; |
| 3013 | 3021 |
| 3014 return (struct Lisp_Process *) v; | 3022 return (struct Lisp_Process *) v; |
| 3015 } | 3023 } |
| 3016 | 3024 |
| 3017 | 3025 |
| 5513 CHECK_LIVE (live_vector_p); | 5521 CHECK_LIVE (live_vector_p); |
| 5514 VECTOR_MARK (ptr); /* Else mark it */ | 5522 VECTOR_MARK (ptr); /* Else mark it */ |
| 5515 if (size & PSEUDOVECTOR_FLAG) | 5523 if (size & PSEUDOVECTOR_FLAG) |
| 5516 size &= PSEUDOVECTOR_SIZE_MASK; | 5524 size &= PSEUDOVECTOR_SIZE_MASK; |
| 5517 | 5525 |
| 5526 /* Note that this size is not the memory-footprint size, but only | |
| 5527 the number of Lisp_Object fields that we should trace. | |
| 5528 The distinction is used e.g. by Lisp_Process which places extra | |
| 5529 non-Lisp_Object fields at the end of the structure. */ | |
| 5518 for (i = 0; i < size; i++) /* and then mark its elements */ | 5530 for (i = 0; i < size; i++) /* and then mark its elements */ |
| 5519 mark_object (ptr->contents[i]); | 5531 mark_object (ptr->contents[i]); |
| 5520 } | 5532 } |
| 5521 break; | 5533 break; |
| 5522 | 5534 |
