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_sctp.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'extensions/libxt_sctp.c') diff --git a/extensions/libxt_sctp.c b/extensions/libxt_sctp.c index b889406b..829eade0 100644 --- a/extensions/libxt_sctp.c +++ b/extensions/libxt_sctp.c @@ -17,20 +17,8 @@ #include #include -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -#endif - #include -/* Some ZS!#@:$%*#$! has replaced the ELEMCOUNT macro in ipt_sctp.h with - * ARRAY_SIZE without noticing that this file is used from userspace, - * and userspace doesn't have ARRAY_SIZE */ - -#ifndef ELEMCOUNT -#define ELEMCOUNT ARRAY_SIZE -#endif - #if 0 #define DEBUGP(format, first...) printf(format, ##first) #define static @@ -198,7 +186,7 @@ parse_sctp_chunk(struct xt_sctp_info *einfo, *chunk_flags++ = 0; } - for (i = 0; i < ELEMCOUNT(sctp_chunk_names); i++) { + for (i = 0; i < ARRAY_SIZE(sctp_chunk_names); ++i) if (strcasecmp(sctp_chunk_names[i].name, ptr) == 0) { DEBUGP("Chunk num %d\n", sctp_chunk_names[i].chunk_type); SCTP_CHUNKMAP_SET(einfo->chunkmap, @@ -206,7 +194,6 @@ parse_sctp_chunk(struct xt_sctp_info *einfo, found = 1; break; } - } if (!found) xtables_error(PARAMETER_PROBLEM, "Unknown sctp chunk `%s'", ptr); @@ -389,10 +376,9 @@ print_chunk(u_int32_t chunknum, int numeric) else { int i; - for (i = 0; i < ELEMCOUNT(sctp_chunk_names); i++) { + for (i = 0; i < ARRAY_SIZE(sctp_chunk_names); ++i) if (sctp_chunk_names[i].chunk_type == chunknum) printf("%s", sctp_chunk_names[chunknum].name); - } } } -- cgit v1.2.3