diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2013-05-04 17:11:33 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2013-05-04 20:32:26 +0200 |
commit | ce93fa8adbeb31d160cba198e50e3f828e8def50 (patch) | |
tree | 8380e143ab3fec663f284a9e6d958996c2561b75 /src/calcurse.h | |
parent | 370c4031be9c921ae54ccb7cafff71d0a2c9b790 (diff) | |
download | calcurse-ce93fa8adbeb31d160cba198e50e3f828e8def50.zip |
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>
Diffstat (limited to 'src/calcurse.h')
-rw-r--r-- | src/calcurse.h | 2 |
1 files changed, 2 insertions, 0 deletions
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)) |