APPROVE COMMIT 21.5
With the new garabge collector, objects cannot be freed explicitly
anymore (the garbage collector does all this work anyway). This patch
removes all calls to mc_free.
src/ChangeLog addition:
2007-08-15 Marcus Crestani <crestani(a)xemacs.org>
* 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.
mcfree-xemacs-21.5 source patch:
Diff command: cvs -q diff -u
Files affected: src/vdb.c
===================================================================
RCS src/syntax.c
===================================================================
RCS src/objects-tty.c
===================================================================
RCS src/mc-alloc.h
===================================================================
RCS src/mc-alloc.c
===================================================================
RCS src/glyphs.c
===================================================================
RCS src/frame-x.c
===================================================================
RCS src/frame-msw.c
===================================================================
RCS src/frame-gtk.c
===================================================================
RCS src/extents.c
===================================================================
RCS src/elhash.c
===================================================================
RCS src/dynarr.c
===================================================================
RCS src/device-x.c
===================================================================
RCS src/device-msw.c
===================================================================
RCS src/device-gtk.c
===================================================================
RCS src/console-tty.c
===================================================================
RCS src/buffer.c
===================================================================
RCS
Index: src/buffer.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/buffer.c,v
retrieving revision 1.77
diff -u -r1.77 buffer.c
--- src/buffer.c 22 Nov 2006 02:20:34 -0000 1.77
+++ src/buffer.c 15 Aug 2007 10:54:35 -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);
Index: src/console-tty.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/console-tty.c,v
retrieving revision 1.35
diff -u -r1.35 console-tty.c
--- src/console-tty.c 24 Aug 2006 21:21:36 -0000 1.35
+++ src/console-tty.c 15 Aug 2007 10:54:35 -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;
Index: src/device-gtk.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/device-gtk.c,v
retrieving revision 1.16
diff -u -r1.16 device-gtk.c
--- src/device-gtk.c 25 Nov 2005 01:41:58 -0000 1.16
+++ src/device-gtk.c 15 Aug 2007 10:54:35 -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 */
}
+#endif /* not NEW_GC */
static void
gtk_delete_device (struct device *d)
Index: src/device-msw.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/device-msw.c,v
retrieving revision 1.60
diff -u -r1.60 device-msw.c
--- src/device-msw.c 25 Nov 2005 01:41:58 -0000 1.60
+++ src/device-msw.c 15 Aug 2007 10:54:35 -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 */
}
Index: src/device-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/device-x.c,v
retrieving revision 1.69
diff -u -r1.69 device-x.c
--- src/device-x.c 28 Nov 2006 21:20:37 -0000 1.69
+++ src/device-x.c 15 Aug 2007 10:54:35 -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 */
}
+#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 */
}
Index: src/dynarr.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/dynarr.c,v
retrieving revision 1.15
diff -u -r1.15 dynarr.c
--- src/dynarr.c 20 Mar 2006 21:20:28 -0000 1.15
+++ src/dynarr.c 15 Aug 2007 10:54:35 -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 */
Index: src/elhash.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/elhash.c,v
retrieving revision 1.46
diff -u -r1.46 elhash.c
--- src/elhash.c 22 Jul 2007 22:04:12 -0000 1.46
+++ src/elhash.c 15 Aug 2007 10:54:35 -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 */
}
Index: src/extents.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/extents.c,v
retrieving revision 1.66
diff -u -r1.66 extents.c
--- src/extents.c 21 Jun 2006 17:30:36 -0000 1.66
+++ src/extents.c 15 Aug 2007 10:54:37 -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;
Index: src/frame-gtk.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/frame-gtk.c,v
retrieving revision 1.23
diff -u -r1.23 frame-gtk.c
--- src/frame-gtk.c 12 Nov 2006 13:40:08 -0000 1.23
+++ src/frame-gtk.c 15 Aug 2007 10:54:37 -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;
Index: src/frame-msw.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/frame-msw.c,v
retrieving revision 1.59
diff -u -r1.59 frame-msw.c
--- src/frame-msw.c 25 Nov 2005 01:42:02 -0000 1.59
+++ src/frame-msw.c 15 Aug 2007 10:54:37 -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 */
}
Index: src/frame-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/frame-x.c,v
retrieving revision 1.76
diff -u -r1.76 frame-x.c
--- src/frame-x.c 12 Nov 2006 13:40:08 -0000 1.76
+++ src/frame-x.c 15 Aug 2007 10:54:37 -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;
Index: src/glyphs.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/glyphs.c,v
retrieving revision 1.55
diff -u -r1.55 glyphs.c
--- src/glyphs.c 25 Nov 2005 01:42:04 -0000 1.55
+++ src/glyphs.c 15 Aug 2007 10:54:38 -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;
Index: src/mc-alloc.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/mc-alloc.c,v
retrieving revision 1.10
diff -u -r1.10 mc-alloc.c
--- src/mc-alloc.c 26 Mar 2006 15:24:26 -0000 1.10
+++ src/mc-alloc.c 15 Aug 2007 10:54:38 -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;
}
}
Index: src/mc-alloc.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/mc-alloc.h,v
retrieving revision 1.6
diff -u -r1.6 mc-alloc.h
--- src/mc-alloc.h 26 Mar 2006 15:24:27 -0000 1.6
+++ src/mc-alloc.h 15 Aug 2007 10:54:38 -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
Index: src/objects-tty.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/objects-tty.c,v
retrieving revision 1.19
diff -u -r1.19 objects-tty.c
--- src/objects-tty.c 22 Feb 2007 16:19:44 -0000 1.19
+++ src/objects-tty.c 15 Aug 2007 10:54:38 -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 */
}
+#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 */
}
+#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);
Index: src/syntax.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/syntax.c,v
retrieving revision 1.31
diff -u -r1.31 syntax.c
--- src/syntax.c 23 Aug 2006 19:57:50 -0000 1.31
+++ src/syntax.c 15 Aug 2007 10:54:38 -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 */
Index: src/vdb.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/vdb.c,v
retrieving revision 1.2
diff -u -r1.2 vdb.c
--- src/vdb.c 26 Mar 2006 14:05:30 -0000 1.2
+++ src/vdb.c 15 Aug 2007 10:54:38 -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;
}
--
Marcus
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches