From ce93fa8adbeb31d160cba198e50e3f828e8def50 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sat, 4 May 2013 17:11:33 +0200 Subject: Use a macro to determine the size of arrays Use following macro instead of "sizeof(x) / sizeof(x[0])" everywhere: #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) Signed-off-by: Lukas Fleischer --- src/calcurse.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/calcurse.h') diff --git a/src/calcurse.h b/src/calcurse.h index 1dfd648..da1f447 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -230,6 +230,8 @@ #define UTF8_ISCONT(ch) ((unsigned char)ch >= 0x80 && \ (unsigned char)ch <= 0xBF) +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + #define MAX(x,y) ((x)>(y)?(x):(y)) #define MIN(x,y) ((x)<(y)?(x):(y)) -- cgit v1.2.3-54-g00ecf