[PATCH 1/2] Define macros for renaming xmalloc and xcalloc

Masatake YAMATO yamato at redhat.com
Mon Dec 18 04:24:54 UTC 2017


I'm planning to link strace with libiberty for mangling C++
symbol appearted in stack trace enabled with -k option.

Both the names, xmalloc and xcalloc, are already used in the
library. They are conflicts the functions having the same
names in strace. Newly introduced macors(strace_calloc and
strace_malloc) rename the names defined in strace side for
avoiding the confliction.

* xmalloc.h (strace_calloc, strace_malloc): New macros.

Signed-off-by: Masatake YAMATO <yamato at redhat.com>
---
 xmalloc.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xmalloc.h b/xmalloc.h
index d1feeb91..89234e20 100644
--- a/xmalloc.h
+++ b/xmalloc.h
@@ -36,6 +36,8 @@
 #include <stddef.h>
 #include "gcc_compat.h"
 
+#define xcalloc strace_calloc
+#define xmalloc strace_malloc
 void *xcalloc(size_t nmemb, size_t size)
 	ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1, 2));
 void *xmalloc(size_t size) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1));
-- 
2.14.3





More information about the Strace-devel mailing list