]> granicus.if.org Git - gc/commitdiff
Replace GC_DBG_RA with GC_DBG_EXTRAS macro
authorIvan Maidanski <ivmai@mail.ru>
Fri, 23 Aug 2013 19:42:26 +0000 (23:42 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 25 Aug 2013 18:41:57 +0000 (22:41 +0400)
* dbg_mlc.c (GC_debug_malloc_replacement,
GC_debug_realloc_replacement): Use GC_DBG_EXTRAS (instead of
"GC_DBG_RA NULL, 0").
* malloc.c (GC_debug_malloc_replacement): Likewise.
* mallocx.c (GC_debug_realloc_replacement): Likewise.
* include/private/gc_priv.h (GC_DBG_EXTRAS): New macro (similar to
GC_EXTRAS but pass NULL/0 instead of __FILE__and __LINE__);
pass "unknown" instead of NULL unless GC_ADD_CALLER.
* include/private/gc_priv.h (GC_DBG_RA): Remove.

dbg_mlc.c
include/private/gc_priv.h
malloc.c
mallocx.c

index d7962642a8f3a772e7fea6d44e04870775e23e2b..d8f44da4a49858c7c9012ab434d1e2d121d1a726 100644 (file)
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -1209,10 +1209,10 @@ GC_API void GC_CALL GC_debug_register_finalizer_ignore_self
 
 GC_API void * GC_CALL GC_debug_malloc_replacement(size_t lb)
 {
-    return GC_debug_malloc(lb, GC_DBG_RA NULL, 0);
+    return GC_debug_malloc(lb, GC_DBG_EXTRAS);
 }
 
 GC_API void * GC_CALL GC_debug_realloc_replacement(void *p, size_t lb)
 {
-    return GC_debug_realloc(p, lb, GC_DBG_RA NULL, 0);
+    return GC_debug_realloc(p, lb, GC_DBG_EXTRAS);
 }
index fd80e71e22fccedf5b449e1bbb748669d37fd30c..4cbb54d342b13fb85d27cff3c19090c61f4a0dc0 100644 (file)
@@ -1807,13 +1807,16 @@ GC_INNER ptr_t GC_allocobj(size_t sz, int kind);
                                 /* head.  Sz is in granules.            */
 
 #ifdef GC_ADD_CALLER
+  /* GC_DBG_EXTRAS is used by GC debug API functions (unlike GC_EXTRAS  */
+  /* used by GC debug API macros) thus GC_RETURN_ADDR_PARENT (pointing  */
+  /* to client caller) should be used if possible.                      */
 # ifdef GC_RETURN_ADDR_PARENT
-#  define GC_DBG_RA GC_RETURN_ADDR_PARENT,
+#  define GC_DBG_EXTRAS GC_RETURN_ADDR_PARENT, NULL, 0
 # else
-#  define GC_DBG_RA GC_RETURN_ADDR,
+#  define GC_DBG_EXTRAS GC_RETURN_ADDR, NULL, 0
 # endif
 #else
-# define GC_DBG_RA /* empty */
+# define GC_DBG_EXTRAS "unknown", 0
 #endif
 
 /* We make the GC_clear_stack() call a tail one, hoping to get more of  */
index ef2690955b199084fb662e88e75189e3083135fe..4983cdfe11531eba25e639980b534a99b181492f 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -355,8 +355,7 @@ GC_API void * GC_CALL GC_malloc_uncollectable(size_t lb)
 /* malloc replacements.  Otherwise we end up saving a                   */
 /* meaningless return address in the object.  It also speeds things up, */
 /* but it is admittedly quite ugly.                                     */
-# define GC_debug_malloc_replacement(lb) \
-                        GC_debug_malloc(lb, GC_DBG_RA NULL, 0)
+# define GC_debug_malloc_replacement(lb) GC_debug_malloc(lb, GC_DBG_EXTRAS)
 
 void * malloc(size_t lb)
 {
index 1b4e09b8a6bc33e9049667a3fa2b51d115bd108c..7fcaa5c26f42d7658c9b57dda085528bee904002 100644 (file)
--- a/mallocx.c
+++ b/mallocx.c
@@ -154,7 +154,7 @@ GC_API void * GC_CALL GC_realloc(void * p, size_t lb)
 
 /* As with malloc, avoid two levels of extra calls here.        */
 # define GC_debug_realloc_replacement(p, lb) \
-        GC_debug_realloc(p, lb, GC_DBG_RA NULL, 0)
+        GC_debug_realloc(p, lb, GC_DBG_EXTRAS)
 
 void * realloc(void * p, size_t lb)
   {