From: Stephane Ouellette <ouellettes@videotron.ca>
To: Harald Welte <laforge@netfilter.org>
Cc: netfilter-devel@lists.netfilter.org
Subject: [PATCH][COSMETIC] C99 initializers + indentation + simplification of libip6t_dst.c
Date: Tue, 12 Aug 2003 13:40:58 -0400 [thread overview]
Message-ID: <3F3926AA.4080305@videotron.ca> (raw)
[-- Attachment #1: Type: text/plain, Size: 202 bytes --]
Harald,
here's another cosmetic patch that includes:
1- C99 initializers
2- Indentation cleanups
3- Reduce the number of calls to printf() without changing the output.
Please apply.
Stephane.
[-- Attachment #2: libip6t_dst.c.patch --]
[-- Type: text/plain, Size: 3157 bytes --]
--- netfilter.orig/userspace/extensions/libip6t_dst.c Fri Jun 14 03:38:16 2002
+++ netfilter/userspace/extensions/libip6t_dst.c Mon Aug 11 21:49:15 2003
@@ -31,17 +31,17 @@
#if HOPBYHOP
static struct option opts[] = {
- { "hbh-len", 1, 0, '1' },
- { "hbh-opts", 1, 0, '2' },
- { "hbh-not-strict", 1, 0, '3' },
- {0}
+ { .name = "hbh-len", .has_arg = 1, .flag = 0, .val = '1' },
+ { .name = "hbh-opts", .has_arg = 1, .flag = 0, .val = '2' },
+ { .name = "hbh-not-strict", .has_arg = 1, .flag = 0, .val = '3' },
+ { .name = 0 }
};
#else
static struct option opts[] = {
- { "dst-len", 1, 0, '1' },
- { "dst-opts", 1, 0, '2' },
- { "dst-not-strict", 1, 0, '3' },
- {0}
+ { .name = "dst-len", .has_arg = 1, .flag = 0, .val = '1' },
+ { .name = "dst-opts", .has_arg = 1, .flag = 0, .val = '2' },
+ { .name = "dst-not-strict", .has_arg = 1, .flag = 0, .val = '3' },
+ { .name = 0 }
};
#endif
@@ -51,7 +51,7 @@
unsigned long int id;
char* ep;
- id = strtoul(idstr,&ep,0) ;
+ id = strtoul(idstr, &ep, 0);
if ( idstr == ep ) {
exit_error(PARAMETER_PROBLEM,
@@ -206,15 +206,19 @@
const struct ip6t_opts *optinfo = (struct ip6t_opts *)match->data;
printf("%s ", LNAME);
- if (optinfo->flags & IP6T_OPTS_LEN) {
- printf("length");
- printf(":%s", optinfo->invflags & IP6T_OPTS_INV_LEN ? "!" : "");
- printf("%u", optinfo->hdrlen);
- printf(" ");
- }
- if (optinfo->flags & IP6T_OPTS_OPTS) printf("opts ");
+ if (optinfo->flags & IP6T_OPTS_LEN)
+ printf("length:%s%u ",
+ optinfo->invflags & IP6T_OPTS_INV_LEN ? "!" : "",
+ optinfo->hdrlen);
+
+ if (optinfo->flags & IP6T_OPTS_OPTS)
+ printf("opts ");
+
print_options(optinfo->optsnr, (u_int16_t *)optinfo->opts);
- if (optinfo->flags & IP6T_OPTS_NSTRICT) printf("not-strict ");
+
+ if (optinfo->flags & IP6T_OPTS_NSTRICT)
+ printf("not-strict ");
+
if (optinfo->invflags & ~IP6T_OPTS_INV_MASK)
printf("Unknown invflags: 0x%X ",
optinfo->invflags & ~IP6T_OPTS_INV_MASK);
@@ -231,30 +235,32 @@
optinfo->hdrlen);
}
- if (optinfo->flags & IP6T_OPTS_OPTS) printf("--%s-opts ", LNAME);
+ if (optinfo->flags & IP6T_OPTS_OPTS)
+ printf("--%s-opts ", LNAME);
+
print_options(optinfo->optsnr, (u_int16_t *)optinfo->opts);
- if (optinfo->flags & IP6T_OPTS_NSTRICT) printf("--%s-not-strict ", LNAME);
+ if (optinfo->flags & IP6T_OPTS_NSTRICT)
+ printf("--%s-not-strict ", LNAME);
}
static
-struct ip6tables_match optstruct
-= { NULL,
+struct ip6tables_match optstruct = {
#if HOPBYHOP
- "hbh",
+ .name = "hbh",
#else
- "dst",
+ .name = "dst",
#endif
- IPTABLES_VERSION,
- IP6T_ALIGN(sizeof(struct ip6t_opts)),
- IP6T_ALIGN(sizeof(struct ip6t_opts)),
- &help,
- &init,
- &parse,
- &final_check,
- &print,
- &save,
- opts
+ .version = IPTABLES_VERSION,
+ .size = IP6T_ALIGN(sizeof(struct ip6t_opts)),
+ .userspacesize = IP6T_ALIGN(sizeof(struct ip6t_opts)),
+ .help = &help,
+ .init = &init,
+ .parse = &parse,
+ .final = &final_check,
+ .print = &print,
+ .save = &save,
+ .extra_opts = opts
};
void
reply other threads:[~2003-08-12 17:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F3926AA.4080305@videotron.ca \
--to=ouellettes@videotron.ca \
--cc=laforge@netfilter.org \
--cc=netfilter-devel@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.