Mercurial > hg > xemacs-beta
comparison src/gmalloc.c @ 88:821dec489c24 r20-0
Import from CVS: tag r20-0
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:09:59 +0200 |
parents | 364816949b59 |
children | 4be1180a9e89 |
comparison
equal
deleted
inserted
replaced
87:7df2982f5c17 | 88:821dec489c24 |
---|---|
256 /* If not NULL, this function is called after each time | 256 /* If not NULL, this function is called after each time |
257 `__morecore' is called to increase the data size. */ | 257 `__morecore' is called to increase the data size. */ |
258 extern void (*__after_morecore_hook) __P ((void)); | 258 extern void (*__after_morecore_hook) __P ((void)); |
259 | 259 |
260 /* Nonzero if `malloc' has been called and done its initialization. */ | 260 /* Nonzero if `malloc' has been called and done its initialization. */ |
261 extern int __malloc_initialized; | 261 /* extern int __malloc_initialized; */ |
262 | 262 |
263 /* Hooks for debugging versions. */ | 263 /* Hooks for debugging versions. */ |
264 extern void (*__free_hook) __P ((__ptr_t __ptr)); | 264 extern void (*__free_hook) __P ((__ptr_t __ptr)); |
265 extern __ptr_t (*__malloc_hook) __P ((size_t __size)); | 265 extern __ptr_t (*__malloc_hook) __P ((size_t __size)); |
266 extern __ptr_t (*__realloc_hook) __P ((__ptr_t __ptr, size_t __size)); | 266 extern __ptr_t (*__realloc_hook) __P ((__ptr_t __ptr, size_t __size)); |
429 __malloc_size_t _bytes_used; | 429 __malloc_size_t _bytes_used; |
430 __malloc_size_t _chunks_free; | 430 __malloc_size_t _chunks_free; |
431 __malloc_size_t _bytes_free; | 431 __malloc_size_t _bytes_free; |
432 | 432 |
433 /* Are you experienced? */ | 433 /* Are you experienced? */ |
434 int __malloc_initialized; | 434 static int __malloc_initialized; |
435 | 435 |
436 void (*__after_morecore_hook) __P ((void)); | 436 void (*__after_morecore_hook) __P ((void)); |
437 | 437 |
438 /* Aligned allocation. */ | 438 /* Aligned allocation. */ |
439 static __ptr_t align __P ((__malloc_size_t)); | 439 static __ptr_t align __P ((__malloc_size_t)); |
554 #else | 554 #else |
555 if (size == 0) | 555 if (size == 0) |
556 return NULL; | 556 return NULL; |
557 #endif | 557 #endif |
558 | 558 |
559 if (__malloc_hook != NULL) | |
560 return (*__malloc_hook) (size); | |
561 | |
559 if (!__malloc_initialized) | 562 if (!__malloc_initialized) |
560 if (!initialize ()) | 563 if (!initialize ()) |
561 return NULL; | 564 return NULL; |
562 | |
563 if (__malloc_hook != NULL) | |
564 return (*__malloc_hook) (size); | |
565 | 565 |
566 #ifdef SUNOS_LOCALTIME_BUG | 566 #ifdef SUNOS_LOCALTIME_BUG |
567 /* Workaround for localtime() allocating 8 bytes and writing 9 bug... */ | 567 /* Workaround for localtime() allocating 8 bytes and writing 9 bug... */ |
568 if (size < 16) | 568 if (size < 16) |
569 size = 16; | 569 size = 16; |