GNU bug report logs - #8800
24.0.50: At revno: 104484 alloc.c does not compile

Previous Next

Package: emacs;

Reported by: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>

Date: Sat, 4 Jun 2011 10:35:01 UTC

Severity: normal

Found in version 24.0.50

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Donald Ephraim Curtis <dcurtis <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 8800 <at> debbugs.gnu.org, Emacs Development <Emacs-devel <at> gnu.org>
Subject: bug#8800: Compilation error caused by SPARE_MEMORY
Date: Mon, 06 Jun 2011 09:42:29 -0700
On 06/06/11 05:02, Donald Ephraim Curtis wrote:
> shouldn't there still be a check to see if SPARE_MEMORY is defined already?

If SYSTEM_MALLOC is not defined, SPARE_MEMORY must be defined,
so the code is OK.  This can be seen by looking at the larger context
in alloc.c.  However, I can see that the code is confusing, so
I simplified it this way:

* alloc.c: Simplify handling of large-request failures (Bug#8800).
(SPARE_MEMORY): Always define.
(LARGE_REQUEST): Remove.
(memory_full): Use SPARE_MEMORY rather than LARGE_REQUEST.
=== modified file 'src/alloc.c'
--- src/alloc.c	2011-06-06 04:54:23 +0000
+++ src/alloc.c	2011-06-06 16:39:06 +0000
@@ -190,17 +190,10 @@

 static char *spare_memory[7];

-#ifndef SYSTEM_MALLOC
-/* Amount of spare memory to keep in large reserve block.  */
+/* Amount of spare memory to keep in large reserve block, or to see
+   whether this much is available when malloc fails on a larger request.  */

 #define SPARE_MEMORY (1 << 14)
-#endif
-
-#ifdef SYSTEM_MALLOC
-# define LARGE_REQUEST (1 << 14)
-#else
-# define LARGE_REQUEST SPARE_MEMORY
-#endif

 /* Number of extra blocks malloc should get when it needs more core.  */

@@ -3289,9 +3282,9 @@
 {
   /* Do not go into hysterics merely because a large request failed.  */
   int enough_free_memory = 0;
-  if (LARGE_REQUEST < nbytes)
+  if (SPARE_MEMORY < nbytes)
     {
-      void *p = malloc (LARGE_REQUEST);
+      void *p = malloc (SPARE_MEMORY);
       if (p)
 	{
 	  free (p);





This bug report was last modified 14 years and 49 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.