summaryrefslogtreecommitdiffstats
path: root/extensions/libxt_tcp.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/libxt_tcp.c
parent69f564e3890976461de0016cd81171ff8bfa8353 (diff)
iptables: replace open-coded sizeof by ARRAY_SIZE
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'extensions/libxt_tcp.c')
-rw-r--r--extensions/libxt_tcp.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/extensions/libxt_tcp.c b/extensions/libxt_tcp.c
index d2ad53b3..5ea9ebd2 100644
--- a/extensions/libxt_tcp.c
+++ b/extensions/libxt_tcp.c
@@ -86,18 +86,15 @@ parse_tcp_flag(const char *flags)
for (ptr = strtok(buffer, ","); ptr; ptr = strtok(NULL, ",")) {
unsigned int i;
- for (i = 0;
- i < sizeof(tcp_flag_names)/sizeof(struct tcp_flag_names);
- i++) {
+ for (i = 0; i < ARRAY_SIZE(tcp_flag_names); ++i)
if (strcasecmp(tcp_flag_names[i].name, ptr) == 0) {
ret |= tcp_flag_names[i].flag;
break;
}
- }
- if (i == sizeof(tcp_flag_names)/sizeof(struct tcp_flag_names))
+ if (i == ARRAY_SIZE(tcp_flag_names))
xtables_error(PARAMETER_PROBLEM,
"Unknown TCP flag `%s'", ptr);
- }
+ }
free(buffer);
return ret;