Use standard ARRAY_SIZE instead of handcrafted NRES.

Signed-off-by: Sascha Hauer <[email protected]>
---
 common/hush.c | 6 ++++--
 1 file 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);
-- 
1.8.4.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to