summaryrefslogtreecommitdiffstats
path: root/extensions/libipt_REJECT.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/libipt_REJECT.c
parent69f564e3890976461de0016cd81171ff8bfa8353 (diff)
iptables: replace open-coded sizeof by ARRAY_SIZE
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'extensions/libipt_REJECT.c')
-rw-r--r--extensions/libipt_REJECT.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/extensions/libipt_REJECT.c b/extensions/libipt_REJECT.c
index 5b23f547..888ff397 100644
--- a/extensions/libipt_REJECT.c
+++ b/extensions/libipt_REJECT.c
@@ -56,7 +56,7 @@ print_reject_types(void)
printf("Valid reject types:\n");
- for (i = 0; i < sizeof(reject_table)/sizeof(struct reject_names); i++) {
+ for (i = 0; i < ARRAY_SIZE(reject_table); ++i) {
printf(" %-25s\t%s\n", reject_table[i].name, reject_table[i].desc);
printf(" %-25s\talias\n", reject_table[i].alias);
}
@@ -93,7 +93,7 @@ static int REJECT_parse(int c, char **argv, int invert, unsigned int *flags,
const void *entry, struct xt_entry_target **target)
{
struct ipt_reject_info *reject = (struct ipt_reject_info *)(*target)->data;
- unsigned int limit = sizeof(reject_table)/sizeof(struct reject_names);
+ static const unsigned int limit = ARRAY_SIZE(reject_table);
unsigned int i;
switch(c) {
@@ -128,10 +128,9 @@ static void REJECT_print(const void *ip, const struct xt_entry_target *target,
= (const struct ipt_reject_info *)target->data;
unsigned int i;
- for (i = 0; i < sizeof(reject_table)/sizeof(struct reject_names); i++) {
+ for (i = 0; i < ARRAY_SIZE(reject_table); ++i)
if (reject_table[i].with == reject->with)
break;
- }
printf("reject-with %s ", reject_table[i].name);
}
@@ -141,7 +140,7 @@ static void REJECT_save(const void *ip, const struct xt_entry_target *target)
= (const struct ipt_reject_info *)target->data;
unsigned int i;
- for (i = 0; i < sizeof(reject_table)/sizeof(struct reject_names); i++)
+ for (i = 0; i < ARRAY_SIZE(reject_table); ++i)
if (reject_table[i].with == reject->with)
break;