summaryrefslogtreecommitdiffstats
path: root/common/hush.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-11-12 10:38:33 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-11-12 14:47:15 +0100
commitb763f017280fc114d2293682a28ed80e9ed597ea (patch)
treef4c6a23e9c0708b6faeb3f43239097c82000e8c8 /common/hush.c
parentcc3fc44dbfe320989e0cc011c4a727971ae18ad5 (diff)
downloadbarebox-b763f017280fc114d2293682a28ed80e9ed597ea.tar.gz
hush: use standard ARRAY_SIZE
Use standard ARRAY_SIZE instead of handcrafted NRES. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/hush.c')
-rw-r--r--common/hush.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/hush.c b/common/hush.c
index 35c3c3c..d844e74 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -1192,13 +1192,15 @@ static struct reserved_combo reserved_list[] = {
{ "do", RES_DO, FLAG_DONE },
{ "done", RES_DONE, FLAG_END }
};
-#define NRES (sizeof(reserved_list)/sizeof(struct reserved_combo))
static int reserved_word(o_string *dest, struct p_context *ctx)
{
struct reserved_combo *r;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(reserved_list); i++) {
+ r = &reserved_list[i];
- for (r = reserved_list; r < reserved_list + NRES; r++) {
if (strcmp(dest->data, r->literal) == 0) {
debug("found reserved word %s, code %d\n",r->literal,r->code);