diff options
| author | Miles Bader <miles@gnu.org> | 2005-10-07 07:15:40 +0000 |
|---|---|---|
| committer | Miles Bader <miles@gnu.org> | 2005-10-07 07:15:40 +0000 |
| commit | 00e18f33adde1d2f196fdf9cadf11235cc4fcc8f (patch) | |
| tree | 8c553c9a361da158ba47f3d0ed0429da180d957f /src/alloc.c | |
| parent | ba4c328314c2b01e6dcc3807a0666a644c3f3954 (diff) | |
| parent | 9e1cb4bc96d36af6e8b893d467970a25afead03b (diff) | |
| download | emacs-00e18f33adde1d2f196fdf9cadf11235cc4fcc8f.tar.gz | |
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-88
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 569-579)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 129-132)
- Update from CVS
- Merge from emacs--cvs-trunk--0
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/src/alloc.c b/src/alloc.c index 35bdfc8a93a..5d8b1c1a359 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -547,6 +547,21 @@ DEFUN ("memory-full-p", Fmemory_full_p, Smemory_full_p, 0, 0, 0, return (spare_memory ? Qnil : Qt); } +/* If we released our reserve (due to running out of memory), + and we have a fair amount free once again, + try to set aside another reserve in case we run out once more. + + This is called when a relocatable block is freed in ralloc.c. */ + +void +refill_memory_reserve () +{ +#ifndef SYSTEM_MALLOC + if (spare_memory == 0) + spare_memory = (char *) malloc ((size_t) SPARE_MEMORY); +#endif +} + /* Called if we can't allocate relocatable space for a buffer. */ void @@ -1134,20 +1149,6 @@ allocate_buffer () #ifndef SYSTEM_MALLOC -/* If we released our reserve (due to running out of memory), - and we have a fair amount free once again, - try to set aside another reserve in case we run out once more. - - This is called when a relocatable block is freed in ralloc.c. */ - -void -refill_memory_reserve () -{ - if (spare_memory == 0) - spare_memory = (char *) malloc ((size_t) SPARE_MEMORY); -} - - /* Arranging to disable input signals while we're in malloc. This only works with GNU malloc. To help out systems which can't @@ -1161,20 +1162,21 @@ refill_memory_reserve () #ifndef SYNC_INPUT #ifndef DOUG_LEA_MALLOC -extern void * (*__malloc_hook) P_ ((size_t)); -extern void * (*__realloc_hook) P_ ((void *, size_t)); -extern void (*__free_hook) P_ ((void *)); +extern void * (*__malloc_hook) P_ ((size_t, const void *)); +extern void * (*__realloc_hook) P_ ((void *, size_t, const void *)); +extern void (*__free_hook) P_ ((void *, const void *)); /* Else declared in malloc.h, perhaps with an extra arg. */ #endif /* DOUG_LEA_MALLOC */ -static void * (*old_malloc_hook) (); -static void * (*old_realloc_hook) (); -static void (*old_free_hook) (); +static void * (*old_malloc_hook) P_ ((size_t, const void *)); +static void * (*old_realloc_hook) P_ ((void *, size_t, const void*)); +static void (*old_free_hook) P_ ((void*, const void*)); /* This function is used as the hook for free to call. */ static void -emacs_blocked_free (ptr) +emacs_blocked_free (ptr, ptr2) void *ptr; + const void *ptr2; { BLOCK_INPUT_ALLOC; @@ -1221,8 +1223,9 @@ emacs_blocked_free (ptr) /* This function is the malloc hook that Emacs uses. */ static void * -emacs_blocked_malloc (size) +emacs_blocked_malloc (size, ptr) size_t size; + const void *ptr; { void *value; @@ -1268,9 +1271,10 @@ emacs_blocked_malloc (size) /* This function is the realloc hook that Emacs uses. */ static void * -emacs_blocked_realloc (ptr, size) +emacs_blocked_realloc (ptr, size, ptr2) void *ptr; size_t size; + const void *ptr2; { void *value; |
