aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorMiles Bader2005-10-07 07:15:40 +0000
committerMiles Bader2005-10-07 07:15:40 +0000
commit00e18f33adde1d2f196fdf9cadf11235cc4fcc8f (patch)
tree8c553c9a361da158ba47f3d0ed0429da180d957f /src/alloc.c
parentba4c328314c2b01e6dcc3807a0666a644c3f3954 (diff)
parent9e1cb4bc96d36af6e8b893d467970a25afead03b (diff)
downloademacs-00e18f33adde1d2f196fdf9cadf11235cc4fcc8f.tar.gz
emacs-00e18f33adde1d2f196fdf9cadf11235cc4fcc8f.zip
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.c50
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,
547 return (spare_memory ? Qnil : Qt); 547 return (spare_memory ? Qnil : Qt);
548} 548}
549 549
550/* If we released our reserve (due to running out of memory),
551 and we have a fair amount free once again,
552 try to set aside another reserve in case we run out once more.
553
554 This is called when a relocatable block is freed in ralloc.c. */
555
556void
557refill_memory_reserve ()
558{
559#ifndef SYSTEM_MALLOC
560 if (spare_memory == 0)
561 spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
562#endif
563}
564
550/* Called if we can't allocate relocatable space for a buffer. */ 565/* Called if we can't allocate relocatable space for a buffer. */
551 566
552void 567void
@@ -1134,20 +1149,6 @@ allocate_buffer ()
1134 1149
1135#ifndef SYSTEM_MALLOC 1150#ifndef SYSTEM_MALLOC
1136 1151
1137/* If we released our reserve (due to running out of memory),
1138 and we have a fair amount free once again,
1139 try to set aside another reserve in case we run out once more.
1140
1141 This is called when a relocatable block is freed in ralloc.c. */
1142
1143void
1144refill_memory_reserve ()
1145{
1146 if (spare_memory == 0)
1147 spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
1148}
1149
1150
1151/* Arranging to disable input signals while we're in malloc. 1152/* Arranging to disable input signals while we're in malloc.
1152 1153
1153 This only works with GNU malloc. To help out systems which can't 1154 This only works with GNU malloc. To help out systems which can't
@@ -1161,20 +1162,21 @@ refill_memory_reserve ()
1161#ifndef SYNC_INPUT 1162#ifndef SYNC_INPUT
1162 1163
1163#ifndef DOUG_LEA_MALLOC 1164#ifndef DOUG_LEA_MALLOC
1164extern void * (*__malloc_hook) P_ ((size_t)); 1165extern void * (*__malloc_hook) P_ ((size_t, const void *));
1165extern void * (*__realloc_hook) P_ ((void *, size_t)); 1166extern void * (*__realloc_hook) P_ ((void *, size_t, const void *));
1166extern void (*__free_hook) P_ ((void *)); 1167extern void (*__free_hook) P_ ((void *, const void *));
1167/* Else declared in malloc.h, perhaps with an extra arg. */ 1168/* Else declared in malloc.h, perhaps with an extra arg. */
1168#endif /* DOUG_LEA_MALLOC */ 1169#endif /* DOUG_LEA_MALLOC */
1169static void * (*old_malloc_hook) (); 1170static void * (*old_malloc_hook) P_ ((size_t, const void *));
1170static void * (*old_realloc_hook) (); 1171static void * (*old_realloc_hook) P_ ((void *, size_t, const void*));
1171static void (*old_free_hook) (); 1172static void (*old_free_hook) P_ ((void*, const void*));
1172 1173
1173/* This function is used as the hook for free to call. */ 1174/* This function is used as the hook for free to call. */
1174 1175
1175static void 1176static void
1176emacs_blocked_free (ptr) 1177emacs_blocked_free (ptr, ptr2)
1177 void *ptr; 1178 void *ptr;
1179 const void *ptr2;
1178{ 1180{
1179 BLOCK_INPUT_ALLOC; 1181 BLOCK_INPUT_ALLOC;
1180 1182
@@ -1221,8 +1223,9 @@ emacs_blocked_free (ptr)
1221/* This function is the malloc hook that Emacs uses. */ 1223/* This function is the malloc hook that Emacs uses. */
1222 1224
1223static void * 1225static void *
1224emacs_blocked_malloc (size) 1226emacs_blocked_malloc (size, ptr)
1225 size_t size; 1227 size_t size;
1228 const void *ptr;
1226{ 1229{
1227 void *value; 1230 void *value;
1228 1231
@@ -1268,9 +1271,10 @@ emacs_blocked_malloc (size)
1268/* This function is the realloc hook that Emacs uses. */ 1271/* This function is the realloc hook that Emacs uses. */
1269 1272
1270static void * 1273static void *
1271emacs_blocked_realloc (ptr, size) 1274emacs_blocked_realloc (ptr, size, ptr2)
1272 void *ptr; 1275 void *ptr;
1273 size_t size; 1276 size_t size;
1277 const void *ptr2;
1274{ 1278{
1275 void *value; 1279 void *value;
1276 1280