X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/6c523803b30c3d41a21ce36fbfb0437bf6ce68e5..97f3b3d6e9f5524a01443f9352737013be4fc6ae:/src/alloc.c diff --git a/src/alloc.c b/src/alloc.c index 6aaa34dfc2..e6edea42c9 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1,5 +1,5 @@ /* Storage allocation and gc for GNU Emacs Lisp interpreter. - Copyright (C) 1985, 1986, 1988, 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 1985, 1986, 1988, 1993 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include "config.h" #include "lisp.h" @@ -233,7 +234,7 @@ emacs_blocked_malloc (size) BLOCK_INPUT; __malloc_hook = old_malloc_hook; - value = malloc (size); + value = (void *) malloc (size); __malloc_hook = emacs_blocked_malloc; UNBLOCK_INPUT; @@ -249,7 +250,7 @@ emacs_blocked_realloc (ptr, size) BLOCK_INPUT; __realloc_hook = old_realloc_hook; - value = realloc (ptr, size); + value = (void *) realloc (ptr, size); __realloc_hook = emacs_blocked_realloc; UNBLOCK_INPUT; @@ -358,7 +359,7 @@ mark_interval_tree (tree) { if (!NULL_INTERVAL_P (i)) mark_interval_tree (i); } /* The oddity in the call to XUNMARK is necessary because XUNMARK - expands to an assigment to its argument, and most C compilers don't + expands to an assignment to its argument, and most C compilers don't support casts on the left operand of `='. */ #define UNMARK_BALANCE_INTERVALS(i) \ { \ @@ -957,9 +958,10 @@ make_event_array (nargs, args) for (i = 0; i < nargs; i++) /* The things that fit in a string - are characters that are in 0...127 after discarding the meta bit. */ + are characters that are in 0...127, + after discarding the meta bit and all the bits above it. */ if (XTYPE (args[i]) != Lisp_Int - || (XUINT (args[i]) & ~CHAR_META) >= 0200) + || (XUINT (args[i]) & ~(-CHAR_META)) >= 0200) return Fvector (nargs, args); /* Since the loop exited, we know that all the things in it are @@ -1356,7 +1358,7 @@ Garbage collection happens automatically if you cons more than\n\ if (gc_cons_threshold < 10000) gc_cons_threshold = 10000; - if (omessage) + if (omessage || minibuf_level > 0) message1 (omessage); else if (!noninteractive) message1 ("Garbage collecting...done"); @@ -1442,7 +1444,7 @@ clear_marks () If the object referred to has not been seen yet, recursively mark all the references contained in it. - If the object referenced is a short string, the referrencing slot + If the object referenced is a short string, the referencing slot is threaded into a chain of such slots, pointed to from the `size' field of the string. The actual string size lives in the last slot in the chain. We recognize the end @@ -1585,10 +1587,18 @@ mark_object (objptr) if (XMARKBIT (ptr->plist)) break; XMARK (ptr->plist); mark_object ((Lisp_Object *) &ptr->value); + if ((unsigned int) ptr <= 4) + abort (); mark_object (&ptr->function); + if ((unsigned int) ptr <= 4) + abort (); mark_object (&ptr->plist); + if ((unsigned int) ptr <= 4) + abort (); XSETTYPE (*(Lisp_Object *) &ptr->name, Lisp_String); mark_object (&ptr->name); + if ((unsigned int) ptr <= 4) + abort (); ptr = ptr->next; if (ptr) { @@ -1622,7 +1632,11 @@ mark_object (objptr) XUNMARK (obj); goto loop; } + if (ptr == 0) + abort (); mark_object (&ptr->car); + if (ptr == 0) + abort (); objptr = &ptr->cdr; obj = ptr->cdr; goto loop;