From 4e75f29d3a9eaaaa185d67facb7ba38611045aed Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 16 Apr 2011 14:47:57 -0700 Subject: [PATCH] * alloc.c (bytes_used_when_full, SPARE_MEMORY, BYTES_USED): Define only if needed. --- src/ChangeLog | 3 +++ src/alloc.c | 25 +++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 906cde0508..f4a15df66b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-04-16 Paul Eggert + * alloc.c (bytes_used_when_full, SPARE_MEMORY, BYTES_USED): + Define only if needed. + * sysdep.c (_FILE_OFFSET_BITS): Make this hack even uglier by pacifying GCC about it. Maybe it's time to retire it? * xfaces.c (USG, __TIMEVAL__): Likewise. diff --git a/src/alloc.c b/src/alloc.c index 16cd183aaa..412527b41a 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -139,10 +139,6 @@ static pthread_mutex_t alloc_mutex; #endif /* ! defined HAVE_GTK_AND_PTHREAD */ #endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */ -/* Value of _bytes_used, when spare_memory was freed. */ - -static __malloc_size_t bytes_used_when_full; - /* Mark, unmark, query mark bit of a Lisp string. S must be a pointer to a struct Lisp_String. */ @@ -198,9 +194,11 @@ static int total_free_floats, total_floats; static char *spare_memory[7]; +#ifndef SYSTEM_MALLOC /* Amount of spare memory to keep in large reserve block. */ #define SPARE_MEMORY (1 << 14) +#endif /* Number of extra blocks malloc should get when it needs more core. */ @@ -469,13 +467,6 @@ display_malloc_warning (void) intern ("emergency")); pending_malloc_warning = 0; } - - -#ifdef DOUG_LEA_MALLOC -# define BYTES_USED (mallinfo ().uordblks) -#else -# define BYTES_USED _bytes_used -#endif /* Called if we can't allocate relocatable space for a buffer. */ @@ -1096,8 +1087,18 @@ static void * (*old_malloc_hook) (size_t, const void *); static void * (*old_realloc_hook) (void *, size_t, const void*); static void (*old_free_hook) (void*, const void*); +#ifdef DOUG_LEA_MALLOC +# define BYTES_USED (mallinfo ().uordblks) +#else +# define BYTES_USED _bytes_used +#endif + static __malloc_size_t bytes_used_when_reconsidered; +/* Value of _bytes_used, when spare_memory was freed. */ + +static __malloc_size_t bytes_used_when_full; + /* This function is used as the hook for free to call. */ static void @@ -3296,7 +3297,7 @@ memory_full (void) /* Record the space now used. When it decreases substantially, we can refill the memory reserve. */ -#ifndef SYSTEM_MALLOC +#if !defined SYSTEM_MALLOC && !defined SYNC_INPUT bytes_used_when_full = BYTES_USED; #endif -- 2.20.1