summaryrefslogtreecommitdiff
path: root/src/alloc.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2003-09-08 11:56:09 +0000
committerKenichi Handa <handa@m17n.org>2003-09-08 11:56:09 +0000
commit463f5630a5e7cbe7f042bc1175d1fa1c4e98860f (patch)
tree3287d0c628fea2249abf4635b3a4f45bedd6f8c4 /src/alloc.c
parent4256310de631bd57c78b88b5131caa073315b3d7 (diff)
downloademacs-463f5630a5e7cbe7f042bc1175d1fa1c4e98860f.tar.gz
emacs-463f5630a5e7cbe7f042bc1175d1fa1c4e98860f.tar.bz2
emacs-463f5630a5e7cbe7f042bc1175d1fa1c4e98860f.zip
New directory
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/src/alloc.c b/src/alloc.c
index f73edcd70e9..102bc637b58 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -552,7 +552,7 @@ xrealloc (block, size)
}
-/* Like free but block interrupt input. */
+/* Like free but block interrupt input.. */
void
xfree (block)
@@ -738,8 +738,7 @@ lisp_align_malloc (nbytes, type)
if (!free_ablock)
{
- int i;
- EMACS_INT aligned; /* int gets warning casting to 64-bit pointer. */
+ int i, aligned;
#ifdef DOUG_LEA_MALLOC
/* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed
@@ -767,23 +766,6 @@ lisp_align_malloc (nbytes, type)
mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
#endif
- /* If the memory just allocated cannot be addressed thru a Lisp
- object's pointer, and it needs to be, that's equivalent to
- running out of memory. */
- if (type != MEM_TYPE_NON_LISP)
- {
- Lisp_Object tem;
- char *end = (char *) base + ABLOCKS_BYTES - 1;
- XSETCONS (tem, end);
- if ((char *) XCONS (tem) != end)
- {
- lisp_malloc_loser = base;
- free (base);
- UNBLOCK_INPUT;
- memory_full ();
- }
- }
-
/* Initialize the blocks and put them on the free list.
Is `base' was not properly aligned, we can't use the last block. */
for (i = 0; i < (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1); i++)
@@ -806,6 +788,21 @@ lisp_align_malloc (nbytes, type)
val = free_ablock;
free_ablock = free_ablock->x.next_free;
+ /* If the memory just allocated cannot be addressed thru a Lisp
+ object's pointer, and it needs to be,
+ that's equivalent to running out of memory. */
+ if (val && type != MEM_TYPE_NON_LISP)
+ {
+ Lisp_Object tem;
+ XSETCONS (tem, (char *) val + nbytes - 1);
+ if ((char *) XCONS (tem) != (char *) val + nbytes - 1)
+ {
+ lisp_malloc_loser = val;
+ free (val);
+ val = 0;
+ }
+ }
+
#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
if (val && type != MEM_TYPE_NON_LISP)
mem_insert (val, (char *) val + nbytes, type);
@@ -5027,7 +5024,6 @@ mark_object (arg)
since all markable slots in current buffer marked anyway. */
/* Don't need to do Lisp_Objfwd, since the places they point
are protected with staticpro. */
- case Lisp_Misc_Save_Value:
break;
case Lisp_Misc_Overlay:
@@ -5789,6 +5785,3 @@ The time is in seconds as a floating point value. */);
defsubr (&Sgc_status);
#endif
}
-
-/* arch-tag: 6695ca10-e3c5-4c2c-8bc3-ed26a7dda857
- (do not change this comment) */