]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Only display memory items that have allocations
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 30 Sep 2016 01:47:07 +0000 (21:47 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 30 Sep 2016 01:47:07 +0000 (21:47 -0400)
When displaying memory via a 'show run' only display
items that have actual memory allocated.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/memory_vty.c

index e4cb295cf0df62397ddac564cedb21866fa3cf16..73acafe23bfea4db685d0422714000a7de3c333a 100644 (file)
@@ -82,13 +82,15 @@ static int qmem_walker(void *arg, struct memgroup *mg, struct memtype *mt)
        if (!mt)
                vty_out (vty, "--- qmem %s ---%s", mg->name, VTY_NEWLINE);
        else {
-               char size[32];
-               snprintf(size, sizeof(size), "%6zu", mt->size);
-               vty_out (vty, "%-30s: %10zu  %s%s",
-                       mt->name, mt->n_alloc,
-                       mt->size == 0 ? "" :
-                       mt->size == SIZE_VAR ? "(variably sized)" :
-                       size, VTY_NEWLINE);
+               if (mt->n_alloc != 0) {
+                       char size[32];
+                       snprintf(size, sizeof(size), "%6zu", mt->size);
+                       vty_out (vty, "%-30s: %10zu  %s%s",
+                                mt->name, mt->n_alloc,
+                                mt->size == 0 ? "" :
+                                mt->size == SIZE_VAR ? "(variably sized)" :
+                                size, VTY_NEWLINE);
+               }
        }
        return 0;
 }