]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: add array_size() helper
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 8 May 2012 11:32:12 +0000 (13:32 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Thu, 25 Oct 2012 17:15:59 +0000 (10:15 -0700)
implement array_size as sizeof(array) / sizeof(array element)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/memory.h

index a7eddce4e13e493c04a5d7b73b822721a0fd2707..23962235dbfe26b57cc7cd4de9d784099d1dd2bc 100644 (file)
@@ -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
 {