summaryrefslogtreecommitdiff
path: root/lib/memory.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-09-21 22:11:53 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-09-21 22:11:53 +0000
commit844ec28cee41395cdd1cc0cdf8cf0168f9dc1adf (patch)
treef2fe0a9a71bb075a5f6f43cd992b89f46b95574f /lib/memory.c
parentd0bfb22c223d645e554290ca82581eb06f94ac3b (diff)
parent039dc61292de5f3ed5f46316b1940ab6bb184c3f (diff)
Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: lib/.gitignore lib/command.c lib/command.h
Diffstat (limited to 'lib/memory.c')
-rw-r--r--lib/memory.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/memory.c b/lib/memory.c
index 290b999bb8..8d1a03743e 100644
--- a/lib/memory.c
+++ b/lib/memory.c
@@ -80,9 +80,11 @@ zmalloc (int type, size_t size)
/*
* Allocate memory as in zmalloc, and also clear the memory.
+ * Add an extra 'z' prefix to function name to avoid collision when linking
+ * statically with zlib that exports the 'zcalloc' symbol.
*/
void *
-zcalloc (int type, size_t size)
+zzcalloc (int type, size_t size)
{
void *memory;
@@ -97,9 +99,9 @@ zcalloc (int type, size_t size)
}
/*
- * Given a pointer returned by zmalloc or zcalloc, free it and
+ * Given a pointer returned by zmalloc or zzcalloc, free it and
* return a pointer to a new size, basically acting like realloc().
- * Requires: ptr was returned by zmalloc, zcalloc, or zrealloc with the
+ * Requires: ptr was returned by zmalloc, zzcalloc, or zrealloc with the
* same type.
* Effects: Returns a pointer to the new memory, or aborts.
*/
@@ -109,7 +111,7 @@ zrealloc (int type, void *ptr, size_t size)
void *memory;
if (ptr == NULL) /* is really alloc */
- return zcalloc(type, size);
+ return zzcalloc(type, size);
memory = realloc (ptr, size);
if (memory == NULL)
@@ -122,7 +124,7 @@ zrealloc (int type, void *ptr, size_t size)
/*
* Free memory allocated by z*alloc or zstrdup.
- * Requires: ptr was returned by zmalloc, zcalloc, or zrealloc with the
+ * Requires: ptr was returned by zmalloc, zzcalloc, or zrealloc with the
* same type.
* Effects: The memory is freed and may no longer be referenced.
*/
@@ -196,7 +198,7 @@ mtype_zcalloc (const char *file, int line, int type, size_t size)
mstat[type].c_calloc++;
mstat[type].t_calloc++;
- memory = zcalloc (type, size);
+ memory = zzcalloc (type, size);
mtype_log ("xcalloc", memory, file, line, type);
return memory;