Mercurial > hg > xemacs-beta
comparison src/alloc.c @ 456:e7ef97881643 r21-2-43
Import from CVS: tag r21-2-43
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:41:24 +0200 |
parents | d7a9135ec789 |
children | c33ae14dd6d0 |
comparison
equal
deleted
inserted
replaced
455:5b97c1cd6ed0 | 456:e7ef97881643 |
---|---|
1041 } | 1041 } |
1042 | 1042 |
1043 static size_t | 1043 static size_t |
1044 size_vector (const void *lheader) | 1044 size_vector (const void *lheader) |
1045 { | 1045 { |
1046 return FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Vector, contents, | 1046 return FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Vector, Lisp_Object, contents, |
1047 ((Lisp_Vector *) lheader)->size); | 1047 ((Lisp_Vector *) lheader)->size); |
1048 } | 1048 } |
1049 | 1049 |
1050 static int | 1050 static int |
1051 vector_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | 1051 vector_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) |
1089 /* #### should allocate `small' vectors from a frob-block */ | 1089 /* #### should allocate `small' vectors from a frob-block */ |
1090 static Lisp_Vector * | 1090 static Lisp_Vector * |
1091 make_vector_internal (size_t sizei) | 1091 make_vector_internal (size_t sizei) |
1092 { | 1092 { |
1093 /* no vector_next */ | 1093 /* no vector_next */ |
1094 size_t sizem = FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Vector, contents, sizei); | 1094 size_t sizem = FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Vector, Lisp_Object, |
1095 contents, sizei); | |
1095 Lisp_Vector *p = (Lisp_Vector *) alloc_lcrecord (sizem, &lrecord_vector); | 1096 Lisp_Vector *p = (Lisp_Vector *) alloc_lcrecord (sizem, &lrecord_vector); |
1096 | 1097 |
1097 p->size = sizei; | 1098 p->size = sizei; |
1098 return p; | 1099 return p; |
1099 } | 1100 } |
1252 /* #### should allocate `small' bit vectors from a frob-block */ | 1253 /* #### should allocate `small' bit vectors from a frob-block */ |
1253 static Lisp_Bit_Vector * | 1254 static Lisp_Bit_Vector * |
1254 make_bit_vector_internal (size_t sizei) | 1255 make_bit_vector_internal (size_t sizei) |
1255 { | 1256 { |
1256 size_t num_longs = BIT_VECTOR_LONG_STORAGE (sizei); | 1257 size_t num_longs = BIT_VECTOR_LONG_STORAGE (sizei); |
1257 size_t sizem = FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Bit_Vector, bits, num_longs); | 1258 size_t sizem = FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Bit_Vector, unsigned long, |
1259 bits, num_longs); | |
1258 Lisp_Bit_Vector *p = (Lisp_Bit_Vector *) allocate_lisp_storage (sizem); | 1260 Lisp_Bit_Vector *p = (Lisp_Bit_Vector *) allocate_lisp_storage (sizem); |
1259 set_lheader_implementation (&p->lheader, &lrecord_bit_vector); | 1261 set_lheader_implementation (&p->lheader, &lrecord_bit_vector); |
1260 | 1262 |
1261 INCREMENT_CONS_COUNTER (sizem, "bit-vector"); | 1263 INCREMENT_CONS_COUNTER (sizem, "bit-vector"); |
1262 | 1264 |
2573 if (! C_READONLY_RECORD_HEADER_P(&(v->lheader))) | 2575 if (! C_READONLY_RECORD_HEADER_P(&(v->lheader))) |
2574 UNMARK_RECORD_HEADER (&(v->lheader)); | 2576 UNMARK_RECORD_HEADER (&(v->lheader)); |
2575 total_size += len; | 2577 total_size += len; |
2576 total_storage += | 2578 total_storage += |
2577 MALLOC_OVERHEAD + | 2579 MALLOC_OVERHEAD + |
2578 FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Bit_Vector, bits, | 2580 FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Bit_Vector, unsigned long, |
2579 BIT_VECTOR_LONG_STORAGE (len)); | 2581 bits, BIT_VECTOR_LONG_STORAGE (len)); |
2580 num_used++; | 2582 num_used++; |
2581 /* #### May modify next on a C_READONLY bitvector */ | 2583 /* #### May modify next on a C_READONLY bitvector */ |
2582 prev = &(bit_vector_next (v)); | 2584 prev = &(bit_vector_next (v)); |
2583 bit_vector = *prev; | 2585 bit_vector = *prev; |
2584 } | 2586 } |