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 <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer
2013-05-04 17:11:33 +02:00
parent 370c4031be
commit ce93fa8adb
5 changed files with 14 additions and 15 deletions

View File

@@ -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))