summaryrefslogtreecommitdiffstats
path: root/lib/memory.c
diff options
context:
space:
mode:
authorChris Hall <chris.hall@highwayman.com>2011-02-13 23:11:45 +0000
committerChris Hall <chris.hall@highwayman.com>2011-02-13 23:11:45 +0000
commit5cae7eea451f2b7d65b5892e2c1dafc70f8b836e (patch)
tree0fbd9679e9ae28e7d061b5bdda08756077415ecb /lib/memory.c
parent64be6d766a65dc0749d17f5023d714678e9c96a6 (diff)
downloadquagga-5cae7eea451f2b7d65b5892e2c1dafc70f8b836e.tar.bz2
quagga-5cae7eea451f2b7d65b5892e2c1dafc70f8b836e.tar.xz
Second tranche of updates for pipework branch.
modified: bgpd/bgp_connection.c modified: bgpd/bgp_debug.c modified: bgpd/bgp_engine.h modified: bgpd/bgp_main.c modified: bgpd/bgp_packet.c modified: bgpd/bgp_peer.c modified: bgpd/bgp_route.c modified: bgpd/bgp_routemap.c modified: bgpd/bgp_session.c modified: bgpd/bgp_vty.c modified: bgpd/bgpd.c modified: bgpd/bgpd.h modified: configure.ac modified: isisd/dict.h modified: isisd/isis_misc.c modified: isisd/isis_routemap.c modified: isisd/isis_spf.c modified: lib/Makefile.am modified: lib/command.c modified: lib/command.h modified: lib/command_execute.h modified: lib/command_parse.c modified: lib/command_parse.h modified: lib/command_queue.c modified: lib/command_queue.h modified: lib/elstring.h modified: lib/heap.c modified: lib/if.c modified: lib/if.h modified: lib/keychain.c modified: lib/keystroke.c modified: lib/keystroke.h modified: lib/list_util.c modified: lib/list_util.h modified: lib/log.c modified: lib/log.h modified: lib/memory.c modified: lib/memory.h modified: lib/memtypes.c modified: lib/misc.h modified: lib/mqueue.c modified: lib/mqueue.h deleted: lib/node_type.h modified: lib/pthread_safe.c modified: lib/qfstring.c modified: lib/qiovec.c modified: lib/qiovec.h modified: lib/qpath.c modified: lib/qpnexus.c modified: lib/qpnexus.h modified: lib/qpselect.c modified: lib/qpthreads.h modified: lib/qstring.c modified: lib/qstring.h modified: lib/qtime.c modified: lib/qtime.h modified: lib/qtimers.c modified: lib/qtimers.h modified: lib/routemap.c modified: lib/symtab.h modified: lib/thread.h deleted: lib/uty.h modified: lib/vector.c modified: lib/vector.h modified: lib/version.h.in modified: lib/vio_fifo.c modified: lib/vio_fifo.h modified: lib/vio_lines.c modified: lib/vio_lines.h modified: lib/vty.c modified: lib/vty.h modified: lib/vty_cli.c modified: lib/vty_cli.h modified: lib/vty_io.c modified: lib/vty_io.h modified: lib/vty_io_basic.c modified: lib/vty_io_basic.h modified: lib/vty_io_file.c modified: lib/vty_io_file.h modified: lib/vty_io_shell.c modified: lib/vty_io_term.c modified: lib/vty_io_term.h modified: lib/vty_local.h modified: lib/vty_pipe.c modified: lib/workqueue.h modified: lib/zebra.h modified: ospf6d/ospf6_lsa.c modified: ripngd/ripngd.c modified: tests/test-list_util.c modified: tests/test-vector.c modified: vtysh/vtysh.c modified: vtysh/vtysh_config.c
Diffstat (limited to 'lib/memory.c')
-rw-r--r--lib/memory.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/memory.c b/lib/memory.c
index c13404d2..e15492c9 100644
--- a/lib/memory.c
+++ b/lib/memory.c
@@ -72,7 +72,7 @@ mem_tracker_zeroise(struct mem_tracker* mem)
memset(mem, 0, sizeof(struct mem_tracker)) ;
} ;
-#ifdef MEMORY_TRACKER
+#if MEMORY_TRACKER
#include "mem_tracker.c"
#endif
@@ -130,7 +130,7 @@ zmalloc (enum MTYPE mtype, size_t size MEMORY_TRACKER_NAME)
else
{
mstat.mt[mtype].alloc++;
-#ifdef MEMORY_TRACKER
+#if MEMORY_TRACKER
mem_md_malloc(mtype, memory, size, name) ;
#endif
UNLOCK ;
@@ -159,7 +159,7 @@ zcalloc (enum MTYPE mtype, size_t size MEMORY_TRACKER_NAME)
else
{
mstat.mt[mtype].alloc++;
-#ifdef MEMORY_TRACKER
+#if MEMORY_TRACKER
mem_md_malloc(mtype, memory, size, name) ;
#endif
UNLOCK ;
@@ -188,7 +188,7 @@ zrealloc (enum MTYPE mtype, void *ptr, size_t size MEMORY_TRACKER_NAME)
{
if (ptr == NULL)
mstat.mt[mtype].alloc++;
-#ifdef MEMORY_TRACKER
+#if MEMORY_TRACKER
mem_md_realloc(mtype, ptr, memory, size, name) ;
#endif
UNLOCK ;
@@ -210,7 +210,7 @@ zfree (enum MTYPE mtype, void *ptr)
assert(mstat.mt[mtype].alloc > 0) ;
mstat.mt[mtype].alloc--;
-#ifdef MEMORY_TRACKER
+#if MEMORY_TRACKER
mem_md_free(mtype, ptr) ;
#endif
@@ -230,7 +230,7 @@ zstrdup (enum MTYPE mtype, const char *str MEMORY_TRACKER_NAME)
LOCK ;
- dup = strdup (str);
+ dup = strdup (str ? str : "");
if (dup == NULL)
{
UNLOCK ;
@@ -239,7 +239,7 @@ zstrdup (enum MTYPE mtype, const char *str MEMORY_TRACKER_NAME)
else
{
mstat.mt[mtype].alloc++;
-#ifdef MEMORY_TRACKER
+#if MEMORY_TRACKER
mem_md_malloc(mtype, dup, strlen(str)+1, name) ;
#endif
UNLOCK ;
@@ -443,7 +443,7 @@ show_memory_type_vty (struct vty *vty, const char* name,
vty_out (vty, "-----------------------------%s", VTY_NEWLINE) ;
vty_out (vty, "%-30s:", name) ;
-#ifdef MEMORY_TRACKER
+#if MEMORY_TRACKER
show_memory_tracker_detail(vty, mt, alloc) ;
#else
vty_out (vty, " %10ld", alloc) ;
@@ -464,13 +464,13 @@ show_memory_vty (struct vty *vty, struct memory_list *m, struct mlist* ml,
struct mem_tracker mem_one ;
struct mem_tracker* mt ;
-#ifdef MEMORY_TRACKER
+#if MEMORY_TRACKER
struct mem_type_tracker mem_tt ;
#endif
LOCK ;
mst = mstat ;
-#ifdef MEMORY_TRACKER
+#if MEMORY_TRACKER
mem_tt = mem_type_tracker ;
#endif
UNLOCK ;
@@ -499,7 +499,7 @@ show_memory_vty (struct vty *vty, struct memory_list *m, struct mlist* ml,
else
{
alloc = mst.mt[m->index].alloc ;
-#ifdef MEMORY_TRACKER
+#if MEMORY_TRACKER
mt = &(mem_tt.mt[m->index]) ;
#else
mt = &mem_one ;
@@ -580,7 +580,7 @@ DEFUN_CALL (show_memory_summary,
"Memory statistics\n"
"Summary memory statistics\n")
{
-#ifdef MEMORY_TRACKER
+#if MEMORY_TRACKER
show_memory_tracker_summary(vty) ;
#else
long alloc = 0 ;
@@ -613,7 +613,7 @@ DEFUN_CALL (show_memory_all,
#ifdef HAVE_MALLINFO
needsep |= show_memory_mallinfo (vty);
#endif /* HAVE_MALLINFO */
-#ifdef MEMORY_TRACKER
+#if MEMORY_TRACKER
needsep |= show_memory_tracker_summary(vty) ;
#endif