aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorKaroly Lorentey2005-10-09 20:00:17 +0000
committerKaroly Lorentey2005-10-09 20:00:17 +0000
commit0ff21b4e57b1dc7c714c21c9eea1a4906630ecf2 (patch)
tree3e8596405b243531128cd0f1d8f59d2ab9e7f7c7 /src/alloc.c
parenta3c07f683d1f9fbf7c7af0120dfebc5fc34b61fa (diff)
parent20ef86730cca82a1a2e212a665c0b119ed2d70b2 (diff)
downloademacs-0ff21b4e57b1dc7c714c21c9eea1a4906630ecf2.tar.gz
emacs-0ff21b4e57b1dc7c714c21c9eea1a4906630ecf2.zip
Merged from miles@gnu.org--gnu-2005 (patch 118-132, 551-577)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-551 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-552 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-553 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-554 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-555 Remove CVS keywords from newsticker files * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-556 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-557 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-558 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-559 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-560 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-561 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-562 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-563 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-564 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-565 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-566 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-567 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-568 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-569 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-570 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-571 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-572 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-573 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-574 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-575 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-576 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-577 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-118 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-119 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-120 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-121 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-122 Update from CVS: lisp/mm-url.el (mm-url-decode-entities): Fix regexp. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-123 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-124 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-125 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-126 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-127 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-128 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-129 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-130 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-131 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-132 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-423
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 3861d87c3d8..ff0c3d46d44 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -548,6 +548,21 @@ DEFUN ("memory-full-p", Fmemory_full_p, Smemory_full_p, 0, 0, 0,
548 return (spare_memory ? Qnil : Qt); 548 return (spare_memory ? Qnil : Qt);
549} 549}
550 550
551/* If we released our reserve (due to running out of memory),
552 and we have a fair amount free once again,
553 try to set aside another reserve in case we run out once more.
554
555 This is called when a relocatable block is freed in ralloc.c. */
556
557void
558refill_memory_reserve ()
559{
560#ifndef SYSTEM_MALLOC
561 if (spare_memory == 0)
562 spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
563#endif
564}
565
551/* Called if we can't allocate relocatable space for a buffer. */ 566/* Called if we can't allocate relocatable space for a buffer. */
552 567
553void 568void
@@ -1135,20 +1150,6 @@ allocate_buffer ()
1135 1150
1136#ifndef SYSTEM_MALLOC 1151#ifndef SYSTEM_MALLOC
1137 1152
1138/* If we released our reserve (due to running out of memory),
1139 and we have a fair amount free once again,
1140 try to set aside another reserve in case we run out once more.
1141
1142 This is called when a relocatable block is freed in ralloc.c. */
1143
1144void
1145refill_memory_reserve ()
1146{
1147 if (spare_memory == 0)
1148 spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
1149}
1150
1151
1152/* Arranging to disable input signals while we're in malloc. 1153/* Arranging to disable input signals while we're in malloc.
1153 1154
1154 This only works with GNU malloc. To help out systems which can't 1155 This only works with GNU malloc. To help out systems which can't
@@ -1162,20 +1163,21 @@ refill_memory_reserve ()
1162#ifndef SYNC_INPUT 1163#ifndef SYNC_INPUT
1163 1164
1164#ifndef DOUG_LEA_MALLOC 1165#ifndef DOUG_LEA_MALLOC
1165extern void * (*__malloc_hook) P_ ((size_t)); 1166extern void * (*__malloc_hook) P_ ((size_t, const void *));
1166extern void * (*__realloc_hook) P_ ((void *, size_t)); 1167extern void * (*__realloc_hook) P_ ((void *, size_t, const void *));
1167extern void (*__free_hook) P_ ((void *)); 1168extern void (*__free_hook) P_ ((void *, const void *));
1168/* Else declared in malloc.h, perhaps with an extra arg. */ 1169/* Else declared in malloc.h, perhaps with an extra arg. */
1169#endif /* DOUG_LEA_MALLOC */ 1170#endif /* DOUG_LEA_MALLOC */
1170static void * (*old_malloc_hook) (); 1171static void * (*old_malloc_hook) P_ ((size_t, const void *));
1171static void * (*old_realloc_hook) (); 1172static void * (*old_realloc_hook) P_ ((void *, size_t, const void*));
1172static void (*old_free_hook) (); 1173static void (*old_free_hook) P_ ((void*, const void*));
1173 1174
1174/* This function is used as the hook for free to call. */ 1175/* This function is used as the hook for free to call. */
1175 1176
1176static void 1177static void
1177emacs_blocked_free (ptr) 1178emacs_blocked_free (ptr, ptr2)
1178 void *ptr; 1179 void *ptr;
1180 const void *ptr2;
1179{ 1181{
1180 BLOCK_INPUT_ALLOC; 1182 BLOCK_INPUT_ALLOC;
1181 1183
@@ -1222,8 +1224,9 @@ emacs_blocked_free (ptr)
1222/* This function is the malloc hook that Emacs uses. */ 1224/* This function is the malloc hook that Emacs uses. */
1223 1225
1224static void * 1226static void *
1225emacs_blocked_malloc (size) 1227emacs_blocked_malloc (size, ptr)
1226 size_t size; 1228 size_t size;
1229 const void *ptr;
1227{ 1230{
1228 void *value; 1231 void *value;
1229 1232
@@ -1269,9 +1272,10 @@ emacs_blocked_malloc (size)
1269/* This function is the realloc hook that Emacs uses. */ 1272/* This function is the realloc hook that Emacs uses. */
1270 1273
1271static void * 1274static void *
1272emacs_blocked_realloc (ptr, size) 1275emacs_blocked_realloc (ptr, size, ptr2)
1273 void *ptr; 1276 void *ptr;
1274 size_t size; 1277 size_t size;
1278 const void *ptr2;
1275{ 1279{
1276 void *value; 1280 void *value;
1277 1281