iptables: replace open-coded sizeof by ARRAY_SIZE
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
diff --git a/extensions/libip6t_mh.c b/extensions/libip6t_mh.c
index 9711f76..47d5544 100644
--- a/extensions/libip6t_mh.c
+++ b/extensions/libip6t_mh.c
@@ -48,7 +48,7 @@
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 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 @@
{
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;
}