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/libxt_pkttype.c | |
parent | 69f564e3890976461de0016cd81171ff8bfa8353 (diff) |
iptables: replace open-coded sizeof by ARRAY_SIZE
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'extensions/libxt_pkttype.c')
-rw-r--r-- | extensions/libxt_pkttype.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/extensions/libxt_pkttype.c b/extensions/libxt_pkttype.c index 50af3ed4..e3db2aa9 100644 --- a/extensions/libxt_pkttype.c +++ b/extensions/libxt_pkttype.c @@ -46,11 +46,9 @@ static void print_types(void) unsigned int i; printf("Valid packet types:\n"); - for (i = 0; i < sizeof(supported_types)/sizeof(struct pkttypes); i++) - { + for (i = 0; i < ARRAY_SIZE(supported_types); ++i) if(supported_types[i].printhelp == 1) printf("\t%-14s\t\t%s\n", supported_types[i].name, supported_types[i].help); - } printf("\n"); } @@ -71,14 +69,12 @@ static void parse_pkttype(const char *pkttype, struct xt_pkttype_info *info) { unsigned int i; - for (i = 0; i < sizeof(supported_types)/sizeof(struct pkttypes); i++) - { + for (i = 0; i < ARRAY_SIZE(supported_types); ++i) if(strcasecmp(pkttype, supported_types[i].name)==0) { info->pkttype=supported_types[i].pkttype; return; } - } xtables_error(PARAMETER_PROBLEM, "Bad packet type '%s'", pkttype); } @@ -115,14 +111,12 @@ static void print_pkttype(const struct xt_pkttype_info *info) { unsigned int i; - for (i = 0; i < sizeof(supported_types)/sizeof(struct pkttypes); i++) - { + for (i = 0; i < ARRAY_SIZE(supported_types); ++i) if(supported_types[i].pkttype==info->pkttype) { printf("%s ", supported_types[i].name); return; } - } printf("%d ", info->pkttype); /* in case we didn't find an entry in named-packtes */ } |