diff options
author | bjasspa <bjasspa@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2012-07-01 13:19:23 +0000 |
---|---|---|
committer | bjasspa <bjasspa@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2012-07-01 13:19:23 +0000 |
commit | 9af330d4d6dbc1670c5cf96a30ebb3ed429c5335 (patch) | |
tree | aba3a8062ba98e472a574690c9edc811e490b1fb /navit | |
parent | 1c3cc1917229aa506ee11176ae8bbddfd87c1c27 (diff) | |
download | navit-9af330d4d6dbc1670c5cf96a30ebb3ed429c5335.tar.gz |
Changed the name of vtable alloc, new & free struct members to v* to allow debug malloc libraries to redefine standard functions to macros
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5171 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r-- | navit/support/glib/gmem.c | 32 | ||||
-rw-r--r-- | navit/support/glib/gmem.h | 18 |
2 files changed, 25 insertions, 25 deletions
diff --git a/navit/support/glib/gmem.c b/navit/support/glib/gmem.c index 9cc091fd1..2c6a00998 100644 --- a/navit/support/glib/gmem.c +++ b/navit/support/glib/gmem.c @@ -128,7 +128,7 @@ g_malloc (gsize n_bytes) { gpointer mem; - mem = glib_mem_vtable.malloc (n_bytes); + mem = glib_mem_vtable.vmalloc (n_bytes); if (mem) return mem; @@ -150,7 +150,7 @@ g_malloc0 (gsize n_bytes) { gpointer mem; - mem = glib_mem_vtable.calloc (1, n_bytes); + mem = glib_mem_vtable.vcalloc (1, n_bytes); if (mem) return mem; @@ -171,7 +171,7 @@ g_realloc (gpointer mem, g_mem_init_nomessage(); if (G_LIKELY (n_bytes)) { - mem = glib_mem_vtable.realloc (mem, n_bytes); + mem = glib_mem_vtable.vrealloc (mem, n_bytes); if (mem) return mem; @@ -182,7 +182,7 @@ g_realloc (gpointer mem, } if (mem) - glib_mem_vtable.free (mem); + glib_mem_vtable.vfree (mem); return NULL; } @@ -193,7 +193,7 @@ g_free (gpointer mem) if (G_UNLIKELY (!g_mem_initialized)) g_mem_init_nomessage(); if (G_LIKELY (mem)) - glib_mem_vtable.free (mem); + glib_mem_vtable.vfree (mem); } gpointer @@ -202,7 +202,7 @@ g_try_malloc (gsize n_bytes) if (G_UNLIKELY (!g_mem_initialized)) g_mem_init_nomessage(); if (G_LIKELY (n_bytes)) - return glib_mem_vtable.try_malloc (n_bytes); + return glib_mem_vtable.vtry_malloc (n_bytes); else return NULL; } @@ -227,10 +227,10 @@ g_try_realloc (gpointer mem, if (G_UNLIKELY (!g_mem_initialized)) g_mem_init_nomessage(); if (G_LIKELY (n_bytes)) - return glib_mem_vtable.try_realloc (mem, n_bytes); + return glib_mem_vtable.vtry_realloc (mem, n_bytes); if (mem) - glib_mem_vtable.free (mem); + glib_mem_vtable.vfree (mem); return NULL; } @@ -240,7 +240,7 @@ fallback_calloc (gsize n_blocks, gsize n_block_bytes) { gsize l = n_blocks * n_block_bytes; - gpointer mem = glib_mem_vtable.malloc (l); + gpointer mem = glib_mem_vtable.vmalloc (l); if (mem) memset (mem, 0, l); @@ -274,14 +274,14 @@ g_mem_set_vtable (GMemVTable *vtable) { if (!vtable_set) { - if (vtable->malloc && vtable->realloc && vtable->free) + if (vtable->vmalloc && vtable->vrealloc && vtable->vfree) { - glib_mem_vtable.malloc = vtable->malloc; - glib_mem_vtable.realloc = vtable->realloc; - glib_mem_vtable.free = vtable->free; - glib_mem_vtable.calloc = vtable->calloc ? vtable->calloc : fallback_calloc; - glib_mem_vtable.try_malloc = vtable->try_malloc ? vtable->try_malloc : glib_mem_vtable.malloc; - glib_mem_vtable.try_realloc = vtable->try_realloc ? vtable->try_realloc : glib_mem_vtable.realloc; + glib_mem_vtable.vmalloc = vtable->vmalloc; + glib_mem_vtable.vrealloc = vtable->vrealloc; + glib_mem_vtable.vfree = vtable->vfree; + glib_mem_vtable.vcalloc = vtable->vcalloc ? vtable->vcalloc : fallback_calloc; + glib_mem_vtable.vtry_malloc = vtable->vtry_malloc ? vtable->vtry_malloc : glib_mem_vtable.vmalloc; + glib_mem_vtable.vtry_realloc = vtable->vtry_realloc ? vtable->vtry_realloc : glib_mem_vtable.vrealloc; vtable_set = TRUE; } #if NOT_NEEDED_FOR_NAVIT diff --git a/navit/support/glib/gmem.h b/navit/support/glib/gmem.h index 8cb050ee3..d5779e3b2 100644 --- a/navit/support/glib/gmem.h +++ b/navit/support/glib/gmem.h @@ -82,16 +82,16 @@ gpointer g_try_realloc (gpointer mem, */ struct _GMemVTable { - gpointer (*malloc) (gsize n_bytes); - gpointer (*realloc) (gpointer mem, - gsize n_bytes); - void (*free) (gpointer mem); + gpointer (*vmalloc) (gsize n_bytes); + gpointer (*vrealloc) (gpointer mem, + gsize n_bytes); + void (*vfree) (gpointer mem); /* optional; set to NULL if not used ! */ - gpointer (*calloc) (gsize n_blocks, - gsize n_block_bytes); - gpointer (*try_malloc) (gsize n_bytes); - gpointer (*try_realloc) (gpointer mem, - gsize n_bytes); + gpointer (*vcalloc) (gsize n_blocks, + gsize n_block_bytes); + gpointer (*vtry_malloc) (gsize n_bytes); + gpointer (*vtry_realloc) (gpointer mem, + gsize n_bytes); }; void g_mem_set_vtable (GMemVTable *vtable); gboolean g_mem_is_system_malloc (void); |