summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2012-05-08 13:32:12 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2012-10-25 10:15:59 -0700
commit80a21dc60fa007bb00437fdc047c3e059232639f (patch)
tree884fad4cd756c73e36232b6182e46d85ba64e229 /lib
parentf02a09925db53d3e1d29b1917ebbcaa8edf72c12 (diff)
lib: add array_size() helper
implement array_size as sizeof(array) / sizeof(array element) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/memory.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/memory.h b/lib/memory.h
index a7eddce4..23962235 100644
--- a/lib/memory.h
+++ b/lib/memory.h
@@ -21,6 +21,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifndef _ZEBRA_MEMORY_H
#define _ZEBRA_MEMORY_H
+#define array_size(ar) (sizeof(ar) / sizeof(ar[0]))
+
/* For pretty printing of memory allocate information. */
struct memory_list
{