From 2c69b55e55f2efc5a334b87ccdceaa9de0ecb658 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 30 Apr 2009 19:32:02 +0200 Subject: iptables: replace open-coded sizeof by ARRAY_SIZE Signed-off-by: Jan Engelhardt --- extensions/libxt_tcp.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'extensions/libxt_tcp.c') 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; -- cgit v1.2.3