comparison src/free-hook.c @ 269:b2472a1930f2 r20-5b33

Import from CVS: tag r20-5b33
author cvs
date Mon, 13 Aug 2007 10:27:19 +0200
parents 966663fcf606
children c5d627a313b1
comparison
equal deleted inserted replaced
268:6ced69ccd85f 269:b2472a1930f2
224 224
225 if (!present) 225 if (!present)
226 { 226 {
227 /* This can only happen if you try to free something that didn't 227 /* This can only happen if you try to free something that didn't
228 come from malloc */ 228 come from malloc */
229 #if 1 229 #if !defined(__linux__)
230 /* I originally wrote: "There's really no need to drop core." 230 /* I originally wrote: "There's really no need to drop core."
231 I have seen the error of my ways. -slb */ 231 I have seen the error of my ways. -slb */
232 if (strict_free_check) 232 if (strict_free_check)
233 { 233 {
234 abort (); 234 abort ();
241 } 241 }
242 242
243 if (size < 0) 243 if (size < 0)
244 { 244 {
245 /* This happens when you free twice */ 245 /* This happens when you free twice */
246 #if 1 246 #if !defined(__linux__)
247 /* See above comment. */ 247 /* See above comment. */
248 if (strict_free_check) 248 if (strict_free_check)
249 { 249 {
250 abort (); 250 abort ();
251 } 251 }
350 { 350 {
351 EMACS_INT present; 351 EMACS_INT present;
352 unsigned long old_size; 352 unsigned long old_size;
353 void *result = malloc (size); 353 void *result = malloc (size);
354 354
355 if (!ptr) return result;
355 present = (EMACS_INT) gethash (ptr, pointer_table, (void **) &old_size); 356 present = (EMACS_INT) gethash (ptr, pointer_table, (void **) &old_size);
356 if (!present) 357 if (!present)
357 { 358 {
358 /* This can only happen by reallocing a pointer that didn't 359 /* This can only happen by reallocing a pointer that didn't
359 come from malloc. */ 360 come from malloc. */
360 #if 1 361 #if !defined(__linux__)
361 /* see comment in check_free(). */ 362 /* see comment in check_free(). */
362 abort (); 363 abort ();
363 #endif 364 #endif
364 printf("Realloc'ing unmalloc'ed pointer at %p\n", ptr); 365 printf("Realloc'ing unmalloc'ed pointer at %p\n", ptr);
365 } 366 }