From 0813a80223e40a5d122dfa86ea41e7b1c986f093 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 5 May 2012 20:26:54 -0400 Subject: add a new ARRAY_SIZE macro and use it Signed-off-by: Mike Frysinger --- src/libeinfo/libeinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libeinfo') diff --git a/src/libeinfo/libeinfo.c b/src/libeinfo/libeinfo.c index eb331930..98cec928 100644 --- a/src/libeinfo/libeinfo.c +++ b/src/libeinfo/libeinfo.c @@ -135,7 +135,7 @@ static const struct ecolor ecolors[] = { { ECOLOR_BRACKET, BRACKET, "bracket" }, { ECOLOR_NORMAL, 0, NULL }, }; -static const char *ecolors_str[sizeof(ecolors)/sizeof(ecolors[0])]; +static const char *ecolors_str[ARRAY_SIZE(ecolors)]; static char *flush = NULL; static char *up = NULL; @@ -442,7 +442,7 @@ colour_terminal(FILE * EINFO_RESTRICT f) /* Now setup our colours */ p = ebuffer; - for (i = 0; i < sizeof(ecolors) / sizeof(ecolors[0]); i++) { + for (i = 0; i < ARRAY_SIZE(ecolors); ++i) { tmp[0] = '\0'; if (ecolors[i].name) { bold = _md; @@ -578,7 +578,7 @@ _ecolor(FILE * EINFO_RESTRICT f, ECOLOR color) if (!colour_terminal(f)) return ""; - for (i = 0; i < sizeof(ecolors) / sizeof(ecolors[0]); i++) + for (i = 0; i < ARRAY_SIZE(ecolors); ++i) if (ecolors[i].color == color) return ecolors_str[i]; return ""; -- cgit v1.2.3