X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Ffree-hook.c;h=4dbd9ba6ab11de72ea3622b9363e92d393844435;hb=112b4eb6a71cd613a534b4246b4cc024ed9bf22e;hp=af1df698f168a4d79b8467f155d4a16d4a8f2681;hpb=cb9f6f4eadc44f1becb32cbbd1db26449e347755;p=chise%2Fxemacs-chise.git- diff --git a/src/free-hook.c b/src/free-hook.c index af1df69..4dbd9ba 100644 --- a/src/free-hook.c +++ b/src/free-hook.c @@ -85,14 +85,14 @@ void *malloc (size_t); /* System function prototypes don't belong in C source files */ /* extern void free (void *); */ -struct hash_table *pointer_table; +static struct hash_table *pointer_table; extern void (*__free_hook) (void *); extern void *(*__malloc_hook) (size_t); static void *check_malloc (size_t); -typedef void (*fun_ptr) (); +typedef void (*fun_ptr) (void); /* free_queue is not too useful without backtrace logging */ #define FREE_QUEUE_LIMIT 1 @@ -110,11 +110,11 @@ typedef struct { unsigned long length; } free_queue_entry; -free_queue_entry free_queue[FREE_QUEUE_LIMIT]; +static free_queue_entry free_queue[FREE_QUEUE_LIMIT]; -int current_free; +static int current_free; -int strict_free_check; +static int strict_free_check; static void check_free (void *ptr) @@ -131,7 +131,7 @@ check_free (void *ptr) #endif EMACS_INT present = (EMACS_INT) gethash (ptr, pointer_table, - (CONST void **) &size); + (const void **) &size); if (!present) { @@ -257,7 +257,7 @@ check_realloc (void * ptr, size_t size) void *result = malloc (size); if (!ptr) return result; - present = (EMACS_INT) gethash (ptr, pointer_table, (CONST void **) &old_size); + present = (EMACS_INT) gethash (ptr, pointer_table, (const void **) &old_size); if (!present) { /* This can only happen by reallocing a pointer that didn't @@ -418,7 +418,8 @@ void *(*__realloc_hook)(void *, size_t) = check_realloc; /* Note: There is no more input blocking in XEmacs */ typedef enum { block_type, unblock_type, totally_type, - gcpro1_type, gcpro2_type, gcpro3_type, gcpro4_type, ungcpro_type + gcpro1_type, gcpro2_type, gcpro3_type, gcpro4_type, gcpro5_type, + ungcpro_type } blocktype; struct block_input_history_struct @@ -431,7 +432,7 @@ struct block_input_history_struct typedef struct block_input_history_struct block_input_history; -#endif +#endif /* DEBUG_INPUT_BLOCKING || DEBUG_GCPRO */ #ifdef DEBUG_INPUT_BLOCKING @@ -469,7 +470,7 @@ note_block (char *file, int line, blocktype type) blhistptr = 0; } -#endif +#endif /* DEBUG_INPUT_BLOCKING */ #ifdef DEBUG_GCPRO @@ -481,8 +482,6 @@ block_input_history gcprohist[GCPROHISTLIMIT]; static void log_gcpro (char *file, int line, struct gcpro *value, blocktype type) { - FRAME start_frame; - if (type == ungcpro_type) { if (value == gcprolist) goto OK; @@ -492,6 +491,8 @@ log_gcpro (char *file, int line, struct gcpro *value, blocktype type) if (value == gcprolist->next->next) goto OK; if (! gcprolist->next->next) abort (); if (value == gcprolist->next->next->next) goto OK; + if (! gcprolist->next->next->next) abort (); + if (value == gcprolist->next->next->next->next) goto OK; abort (); OK:; } @@ -569,6 +570,9 @@ debug_ungcpro (char *file, int line, struct gcpro *gcpro1) gcprolist = gcpro1->next; } + +/* To be called from the debugger */ +void show_gcprohist (void); void show_gcprohist (void) { @@ -585,10 +589,11 @@ show_gcprohist (void) gcprohist[j].type == gcpro2_type ? "GCPRO2" : gcprohist[j].type == gcpro3_type ? "GCPRO3" : gcprohist[j].type == gcpro4_type ? "GCPRO4" : + gcprohist[j].type == gcpro5_type ? "GCPRO5" : gcprohist[j].type == ungcpro_type ? "UNGCPRO" : "???"), gcprohist[j].value); } fflush (stdout); } -#endif +#endif /* DEBUG_GCPRO */