# HG changeset patch # User crestani # Date 1187175970 0 # Node ID 229bd619740a608e32f1011147be4cb6ed9d0457 # Parent 9a42c5e5eb4ebaa32313229e8ae8d80338c6cd84 [xemacs-hg @ 2007-08-15 11:06:02 by crestani] 2007-08-15 Marcus Crestani * buffer.c (Fkill_buffer): * console-tty.c (free_tty_console_struct): * device-gtk.c (free_gtk_device_struct): * device-msw.c (mswindows_delete_device): * device-msw.c (msprinter_delete_device): * device-x.c (free_x_device_struct): * device-x.c (x_delete_device): * dynarr.c (Dynarr_lisp_realloc): * dynarr.c (Dynarr_free): * elhash.c: * elhash.c (finalize_hash_table): * elhash.c (resize_hash_table): * elhash.c (pdump_reorganize_hash_table): * extents.c (gap_array_delete_marker): * frame-gtk.c (gtk_delete_frame): * frame-msw.c (mswindows_delete_frame): * frame-x.c (x_delete_frame): * glyphs.c (check_for_ignored_expose): * mc-alloc.c (mc_realloc_1): * mc-alloc.h: * objects-tty.c (tty_finalize_color_instance): * objects-tty.c (tty_finalize_font_instance): * objects-tty.c (console_type_create_objects_tty): * syntax.c: * syntax.c (uninit_buffer_syntax_cache): * vdb.c (Ftest_vdb): Remove all calls to mc_free. diff -r 9a42c5e5eb4e -r 229bd619740a src/ChangeLog --- a/src/ChangeLog Tue Aug 14 21:51:16 2007 +0000 +++ b/src/ChangeLog Wed Aug 15 11:06:10 2007 +0000 @@ -1,3 +1,32 @@ +2007-08-15 Marcus Crestani + + * buffer.c (Fkill_buffer): + * console-tty.c (free_tty_console_struct): + * device-gtk.c (free_gtk_device_struct): + * device-msw.c (mswindows_delete_device): + * device-msw.c (msprinter_delete_device): + * device-x.c (free_x_device_struct): + * device-x.c (x_delete_device): + * dynarr.c (Dynarr_lisp_realloc): + * dynarr.c (Dynarr_free): + * elhash.c: + * elhash.c (finalize_hash_table): + * elhash.c (resize_hash_table): + * elhash.c (pdump_reorganize_hash_table): + * extents.c (gap_array_delete_marker): + * frame-gtk.c (gtk_delete_frame): + * frame-msw.c (mswindows_delete_frame): + * frame-x.c (x_delete_frame): + * glyphs.c (check_for_ignored_expose): + * mc-alloc.c (mc_realloc_1): + * mc-alloc.h: + * objects-tty.c (tty_finalize_color_instance): + * objects-tty.c (tty_finalize_font_instance): + * objects-tty.c (console_type_create_objects_tty): + * syntax.c: + * syntax.c (uninit_buffer_syntax_cache): + * vdb.c (Ftest_vdb): Remove all calls to mc_free. + 2006-12-29 Nix * gc.c (recompute_need_to_garbage_collect): Avoid numeric diff -r 9a42c5e5eb4e -r 229bd619740a src/buffer.c --- a/src/buffer.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/buffer.c Wed Aug 15 11:06:10 2007 +0000 @@ -1348,7 +1348,9 @@ } uninit_buffer_markers (b); +#ifndef NEW_GC uninit_buffer_syntax_cache (b); +#endif /* not NEW_GC */ kill_buffer_local_variables (b); diff -r 9a42c5e5eb4e -r 229bd619740a src/console-tty.c --- a/src/console-tty.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/console-tty.c Wed Aug 15 11:06:10 2007 +0000 @@ -219,9 +219,7 @@ xfree (tty_con->term_entry_buffer, char *); tty_con->term_entry_buffer = NULL; } -#ifdef NEW_GC - mc_free (tty_con); -#else /* not NEW_GC */ +#ifndef NEW_GC xfree (tty_con, struct tty_console *); #endif /* not NEW_GC */ CONSOLE_TTY_DATA (con) = NULL; diff -r 9a42c5e5eb4e -r 229bd619740a src/device-gtk.c --- a/src/device-gtk.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/device-gtk.c Wed Aug 15 11:06:10 2007 +0000 @@ -359,15 +359,13 @@ /* closing an X connection */ /************************************************************************/ +#ifndef NEW_GC static void free_gtk_device_struct (struct device *d) { -#ifdef NEW_GC - mc_free (d->device_data); -#else /* not NEW_GC */ xfree (d->device_data, void *); +} #endif /* not NEW_GC */ -} static void gtk_delete_device (struct device *d) diff -r 9a42c5e5eb4e -r 229bd619740a src/device-msw.c --- a/src/device-msw.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/device-msw.c Wed Aug 15 11:06:10 2007 +0000 @@ -300,9 +300,7 @@ #endif DeleteDC (DEVICE_MSWINDOWS_HCDC (d)); -#ifdef NEW_GC - mc_free (d->device_data); -#else /* not NEW_GC */ +#ifndef NEW_GC xfree (d->device_data, void *); #endif /* not NEW_GC */ } @@ -576,9 +574,7 @@ DEVICE_MSPRINTER_DEVMODE (d) = Qnil; } -#ifdef NEW_GC - mc_free (d->device_data); -#else /* not NEW_GC */ +#ifndef NEW_GC xfree (d->device_data, void *); #endif /* not NEW_GC */ } diff -r 9a42c5e5eb4e -r 229bd619740a src/device-x.c --- a/src/device-x.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/device-x.c Wed Aug 15 11:06:10 2007 +0000 @@ -939,15 +939,13 @@ /* closing an X connection */ /************************************************************************/ +#ifndef NEW_GC static void free_x_device_struct (struct device *d) { -#ifdef NEW_GC - mc_free (d->device_data); -#else /* not NEW_GC */ xfree (d->device_data, void *); +} #endif /* not NEW_GC */ -} static void x_delete_device (struct device *d) @@ -990,7 +988,9 @@ #endif } +#ifndef NEW_GC free_x_device_struct (d); +#endif /* not NEW_GC */ } diff -r 9a42c5e5eb4e -r 229bd619740a src/dynarr.c --- a/src/dynarr.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/dynarr.c Wed Aug 15 11:06:10 2007 +0000 @@ -162,13 +162,10 @@ Dynarr_lisp_realloc (Dynarr *dy, int new_size) { void *new_base = alloc_lrecord_array (dy->elsize, new_size, dy->lisp_imp); - void *old_base = dy->base; if (dy->base) memcpy (new_base, dy->base, (dy->max < new_size ? dy->max : new_size) * dy->elsize); dy->base = new_base; - if (old_base) - mc_free (old_base); } void * @@ -266,16 +263,12 @@ #ifdef NEW_GC if (dy->base && !DUMPEDP (dy->base)) { - if (dy->lisp_imp) - mc_free (dy->base); - else + if (!dy->lisp_imp) xfree (dy->base, void *); } if(!DUMPEDP (dy)) { - if (dy->lisp_imp) - mc_free (dy); - else + if (!dy->lisp_imp) xfree (dy, Dynarr *); } #else /* not NEW_GC */ diff -r 9a42c5e5eb4e -r 229bd619740a src/elhash.c --- a/src/elhash.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/elhash.c Wed Aug 15 11:06:10 2007 +0000 @@ -398,28 +398,16 @@ write_fmt_string (printcharfun, " 0x%x>", ht->header.uid); } +#ifndef NEW_GC static void -free_hentries ( -#if defined (NEW_GC) && !defined (ERROR_CHECK_STRUCTURES) - htentry *UNUSED (hentries), -#else - htentry *hentries, -#endif +free_hentries (htentry *hentries, #ifdef ERROR_CHECK_STRUCTURES size_t size -#else /* not (NEW_GC && ! ERROR_CHECK_STRUCTURES) */ +#else /* not ERROR_CHECK_STRUCTURES) */ size_t UNUSED (size) -#endif /* not (NEW_GC && ! ERROR_CHECK_STRUCTURES) */ +#endif /* not ERROR_CHECK_STRUCTURES) */ ) { -#ifdef NEW_GC -#ifdef ERROR_CHECK_STRUCTURES - htentry *e, *sentinel; - - for (e = hentries, sentinel = e + size; e < sentinel; e++) - mc_free (e); -#endif -#else /* not NEW_GC */ #ifdef ERROR_CHECK_STRUCTURES /* Ensure a crash if other code uses the discarded entries afterwards. */ htentry *e, *sentinel; @@ -430,10 +418,8 @@ if (!DUMPEDP (hentries)) xfree (hentries, htentry *); -#endif /* not NEW_GC */ } -#ifndef NEW_GC static void finalize_hash_table (void *header, int for_disksave) { @@ -1071,7 +1057,9 @@ *probe = *e; } +#ifndef NEW_GC free_hentries (old_entries, old_size); +#endif /* not NEW_GC */ } /* After a hash table has been saved to disk and later restored by the @@ -1101,9 +1089,7 @@ memcpy (ht->hentries, new_entries, ht->size * sizeof (htentry)); -#ifdef NEW_GC - mc_free (new_entries); -#else /* not NEW_GC */ +#ifndef NEW_GC xfree (new_entries, htentry *); #endif /* not NEW_GC */ } diff -r 9a42c5e5eb4e -r 229bd619740a src/extents.c --- a/src/extents.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/extents.c Wed Aug 15 11:06:10 2007 +0000 @@ -720,9 +720,7 @@ prev->next = p->next; else ga->markers = p->next; -#ifdef NEW_GC - mc_free (m); -#else /* not NEW_GC */ +#ifndef NEW_GC m->next = gap_array_marker_freelist; m->pos = 0xDEADBEEF; /* -559038737 base 10 */ gap_array_marker_freelist = m; diff -r 9a42c5e5eb4e -r 229bd619740a src/frame-gtk.c --- a/src/frame-gtk.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/frame-gtk.c Wed Aug 15 11:06:10 2007 +0000 @@ -1354,9 +1354,7 @@ if (FRAME_GTK_GEOM_FREE_ME_PLEASE (f)) xfree (FRAME_GTK_GEOM_FREE_ME_PLEASE (f), char *); -#ifdef NEW_GC - mc_free (f->frame_data); -#else /* not NEW_GC */ +#ifndef NEW_GC xfree (f->frame_data, void *); #endif /* not NEW_GC */ f->frame_data = 0; diff -r 9a42c5e5eb4e -r 229bd619740a src/frame-msw.c --- a/src/frame-msw.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/frame-msw.c Wed Aug 15 11:06:10 2007 +0000 @@ -353,9 +353,7 @@ #endif ReleaseDC (FRAME_MSWINDOWS_HANDLE (f), FRAME_MSWINDOWS_DC (f)); DestroyWindow (FRAME_MSWINDOWS_HANDLE (f)); -#ifdef NEW_GC - mc_free (f->frame_data); -#else /* not NEW_GC */ +#ifndef NEW_GC xfree (f->frame_data, void *); #endif /* not NEW_GC */ } diff -r 9a42c5e5eb4e -r 229bd619740a src/frame-x.c --- a/src/frame-x.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/frame-x.c Wed Aug 15 11:06:10 2007 +0000 @@ -2686,9 +2686,7 @@ if (f->frame_data) { -#ifdef NEW_GC - mc_free (f->frame_data); -#else /* not NEW_GC */ +#ifndef NEW_GC xfree (f->frame_data, void *); #endif /* not NEW_GC */ f->frame_data = 0; diff -r 9a42c5e5eb4e -r 229bd619740a src/glyphs.c --- a/src/glyphs.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/glyphs.c Wed Aug 15 11:06:10 2007 +0000 @@ -4576,9 +4576,7 @@ if (ei == f->subwindow_exposures_tail) f->subwindow_exposures_tail = prev; -#ifdef NEW_GC - mc_free (ei); -#else /* not NEW_GC */ +#ifndef NEW_GC Blocktype_free (the_expose_ignore_blocktype, ei); #endif /* not NEW_GC */ return 1; diff -r 9a42c5e5eb4e -r 229bd619740a src/mc-alloc.c --- a/src/mc-alloc.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/mc-alloc.c Wed Aug 15 11:06:10 2007 +0000 @@ -1576,15 +1576,6 @@ } -/* Frees the cell pointed to by ptr. */ -void -mc_free (void *UNUSED (ptr)) -{ - /* Manual frees are not allowed with asynchronous finalization */ - return; -} - - /* Changes the size of the cell pointed to by ptr. Returns the new address of the new cell with new size. */ void * @@ -1603,12 +1594,10 @@ #ifdef ALLOC_TYPE_STATS inc_lrecord_stats (size, (struct lrecord_header *) result); #endif /* not ALLOC_TYPE_STATS */ - /* mc_free (ptr); not needed, will be collected next gc */ return result; } else { - /* mc_free (ptr); not needed, will be collected next gc */ return 0; } } diff -r 9a42c5e5eb4e -r 229bd619740a src/mc-alloc.h --- a/src/mc-alloc.h Tue Aug 14 21:51:16 2007 +0000 +++ b/src/mc-alloc.h Wed Aug 15 11:06:10 2007 +0000 @@ -49,12 +49,6 @@ dynamic arrays use this function. */ void *mc_alloc_array (size_t size, EMACS_INT elemcount); -/* Free the object pointed to by ptr and make its memory re-usable - again. The memory must have been returned by a previous call to - mc_alloc(). This can be used to free memory explicitly, outside a - garbage collection. */ -void mc_free (void *ptr); - /* Modify the size of the memory block pointed to by ptr. Return the address of the new block of given size. The content of the memory block will be unchanged to the minimum of the old and new sizes: if diff -r 9a42c5e5eb4e -r 229bd619740a src/objects-tty.c --- a/src/objects-tty.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/objects-tty.c Wed Aug 15 11:06:10 2007 +0000 @@ -218,16 +218,14 @@ { } +#ifndef NEW_GC static void tty_finalize_color_instance (Lisp_Color_Instance *c) { if (c->data) -#ifdef NEW_GC - mc_free (c->data); -#else /* not NEW_GC */ xfree (c->data, void *); +} #endif /* not NEW_GC */ -} static int tty_color_instance_equal (Lisp_Color_Instance *c1, @@ -315,16 +313,14 @@ { } +#ifndef NEW_GC static void tty_finalize_font_instance (Lisp_Font_Instance *f) { if (f->data) -#ifdef NEW_GC - mc_free (f->data); -#else /* not NEW_GC */ xfree (f->data, void *); +} #endif /* not NEW_GC */ -} static Lisp_Object tty_font_list (Lisp_Object UNUSED (pattern), Lisp_Object UNUSED (device), @@ -421,7 +417,9 @@ CONSOLE_HAS_METHOD (tty, initialize_color_instance); CONSOLE_HAS_METHOD (tty, mark_color_instance); CONSOLE_HAS_METHOD (tty, print_color_instance); +#ifndef NEW_GC CONSOLE_HAS_METHOD (tty, finalize_color_instance); +#endif /* not NEW_GC */ CONSOLE_HAS_METHOD (tty, color_instance_equal); CONSOLE_HAS_METHOD (tty, color_instance_hash); CONSOLE_HAS_METHOD (tty, valid_color_name_p); @@ -430,7 +428,9 @@ CONSOLE_HAS_METHOD (tty, initialize_font_instance); CONSOLE_HAS_METHOD (tty, mark_font_instance); CONSOLE_HAS_METHOD (tty, print_font_instance); +#ifndef NEW_GC CONSOLE_HAS_METHOD (tty, finalize_font_instance); +#endif /* not NEW_GC */ CONSOLE_HAS_METHOD (tty, font_list); #ifdef MULE CONSOLE_HAS_METHOD (tty, font_spec_matches_charset); diff -r 9a42c5e5eb4e -r 229bd619740a src/syntax.c --- a/src/syntax.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/syntax.c Wed Aug 15 11:06:10 2007 +0000 @@ -537,18 +537,16 @@ reset_buffer_syntax_cache_range (cache, cache->object, 0); } +#ifndef NEW_GC /* finalize the syntax cache for BUF */ void uninit_buffer_syntax_cache (struct buffer *buf) { -#ifdef NEW_GC - mc_free (buf->syntax_cache); -#else /* not NEW_GC */ xfree (buf->syntax_cache, struct syntax_cache *); -#endif /* not NEW_GC */ buf->syntax_cache = 0; } +#endif /* not NEW_GC */ /* extent-specific APIs used in extents.c and insdel.c */ diff -r 9a42c5e5eb4e -r 229bd619740a src/vdb.c --- a/src/vdb.c Tue Aug 14 21:51:16 2007 +0000 +++ b/src/vdb.c Wed Aug 15 11:06:10 2007 +0000 @@ -132,7 +132,6 @@ fprintf (stderr, "WRONG page fault at %x\n", (int) Dynarr_at (page_fault_table, count - 1)); Dynarr_free (page_fault_table); - mc_free (p); return Qnil; }