Mercurial > hg > xemacs-beta
comparison src/alloc.c @ 177:6075d714658b r20-3b15
Import from CVS: tag r20-3b15
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:51:16 +0200 |
parents | 2d532a89d707 |
children | e121b013d1f0 |
comparison
equal
deleted
inserted
replaced
176:6866abce6aaf | 177:6075d714658b |
---|---|
65 #define PURESTAT | 65 #define PURESTAT |
66 | 66 |
67 /* Define this to use malloc/free with no freelist for all datatypes, | 67 /* Define this to use malloc/free with no freelist for all datatypes, |
68 the hope being that some debugging tools may help detect | 68 the hope being that some debugging tools may help detect |
69 freed memory references */ | 69 freed memory references */ |
70 /* #define ALLOC_NO_POOLS */ | 70 #ifdef USE_DEBUG_MALLOC /* Taking the above comment at face value -slb */ |
71 #include <dmalloc.h> | |
72 #define ALLOC_NO_POOLS | |
73 #endif | |
71 | 74 |
72 #include "puresize.h" | 75 #include "puresize.h" |
73 | 76 |
74 #ifdef DEBUG_XEMACS | 77 #ifdef DEBUG_XEMACS |
75 int debug_allocation; | 78 int debug_allocation; |
362 error ("Memory exhausted"); | 365 error ("Memory exhausted"); |
363 } | 366 } |
364 | 367 |
365 /* like malloc and realloc but check for no memory left, and block input. */ | 368 /* like malloc and realloc but check for no memory left, and block input. */ |
366 | 369 |
370 #ifdef xmalloc | |
371 #undef xmalloc | |
372 #endif | |
373 | |
367 void * | 374 void * |
368 xmalloc (int size) | 375 xmalloc (int size) |
369 { | 376 { |
370 void *val; | 377 void *val; |
371 | 378 |
380 { | 387 { |
381 void *val = xmalloc (size); | 388 void *val = xmalloc (size); |
382 memset (val, 0, size); | 389 memset (val, 0, size); |
383 return val; | 390 return val; |
384 } | 391 } |
392 | |
393 #ifdef xrealloc | |
394 #undef xrealloc | |
395 #endif | |
385 | 396 |
386 void * | 397 void * |
387 xrealloc (void *block, int size) | 398 xrealloc (void *block, int size) |
388 { | 399 { |
389 void *val; | 400 void *val; |
449 | 460 |
450 #else | 461 #else |
451 | 462 |
452 #define deadbeef_memory(ptr, size) | 463 #define deadbeef_memory(ptr, size) |
453 | 464 |
465 #endif | |
466 | |
467 #ifdef xstrdup | |
468 #undef xstrdup | |
454 #endif | 469 #endif |
455 | 470 |
456 char * | 471 char * |
457 xstrdup (CONST char *str) | 472 xstrdup (CONST char *str) |
458 { | 473 { |
1597 b->annotated = Fpurecopy (Vcurrent_compiled_function_annotation); | 1612 b->annotated = Fpurecopy (Vcurrent_compiled_function_annotation); |
1598 else if (!NILP (Vload_file_name_internal_the_purecopy)) | 1613 else if (!NILP (Vload_file_name_internal_the_purecopy)) |
1599 b->annotated = Vload_file_name_internal_the_purecopy; | 1614 b->annotated = Vload_file_name_internal_the_purecopy; |
1600 else if (!NILP (Vload_file_name_internal)) | 1615 else if (!NILP (Vload_file_name_internal)) |
1601 { | 1616 { |
1617 struct gcpro gcpro1; | |
1618 GCPRO1(val); /* don't let val or b get reaped */ | |
1602 Vload_file_name_internal_the_purecopy = | 1619 Vload_file_name_internal_the_purecopy = |
1603 Fpurecopy (Ffile_name_nondirectory (Vload_file_name_internal)); | 1620 Fpurecopy (Ffile_name_nondirectory (Vload_file_name_internal)); |
1604 b->annotated = Vload_file_name_internal_the_purecopy; | 1621 b->annotated = Vload_file_name_internal_the_purecopy; |
1622 UNGCPRO; | |
1605 } | 1623 } |
1606 #endif | 1624 #endif |
1607 | 1625 |
1608 #ifdef I18N3 | 1626 #ifdef I18N3 |
1609 if (docp && intp && domp) | 1627 if (docp && intp && domp) |