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/custom.c | |
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/custom.c')
-rw-r--r-- | src/custom.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/custom.c b/src/custom.c index 6ae8abc..da632bf 100644 --- a/src/custom.c +++ b/src/custom.c @@ -135,7 +135,7 @@ static void layout_selection_bar(void) struct binding *bindings[] = { &quit, &select, &up, &down, &left, &right, &help }; - int bindings_size = sizeof(bindings) / sizeof(bindings[0]); + int bindings_size = ARRAY_SIZE(bindings); keys_display_bindings_bar(win[STA].p, bindings, bindings_size, 0, bindings_size, NULL); @@ -307,7 +307,7 @@ void custom_sidebar_config(void) "can't be smaller than %d characters wide.\n\n"); int ch, bindings_size; - bindings_size = sizeof(bindings) / sizeof(bindings[0]); + bindings_size = ARRAY_SIZE(bindings); keys_display_bindings_bar(win[STA].p, bindings, bindings_size, 0, bindings_size, NULL); @@ -401,7 +401,7 @@ static void color_selection_bar(void) struct binding *bindings[] = { &quit, &nocolor, &up, &down, &left, &right, &select }; - int bindings_size = sizeof(bindings) / sizeof(bindings[0]); + int bindings_size = ARRAY_SIZE(bindings); keys_display_bindings_bar(win[STA].p, bindings, bindings_size, 0, bindings_size, NULL); @@ -926,7 +926,7 @@ static void custom_keys_config_bar(void) struct binding *bindings[] = { &quit, &info, &add, &del, &up, &down, &left, &right }; - int bindings_size = sizeof(bindings) / sizeof(bindings[0]); + int bindings_size = ARRAY_SIZE(bindings); keys_display_bindings_bar(win[STA].p, bindings, bindings_size, 0, bindings_size, NULL); |