From 19389f2b82ec54fd4c847a18f16482e7be4c9887 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Wed, 16 Jan 2008 14:31:44 +0200 Subject: [PATCH] Added ARRAY_SIZE(array) macro. --- src/common/sysdefs.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/sysdefs.h b/src/common/sysdefs.h index 7b69504c..8ebe476f 100644 --- a/src/common/sysdefs.h +++ b/src/common/sysdefs.h @@ -154,4 +154,8 @@ typedef unsigned char _Bool; # define MAX(x, y) ((x) > (y) ? (x) : (y)) #endif +#ifndef ARRAY_SIZE +# define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) +#endif + #endif