summaryrefslogtreecommitdiffstats
path: root/extensions/libip6t_icmp6.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2009-04-30 19:32:02 +0200
committerJan Engelhardt <jengelh@medozas.de>2009-05-26 13:14:15 +0200
commit2c69b55e55f2efc5a334b87ccdceaa9de0ecb658 (patch)
treef68c86d49be428f2e46f483eec0b36d01a15e311 /extensions/libip6t_icmp6.c
parent69f564e3890976461de0016cd81171ff8bfa8353 (diff)
iptables: replace open-coded sizeof by ARRAY_SIZE
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'extensions/libip6t_icmp6.c')
-rw-r--r--extensions/libip6t_icmp6.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/extensions/libip6t_icmp6.c b/extensions/libip6t_icmp6.c
index 0678aac3..e41a670c 100644
--- a/extensions/libip6t_icmp6.c
+++ b/extensions/libip6t_icmp6.c
@@ -59,7 +59,7 @@ print_icmpv6types(void)
unsigned int i;
printf("Valid ICMPv6 Types:");
- for (i = 0; i < sizeof(icmpv6_codes)/sizeof(struct icmpv6_names); i++) {
+ for (i = 0; i < ARRAY_SIZE(icmpv6_codes); ++i) {
if (i && icmpv6_codes[i].type == icmpv6_codes[i-1].type) {
if (icmpv6_codes[i].code_min == icmpv6_codes[i-1].code_min
&& (icmpv6_codes[i].code_max
@@ -91,7 +91,7 @@ static const struct option icmp6_opts[] = {
static void
parse_icmpv6(const char *icmpv6type, u_int8_t *type, u_int8_t code[])
{
- unsigned int limit = sizeof(icmpv6_codes)/sizeof(struct icmpv6_names);
+ static const unsigned int limit = ARRAY_SIZE(icmpv6_codes);
unsigned int match = limit;
unsigned int i;
@@ -181,16 +181,13 @@ static void print_icmpv6type(u_int8_t type,
if (!numeric) {
unsigned int i;
- for (i = 0;
- i < sizeof(icmpv6_codes)/sizeof(struct icmpv6_names);
- i++) {
+ for (i = 0; i < ARRAY_SIZE(icmpv6_codes); ++i)
if (icmpv6_codes[i].type == type
&& icmpv6_codes[i].code_min == code_min
&& icmpv6_codes[i].code_max == code_max)
break;
- }
- if (i != sizeof(icmpv6_codes)/sizeof(struct icmpv6_names)) {
+ if (i != ARRAY_SIZE(icmpv6_codes)) {
printf("%s%s ",
invert ? "!" : "",
icmpv6_codes[i].name);