diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2009-04-30 19:32:02 +0200 |
---|---|---|
committer | Jan Engelhardt <jengelh@medozas.de> | 2009-05-26 13:14:15 +0200 |
commit | 2c69b55e55f2efc5a334b87ccdceaa9de0ecb658 (patch) | |
tree | f68c86d49be428f2e46f483eec0b36d01a15e311 /extensions/libip6t_mh.c | |
parent | 69f564e3890976461de0016cd81171ff8bfa8353 (diff) |
iptables: replace open-coded sizeof by ARRAY_SIZE
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'extensions/libip6t_mh.c')
-rw-r--r-- | extensions/libip6t_mh.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/extensions/libip6t_mh.c b/extensions/libip6t_mh.c index 9711f764..47d55448 100644 --- a/extensions/libip6t_mh.c +++ b/extensions/libip6t_mh.c @@ -48,7 +48,7 @@ static void print_types_all(void) unsigned int i; printf("Valid MH types:"); - for (i = 0; i < sizeof(mh_names)/sizeof(struct mh_name); i++) { + for (i = 0; i < ARRAY_SIZE(mh_names); ++i) { if (i && mh_names[i].type == mh_names[i-1].type) printf(" (%s)", mh_names[i].name); else @@ -75,7 +75,7 @@ static void mh_init(struct xt_entry_match *m) static unsigned int name_to_type(const char *name) { int namelen = strlen(name); - unsigned int limit = sizeof(mh_names)/sizeof(struct mh_name); + static const unsigned int limit = ARRAY_SIZE(mh_names); unsigned int match = limit; unsigned int i; @@ -151,10 +151,9 @@ static const char *type_to_name(u_int8_t type) { unsigned int i; - for (i = 0; i < sizeof(mh_names)/sizeof(struct mh_name); i++) { + for (i = 0; i < ARRAY_SIZE(mh_names); ++i) if (mh_names[i].type == type) return mh_names[i].name; - } return NULL; } |