Reducing non-const static data makes code more obviously thread-safe. Although option parsing does not normally need to be thread-safe, I don't know of a drawback to making its data const.
Signed-off-by: Ben Pfaff <b...@nicira.com> --- ovsdb/ovsdb-client.c | 4 ++-- ovsdb/ovsdb-server.c | 2 +- ovsdb/ovsdb-tool.c | 2 +- tests/test-jsonrpc.c | 4 ++-- tests/test-netflow.c | 2 +- tests/test-ovsdb.c | 2 +- tests/test-sflow.c | 2 +- tests/test-util.c | 2 +- utilities/ovs-benchmark.c | 4 ++-- utilities/ovs-controller.c | 2 +- utilities/ovs-dpctl.c | 2 +- utilities/ovs-ofctl.c | 2 +- vswitchd/ovs-vswitchd.c | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index 37bd1aa..53e6bb9 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -166,7 +166,7 @@ parse_options(int argc, char *argv[]) DAEMON_OPTION_ENUMS, TABLE_OPTION_ENUMS }; - static struct option long_options[] = { + static const struct option long_options[] = { {"verbose", optional_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'V'}, diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index a8daf1f..1ba7c3c 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -980,7 +980,7 @@ parse_options(int *argcp, char **argvp[], LEAK_CHECKER_OPTION_ENUMS, DAEMON_OPTION_ENUMS }; - static struct option long_options[] = { + static const struct option long_options[] = { {"remote", required_argument, NULL, OPT_REMOTE}, {"unixctl", required_argument, NULL, OPT_UNIXCTL}, {"run", required_argument, NULL, OPT_RUN}, diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c index b50b39b..8ba1513 100644 --- a/ovsdb/ovsdb-tool.c +++ b/ovsdb/ovsdb-tool.c @@ -66,7 +66,7 @@ main(int argc, char *argv[]) static void parse_options(int argc, char *argv[]) { - static struct option long_options[] = { + static const struct option long_options[] = { {"more", no_argument, NULL, 'm'}, {"verbose", optional_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, diff --git a/tests/test-jsonrpc.c b/tests/test-jsonrpc.c index 7cc708a..616ff2e 100644 --- a/tests/test-jsonrpc.c +++ b/tests/test-jsonrpc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +56,7 @@ parse_options(int argc, char *argv[]) OPT_BOOTSTRAP_CA_CERT = UCHAR_MAX + 1, DAEMON_OPTION_ENUMS }; - static struct option long_options[] = { + static const struct option long_options[] = { {"verbose", optional_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, DAEMON_LONG_OPTIONS, diff --git a/tests/test-netflow.c b/tests/test-netflow.c index 6e5b0be..921f0fd 100644 --- a/tests/test-netflow.c +++ b/tests/test-netflow.c @@ -237,7 +237,7 @@ parse_options(int argc, char *argv[]) DAEMON_OPTION_ENUMS, VLOG_OPTION_ENUMS }; - static struct option long_options[] = { + static const struct option long_options[] = { {"help", no_argument, NULL, 'h'}, DAEMON_LONG_OPTIONS, VLOG_LONG_OPTIONS, diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c index 658259e..10d434e 100644 --- a/tests/test-ovsdb.c +++ b/tests/test-ovsdb.c @@ -68,7 +68,7 @@ main(int argc, char *argv[]) static void parse_options(int argc, char *argv[]) { - static struct option long_options[] = { + static const struct option long_options[] = { {"timeout", required_argument, NULL, 't'}, {"verbose", optional_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, diff --git a/tests/test-sflow.c b/tests/test-sflow.c index 838fa62..edb996c 100644 --- a/tests/test-sflow.c +++ b/tests/test-sflow.c @@ -559,7 +559,7 @@ parse_options(int argc, char *argv[]) DAEMON_OPTION_ENUMS, VLOG_OPTION_ENUMS }; - static struct option long_options[] = { + static const struct option long_options[] = { {"verbose", optional_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, DAEMON_LONG_OPTIONS, diff --git a/tests/test-util.c b/tests/test-util.c index 3eecc7a..3422af3 100644 --- a/tests/test-util.c +++ b/tests/test-util.c @@ -363,7 +363,7 @@ parse_options(int argc, char *argv[]) enum { VLOG_OPTION_ENUMS }; - static struct option long_options[] = { + static const struct option long_options[] = { VLOG_LONG_OPTIONS, {NULL, 0, NULL, 0}, }; diff --git a/utilities/ovs-benchmark.c b/utilities/ovs-benchmark.c index 162f7cf..0f5906d 100644 --- a/utilities/ovs-benchmark.c +++ b/utilities/ovs-benchmark.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -118,7 +118,7 @@ parse_target(const char *s_, struct in_addr *addr, static void parse_options(int argc, char *argv[]) { - static struct option long_options[] = { + static const struct option long_options[] = { {"local", required_argument, NULL, 'l'}, {"remote", required_argument, NULL, 'r'}, {"batches", required_argument, NULL, 'b'}, diff --git a/utilities/ovs-controller.c b/utilities/ovs-controller.c index 51765bd..70bc2e6 100644 --- a/utilities/ovs-controller.c +++ b/utilities/ovs-controller.c @@ -255,7 +255,7 @@ parse_options(int argc, char *argv[]) DAEMON_OPTION_ENUMS, OFP_VERSION_OPTION_ENUMS }; - static struct option long_options[] = { + static const struct option long_options[] = { {"hub", no_argument, NULL, 'H'}, {"noflow", no_argument, NULL, 'n'}, {"normal", no_argument, NULL, 'N'}, diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c index 3b6e6a5..2f9574f 100644 --- a/utilities/ovs-dpctl.c +++ b/utilities/ovs-dpctl.c @@ -89,7 +89,7 @@ parse_options(int argc, char *argv[]) OPT_MAY_CREATE, VLOG_OPTION_ENUMS }; - static struct option long_options[] = { + static const struct option long_options[] = { {"statistics", no_argument, NULL, 's'}, {"clear", no_argument, NULL, OPT_CLEAR}, {"may-create", no_argument, NULL, OPT_MAY_CREATE}, diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index ec775c7..586f8a2 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -151,7 +151,7 @@ parse_options(int argc, char *argv[]) OFP_VERSION_OPTION_ENUMS, VLOG_OPTION_ENUMS }; - static struct option long_options[] = { + static const struct option long_options[] = { {"timeout", required_argument, NULL, 't'}, {"strict", no_argument, NULL, OPT_STRICT}, {"readd", no_argument, NULL, OPT_READD}, diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index 9736b79..78ebd31 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -159,7 +159,7 @@ parse_options(int argc, char *argv[], char **unixctl_pathp) OPT_DISABLE_SYSTEM, DAEMON_OPTION_ENUMS }; - static struct option long_options[] = { + static const struct option long_options[] = { {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'V'}, {"mlockall", no_argument, NULL, OPT_MLOCKALL}, -- 1.7.2.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev