mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-30 21:04:13 +02:00
fixed SIZEOF_LONG==4 assumption with ENABLE_MEM_CHECK, from Art Haas
Fri May 19 09:00:44 2000 Tim Janik <timj@gtk.org> * gmem.c (g_free): fixed SIZEOF_LONG==4 assumption with ENABLE_MEM_CHECK, from Art Haas <ahaas@neosoft.com>. * gslist.c (g_slist_reverse): shut up compiler. * gscanner.c (g_scanner_get_token_ll): removed inline assignment. * garray.c: remove index>=0 checks for unsigned indices. * gmain.c (g_idle_prepare): timeout assignment fix. * gtree.c (g_tree_node_rotate_right): shut up compiler.
This commit is contained in:
6
gmem.c
6
gmem.c
@@ -402,11 +402,11 @@ g_free (gpointer mem)
|
||||
#ifdef ENABLE_MEM_CHECK
|
||||
t = (gulong*) ((guchar*) mem - SIZEOF_LONG);
|
||||
if (*t >= 1)
|
||||
g_warning ("freeing previously freed memory\n");
|
||||
g_warning ("freeing previously freed (%lu times) memory\n", *t);
|
||||
*t += 1;
|
||||
mem = t;
|
||||
|
||||
memset ((guchar*) mem + 8, 0, size);
|
||||
memset ((guchar*) mem + 2 * SIZEOF_LONG, 0, size);
|
||||
#else /* ENABLE_MEM_CHECK */
|
||||
free (mem);
|
||||
#endif /* ENABLE_MEM_CHECK */
|
||||
@@ -456,7 +456,7 @@ g_mem_check (gpointer mem)
|
||||
t = (gulong*) ((guchar*) mem - SIZEOF_LONG - SIZEOF_LONG);
|
||||
|
||||
if (*t >= 1)
|
||||
g_warning ("mem: 0x%08x has been freed %lu times\n", (gulong) mem, *t);
|
||||
g_warning ("mem: 0x%08lx has been freed %lu times\n", (gulong) mem, *t);
|
||||
#endif /* ENABLE_MEM_CHECK */
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user