diff options
author | Linda Sun <lsun@vmware.com> | 2013-07-19 10:04:47 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-07-19 10:05:15 -0700 |
commit | 3815d6c2cdc8d6ccf1f726b2bde9965374a8301c (patch) | |
tree | 6701a513bc184ebb8681dc9df40c83bff50e46d3 /utilities | |
parent | 59987a623a2792ec836438249512da51f203e33a (diff) | |
download | openvswitch-3815d6c2cdc8d6ccf1f726b2bde9965374a8301c.tar.gz |
Avoid designated initializers and static decls of arrays of unknown size.
MSVC can't handle either one.
Signed-off-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'utilities')
-rw-r--r-- | utilities/ovs-benchmark.c | 9 | ||||
-rw-r--r-- | utilities/ovs-dpctl.c | 9 | ||||
-rw-r--r-- | utilities/ovs-ofctl.c | 9 | ||||
-rw-r--r-- | utilities/ovs-vsctl.c | 10 |
4 files changed, 28 insertions, 9 deletions
diff --git a/utilities/ovs-benchmark.c b/utilities/ovs-benchmark.c index d1bdaace5..6eeedc618 100644 --- a/utilities/ovs-benchmark.c +++ b/utilities/ovs-benchmark.c @@ -49,7 +49,7 @@ static double max_rate; static double timeout; -static const struct command all_commands[]; +static const struct command *get_all_commands(void); static void parse_options(int argc, char *argv[]); static void usage(void); @@ -72,7 +72,7 @@ main(int argc, char *argv[]) set_program_name(argv[0]); vlog_set_levels(NULL, VLF_ANY_FACILITY, VLL_EMER); parse_options(argc, argv); - run_command(argc - optind, argv + optind, all_commands); + run_command(argc - optind, argv + optind, get_all_commands()); return 0; } @@ -617,3 +617,8 @@ static const struct command all_commands[] = { { "help", 0, 0, cmd_help }, { NULL, 0, 0, NULL }, }; + +static const struct command *get_all_commands(void) +{ + return all_commands; +} diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c index 2389942ef..e285ed509 100644 --- a/utilities/ovs-dpctl.c +++ b/utilities/ovs-dpctl.c @@ -66,7 +66,7 @@ static bool may_create; * the option itself. */ static int verbosity; -static const struct command all_commands[]; +static const struct command *get_all_commands(void); static void usage(void) NO_RETURN; static void parse_options(int argc, char *argv[]); @@ -77,7 +77,7 @@ main(int argc, char *argv[]) set_program_name(argv[0]); parse_options(argc, argv); signal(SIGPIPE, SIG_IGN); - run_command(argc - optind, argv + optind, all_commands); + run_command(argc - optind, argv + optind, get_all_commands()); return 0; } @@ -1146,3 +1146,8 @@ static const struct command all_commands[] = { { NULL, 0, 0, NULL }, }; + +static const struct command *get_all_commands(void) +{ + return all_commands; +} diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 4d5a84ea2..262225576 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -98,7 +98,7 @@ struct sort_criterion { static struct sort_criterion *criteria; static size_t n_criteria, allocated_criteria; -static const struct command all_commands[]; +static const struct command *get_all_commands(void); static void usage(void) NO_RETURN; static void parse_options(int argc, char *argv[]); @@ -113,7 +113,7 @@ main(int argc, char *argv[]) set_program_name(argv[0]); parse_options(argc, argv); signal(SIGPIPE, SIG_IGN); - run_command(argc - optind, argv + optind, all_commands); + run_command(argc - optind, argv + optind, get_all_commands()); return 0; } @@ -2956,3 +2956,8 @@ static const struct command all_commands[] = { { NULL, 0, 0, NULL }, }; + +static const struct command *get_all_commands(void) +{ + return all_commands; +} diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index e679e0d8d..0527885b3 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -128,7 +128,7 @@ static bool retry; static struct table_style table_style = TABLE_STYLE_DEFAULT; /* All supported commands. */ -static const struct vsctl_command_syntax all_commands[]; +static const struct vsctl_command_syntax *get_all_commands(void); /* The IDL we're using and the current transaction, if any. * This is for use by vsctl_exit() only, to allow it to clean up. @@ -302,7 +302,7 @@ parse_options(int argc, char *argv[], struct shash *local_options) options = xmemdup(global_long_options, sizeof global_long_options); allocated_options = ARRAY_SIZE(global_long_options); n_options = n_global_long_options; - for (p = all_commands; p->name; p++) { + for (p = get_all_commands(); p->name; p++) { if (p->options[0]) { char *save_ptr = NULL; char *name; @@ -568,7 +568,7 @@ find_command(const char *name) if (shash_is_empty(&commands)) { const struct vsctl_command_syntax *p; - for (p = all_commands; p->name; p++) { + for (p = get_all_commands(); p->name; p++) { shash_add_assert(&commands, p->name, p); } } @@ -4228,3 +4228,7 @@ static const struct vsctl_command_syntax all_commands[] = { {NULL, 0, 0, NULL, NULL, NULL, NULL, RO}, }; +static const struct vsctl_command_syntax *get_all_commands(void) +{ + return all_commands; +} |