comparison src/alloc.c @ 37049:184d1fb71cc1

(live_string_p, live_cons_p, live_symbol_p) (live_float_p, live_misc_p): Return 1 only if the offset of the pointer in its block is >= 0.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 29 Mar 2001 10:35:24 +0000
parents 4df2ac60690e
children 477b46494bad 95f65d0a108e
comparison
equal deleted inserted replaced
37048:92d84a200c07 37049:184d1fb71cc1
3112 struct string_block *b = (struct string_block *) m->start; 3112 struct string_block *b = (struct string_block *) m->start;
3113 int offset = (char *) p - (char *) &b->strings[0]; 3113 int offset = (char *) p - (char *) &b->strings[0];
3114 3114
3115 /* P must point to the start of a Lisp_String structure, and it 3115 /* P must point to the start of a Lisp_String structure, and it
3116 must not be on the free-list. */ 3116 must not be on the free-list. */
3117 return (offset % sizeof b->strings[0] == 0 3117 return (offset >= 0
3118 && offset % sizeof b->strings[0] == 0
3118 && ((struct Lisp_String *) p)->data != NULL); 3119 && ((struct Lisp_String *) p)->data != NULL);
3119 } 3120 }
3120 else 3121 else
3121 return 0; 3122 return 0;
3122 } 3123 }
3136 int offset = (char *) p - (char *) &b->conses[0]; 3137 int offset = (char *) p - (char *) &b->conses[0];
3137 3138
3138 /* P must point to the start of a Lisp_Cons, not be 3139 /* P must point to the start of a Lisp_Cons, not be
3139 one of the unused cells in the current cons block, 3140 one of the unused cells in the current cons block,
3140 and not be on the free-list. */ 3141 and not be on the free-list. */
3141 return (offset % sizeof b->conses[0] == 0 3142 return (offset >= 0
3143 && offset % sizeof b->conses[0] == 0
3142 && (b != cons_block 3144 && (b != cons_block
3143 || offset / sizeof b->conses[0] < cons_block_index) 3145 || offset / sizeof b->conses[0] < cons_block_index)
3144 && !EQ (((struct Lisp_Cons *) p)->car, Vdead)); 3146 && !EQ (((struct Lisp_Cons *) p)->car, Vdead));
3145 } 3147 }
3146 else 3148 else
3162 int offset = (char *) p - (char *) &b->symbols[0]; 3164 int offset = (char *) p - (char *) &b->symbols[0];
3163 3165
3164 /* P must point to the start of a Lisp_Symbol, not be 3166 /* P must point to the start of a Lisp_Symbol, not be
3165 one of the unused cells in the current symbol block, 3167 one of the unused cells in the current symbol block,
3166 and not be on the free-list. */ 3168 and not be on the free-list. */
3167 return (offset % sizeof b->symbols[0] == 0 3169 return (offset >= 0
3170 && offset % sizeof b->symbols[0] == 0
3168 && (b != symbol_block 3171 && (b != symbol_block
3169 || offset / sizeof b->symbols[0] < symbol_block_index) 3172 || offset / sizeof b->symbols[0] < symbol_block_index)
3170 && !EQ (((struct Lisp_Symbol *) p)->function, Vdead)); 3173 && !EQ (((struct Lisp_Symbol *) p)->function, Vdead));
3171 } 3174 }
3172 else 3175 else
3188 int offset = (char *) p - (char *) &b->floats[0]; 3191 int offset = (char *) p - (char *) &b->floats[0];
3189 3192
3190 /* P must point to the start of a Lisp_Float, not be 3193 /* P must point to the start of a Lisp_Float, not be
3191 one of the unused cells in the current float block, 3194 one of the unused cells in the current float block,
3192 and not be on the free-list. */ 3195 and not be on the free-list. */
3193 return (offset % sizeof b->floats[0] == 0 3196 return (offset >= 0
3197 && offset % sizeof b->floats[0] == 0
3194 && (b != float_block 3198 && (b != float_block
3195 || offset / sizeof b->floats[0] < float_block_index) 3199 || offset / sizeof b->floats[0] < float_block_index)
3196 && !EQ (((struct Lisp_Float *) p)->type, Vdead)); 3200 && !EQ (((struct Lisp_Float *) p)->type, Vdead));
3197 } 3201 }
3198 else 3202 else
3214 int offset = (char *) p - (char *) &b->markers[0]; 3218 int offset = (char *) p - (char *) &b->markers[0];
3215 3219
3216 /* P must point to the start of a Lisp_Misc, not be 3220 /* P must point to the start of a Lisp_Misc, not be
3217 one of the unused cells in the current misc block, 3221 one of the unused cells in the current misc block,
3218 and not be on the free-list. */ 3222 and not be on the free-list. */
3219 return (offset % sizeof b->markers[0] == 0 3223 return (offset >= 0
3224 && offset % sizeof b->markers[0] == 0
3220 && (b != marker_block 3225 && (b != marker_block
3221 || offset / sizeof b->markers[0] < marker_block_index) 3226 || offset / sizeof b->markers[0] < marker_block_index)
3222 && ((union Lisp_Misc *) p)->u_marker.type != Lisp_Misc_Free); 3227 && ((union Lisp_Misc *) p)->u_marker.type != Lisp_Misc_Free);
3223 } 3228 }
3224 else 3229 else