Consistently write null pointer constants as NULL instead of 0.
authorBen Pfaff <blp@nicira.com>
Wed, 4 May 2011 20:49:42 +0000 (13:49 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 16 May 2011 20:40:47 +0000 (13:40 -0700)
Found with sparse.

24 files changed:
lib/daemon.h
lib/leak-checker.h
lib/rtnetlink.c
lib/stream-ssl.h
lib/table.h
lib/vlog.h
ovsdb/log.c
ovsdb/ovsdb-client.c
ovsdb/ovsdb-server.c
ovsdb/ovsdb-tool.c
ovsdb/ovsdb.c
ovsdb/table.c
tests/test-jsonrpc.c
tests/test-lockfile.c
tests/test-ovsdb.c
utilities/ovs-appctl.c
utilities/ovs-controller.c
utilities/ovs-dpctl.c
utilities/ovs-ofctl.c
utilities/ovs-openflowd.c
utilities/ovs-vlan-bug-workaround.c
utilities/ovs-vsctl.c
vswitchd/ovs-brcompatd.c
vswitchd/ovs-vswitchd.c

index 4af98f624b193f97189981cfd491c19a1627d400..eb38d5d87971aa3d222a385ec352640520d21a08 100644 (file)
     OPT_PIDFILE,                                \
     OPT_MONITOR
 
-#define DAEMON_LONG_OPTIONS                                          \
-        {"detach",            no_argument, 0, OPT_DETACH},           \
-        {"no-chdir",          no_argument, 0, OPT_NO_CHDIR},         \
-        {"pidfile",           optional_argument, 0, OPT_PIDFILE},    \
-        {"overwrite-pidfile", no_argument, 0, OPT_OVERWRITE_PIDFILE},\
-        {"monitor",           no_argument, 0, OPT_MONITOR}
+#define DAEMON_LONG_OPTIONS                                             \
+        {"detach",            no_argument, NULL, OPT_DETACH},           \
+        {"no-chdir",          no_argument, NULL, OPT_NO_CHDIR},         \
+        {"pidfile",           optional_argument, NULL, OPT_PIDFILE},    \
+        {"overwrite-pidfile", no_argument, NULL, OPT_OVERWRITE_PIDFILE}, \
+        {"monitor",           no_argument, NULL, OPT_MONITOR}
 
 #define DAEMON_OPTION_HANDLERS                  \
         case OPT_DETACH:                        \
index 8d7624de83ca48a18ce6d1963db7b8db606c5392..f6ee5c13342512cb170d575a11cb5fe4759b718a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2011 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,8 +23,8 @@
     OPT_CHECK_LEAKS,                            \
     OPT_LEAK_LIMIT
 #define LEAK_CHECKER_LONG_OPTIONS                           \
-    {"check-leaks", required_argument, 0, OPT_CHECK_LEAKS}, \
-    {"leak-limit", required_argument, 0, OPT_LEAK_LIMIT}
+    {"check-leaks", required_argument, NULL, OPT_CHECK_LEAKS}, \
+    {"leak-limit", required_argument, NULL, OPT_LEAK_LIMIT}
 #define LEAK_CHECKER_OPTION_HANDLERS                \
         case OPT_CHECK_LEAKS:                       \
             leak_checker_start(optarg);             \
index 6ed85abbba2b5e51f35ca969e75f041f6c9ddb1b..d15669a084f9a3594c5345dcf0df404469b186ef 100644 (file)
@@ -55,7 +55,7 @@ rtnetlink_create(int multicast_group, rtnetlink_parse_func *parse,
     struct rtnetlink *rtn;
 
     rtn                  = xzalloc(sizeof *rtn);
-    rtn->notify_sock     = 0;
+    rtn->notify_sock     = NULL;
     rtn->multicast_group = multicast_group;
     rtn->parse           = parse;
     rtn->change          = change;
index 29c3120fd8f6751a57b09c7ad71394ca2968136d..83b9ddba202bbbb7eab20a48d7a86d10764c0465 100644 (file)
@@ -27,9 +27,9 @@ void stream_ssl_set_key_and_cert(const char *private_key_file,
                                  const char *certificate_file);
 
 #define STREAM_SSL_LONG_OPTIONS                     \
-        {"private-key", required_argument, 0, 'p'}, \
-        {"certificate", required_argument, 0, 'c'}, \
-        {"ca-cert",     required_argument, 0, 'C'}
+        {"private-key", required_argument, NULL, 'p'}, \
+        {"certificate", required_argument, NULL, 'c'}, \
+        {"ca-cert",     required_argument, NULL, 'C'}
 
 #define STREAM_SSL_OPTION_HANDLERS                      \
         case 'p':                                       \
index e35fefaf4b061d5ae23fc7caaa756c69a02ea4b8..146d4dfe32beda3cf730cdd0681c8348ff882d6c 100644 (file)
@@ -85,12 +85,12 @@ struct table_style {
     OPT_PRETTY,                                 \
     OPT_BARE
 
-#define TABLE_LONG_OPTIONS                                  \
-        {"format", required_argument, 0, 'f'},              \
-        {"data", required_argument, 0, 'd'},                \
-        {"no-headings", no_argument, 0, OPT_NO_HEADINGS},   \
-        {"pretty", no_argument, 0, OPT_PRETTY},             \
-        {"bare", no_argument, 0, OPT_BARE}
+#define TABLE_LONG_OPTIONS                                      \
+        {"format", required_argument, NULL, 'f'},               \
+        {"data", required_argument, NULL, 'd'},                 \
+        {"no-headings", no_argument, NULL, OPT_NO_HEADINGS},    \
+        {"pretty", no_argument, NULL, OPT_PRETTY},              \
+        {"bare", no_argument, NULL, OPT_BARE}
 
 #define TABLE_OPTION_HANDLERS(STYLE)                \
         case 'f':                                   \
index bbc00ad2527a015919d564840a08523de29a99bf..12844c6f7f1715bd26d848be352b6ea2442f2e68 100644 (file)
@@ -222,8 +222,8 @@ void vlog_rate_limit(const struct vlog_module *, enum vlog_level,
 /* Command line processing. */
 #define VLOG_OPTION_ENUMS OPT_LOG_FILE
 #define VLOG_LONG_OPTIONS                                   \
-        {"verbose",     optional_argument, 0, 'v'},         \
-        {"log-file",    optional_argument, 0, OPT_LOG_FILE}
+        {"verbose",     optional_argument, NULL, 'v'},         \
+        {"log-file",    optional_argument, NULL, OPT_LOG_FILE}
 #define VLOG_OPTION_HANDLERS                    \
         case 'v':                               \
             vlog_set_verbosity(optarg);         \
index 67043078f73da192f52971c771d5bcb101175042..f0926c0e6d976c138ffe3b16867323f7e47514a4 100644 (file)
@@ -289,7 +289,7 @@ ovsdb_log_read(struct ovsdb_log *file, struct json **jsonp)
     file->prev_offset = file->offset;
     file->offset = data_offset + data_length;
     *jsonp = json;
-    return 0;
+    return NULL;
 
 error:
     file->read_error = ovsdb_error_clone(error);
@@ -372,7 +372,7 @@ ovsdb_log_write(struct ovsdb_log *file, struct json *json)
 
     file->offset += strlen(header) + length;
     free(json_string);
-    return 0;
+    return NULL;
 
 error:
     file->write_error = ovsdb_error_clone(error);
@@ -386,7 +386,7 @@ ovsdb_log_commit(struct ovsdb_log *file)
     if (fsync(fileno(file->stream))) {
         return ovsdb_io_error(errno, "%s: fsync failed", file->name);
     }
-    return 0;
+    return NULL;
 }
 
 /* Returns the current offset into the file backing 'log', in bytes.  This
index e8afdd6b389d42c080c1368367cb37b06f69f787..800d3e1729867db5ca5ee0928fec0a8c2149c630 100644 (file)
@@ -74,16 +74,16 @@ parse_options(int argc, char *argv[])
         TABLE_OPTION_ENUMS
     };
     static struct option long_options[] = {
-        {"verbose", optional_argument, 0, 'v'},
-        {"help", no_argument, 0, 'h'},
-        {"version", no_argument, 0, 'V'},
+        {"verbose", optional_argument, NULL, 'v'},
+        {"help", no_argument, NULL, 'h'},
+        {"version", no_argument, NULL, 'V'},
         DAEMON_LONG_OPTIONS,
 #ifdef HAVE_OPENSSL
-        {"bootstrap-ca-cert", required_argument, 0, OPT_BOOTSTRAP_CA_CERT},
+        {"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT},
         STREAM_SSL_LONG_OPTIONS,
 #endif
         TABLE_LONG_OPTIONS,
-        {0, 0, 0, 0},
+        {NULL, 0, NULL, 0},
     };
     char *short_options = long_options_to_short_options(long_options);
 
index 14f0fbfb757c9d71944ac02941e4e550463f13fb..5477e8680b979bd7ba51a91e83ab1d57b9862814 100644 (file)
@@ -344,7 +344,7 @@ read_string_column(const struct ovsdb_row *row, const char *column_name,
     const union ovsdb_atom *atom;
 
     atom = read_column(row, column_name, OVSDB_TYPE_STRING);
-    *stringp = atom ? atom->string : 0;
+    *stringp = atom ? atom->string : NULL;
     return atom != NULL;
 }
 
@@ -659,19 +659,19 @@ parse_options(int argc, char *argv[], char **file_namep,
         DAEMON_OPTION_ENUMS
     };
     static struct option long_options[] = {
-        {"remote",      required_argument, 0, OPT_REMOTE},
-        {"unixctl",     required_argument, 0, OPT_UNIXCTL},
-        {"run",         required_argument, 0, OPT_RUN},
-        {"help",        no_argument, 0, 'h'},
-        {"version",     no_argument, 0, 'V'},
+        {"remote",      required_argument, NULL, OPT_REMOTE},
+        {"unixctl",     required_argument, NULL, OPT_UNIXCTL},
+        {"run",         required_argument, NULL, OPT_RUN},
+        {"help",        no_argument, NULL, 'h'},
+        {"version",     no_argument, NULL, 'V'},
         DAEMON_LONG_OPTIONS,
         VLOG_LONG_OPTIONS,
         LEAK_CHECKER_LONG_OPTIONS,
-        {"bootstrap-ca-cert", required_argument, 0, OPT_BOOTSTRAP_CA_CERT},
-        {"private-key", required_argument, 0, 'p'},
-        {"certificate", required_argument, 0, 'c'},
-        {"ca-cert",     required_argument, 0, 'C'},
-        {0, 0, 0, 0},
+        {"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT},
+        {"private-key", required_argument, NULL, 'p'},
+        {"certificate", required_argument, NULL, 'c'},
+        {"ca-cert",     required_argument, NULL, 'C'},
+        {NULL, 0, NULL, 0},
     };
     char *short_options = long_options_to_short_options(long_options);
 
index 2754909908cc9f46e96cb9e73bfe35379ce5ebd4..07d27293cfbf62b475de658be9eaac52f35c61d7 100644 (file)
@@ -60,11 +60,11 @@ static void
 parse_options(int argc, char *argv[])
 {
     static struct option long_options[] = {
-        {"more", no_argument, 0, 'm'},
-        {"verbose", optional_argument, 0, 'v'},
-        {"help", no_argument, 0, 'h'},
-        {"version", no_argument, 0, 'V'},
-        {0, 0, 0, 0},
+        {"more", no_argument, NULL, 'm'},
+        {"verbose", optional_argument, NULL, 'v'},
+        {"help", no_argument, NULL, 'h'},
+        {"version", no_argument, NULL, 'V'},
+        {NULL, 0, NULL, 0},
     };
     char *short_options = long_options_to_short_options(long_options);
 
index abe88e9f9fb86df34ac13025d716fb91c0a00460..fb020c9f2f4fd8b36eeec736d8aec7ee11ba6514 100644 (file)
@@ -253,7 +253,7 @@ ovsdb_schema_from_json(struct json *json, struct ovsdb_schema **schemap)
     }
 
     *schemap = schema;
-    return 0;
+    return NULL;
 }
 
 struct json *
index 2f693501b6336e7da305eec3f8c1a1584ccd0ec4..2ea73bf8a2150fb30e7d761f6eda55bf806207b9 100644 (file)
@@ -157,7 +157,7 @@ ovsdb_table_schema_from_json(const struct json *json, const char *name,
         add_column(ts, column);
     }
     *tsp = ts;
-    return 0;
+    return NULL;
 }
 
 /* Returns table schema 'ts' serialized into JSON.
index 5d93850c03e278fb2f8c7af76f866897831eea07..d892ece531bb11618ef0ecfbf81e1fe432f072c0 100644 (file)
@@ -57,12 +57,12 @@ parse_options(int argc, char *argv[])
         DAEMON_OPTION_ENUMS
     };
     static struct option long_options[] = {
-        {"verbose", optional_argument, 0, 'v'},
-        {"help", no_argument, 0, 'h'},
+        {"verbose", optional_argument, NULL, 'v'},
+        {"help", no_argument, NULL, 'h'},
         DAEMON_LONG_OPTIONS,
-        {"bootstrap-ca-cert", required_argument, 0, OPT_BOOTSTRAP_CA_CERT},
+        {"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT},
         STREAM_SSL_LONG_OPTIONS,
-        {0, 0, 0, 0},
+        {NULL, 0, NULL, 0},
     };
     char *short_options = long_options_to_short_options(long_options);
 
index 0feb27057d294d39829aee81124fb8e2b7683fc0..121b2bab83028e0fff666df9d4b6757cd1fd4172 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010 Nicira Networks.
+ * Copyright (c) 2009, 2010, 2011 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -231,7 +231,7 @@ static const struct test tests[] = {
     TEST(lock_timeout_runs_out),
     TEST(lock_multiple),
     TEST(help),
-    { 0, 0 }
+    { NULL, NULL }
 #undef TEST
 };
 
index 990bf6dde5fece0bb23a22cea91f05b740e05be6..8fe1727671527d3647acd7a5b037880ab160719b 100644 (file)
@@ -68,10 +68,10 @@ static void
 parse_options(int argc, char *argv[])
 {
     static struct option long_options[] = {
-        {"timeout", required_argument, 0, 't'},
-        {"verbose", optional_argument, 0, 'v'},
-        {"help", no_argument, 0, 'h'},
-        {0, 0, 0, 0},
+        {"timeout", required_argument, NULL, 't'},
+        {"verbose", optional_argument, NULL, 'v'},
+        {"help", no_argument, NULL, 'h'},
+        {NULL, 0, NULL, 0},
     };
     char *short_options = long_options_to_short_options(long_options);
 
index 742603bda999152bf5071697100259545cb9e8be..27fbe5e69fe539b810ffa71893d558044788cfe3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -109,7 +109,7 @@ parse_command_line(int argc, char *argv[])
         {"execute", no_argument, NULL, 'e'},
         {"help", no_argument, NULL, 'h'},
         {"version", no_argument, NULL, 'V'},
-        {0, 0, 0, 0},
+        {NULL, 0, NULL, 0},
     };
     const char *target;
     int e_options;
index 3844666fbf309f9df134100ffb7f9743c7d47416..66cc7ea02e53585ab22a9e040876580706573b36 100644 (file)
@@ -310,23 +310,23 @@ parse_options(int argc, char *argv[])
         DAEMON_OPTION_ENUMS
     };
     static struct option long_options[] = {
-        {"hub",         no_argument, 0, 'H'},
-        {"noflow",      no_argument, 0, 'n'},
-        {"normal",      no_argument, 0, 'N'},
-        {"wildcard",    no_argument, 0, 'w'},
-        {"max-idle",    required_argument, 0, OPT_MAX_IDLE},
-        {"mute",        no_argument, 0, OPT_MUTE},
-        {"queue",       required_argument, 0, 'q'},
-        {"port-queue",  required_argument, 0, 'Q'},
-        {"with-flows",  required_argument, 0, OPT_WITH_FLOWS},
-        {"unixctl",     required_argument, 0, OPT_UNIXCTL},
-        {"help",        no_argument, 0, 'h'},
-        {"version",     no_argument, 0, 'V'},
+        {"hub",         no_argument, NULL, 'H'},
+        {"noflow",      no_argument, NULL, 'n'},
+        {"normal",      no_argument, NULL, 'N'},
+        {"wildcard",    no_argument, NULL, 'w'},
+        {"max-idle",    required_argument, NULL, OPT_MAX_IDLE},
+        {"mute",        no_argument, NULL, OPT_MUTE},
+        {"queue",       required_argument, NULL, 'q'},
+        {"port-queue",  required_argument, NULL, 'Q'},
+        {"with-flows",  required_argument, NULL, OPT_WITH_FLOWS},
+        {"unixctl",     required_argument, NULL, OPT_UNIXCTL},
+        {"help",        no_argument, NULL, 'h'},
+        {"version",     no_argument, NULL, 'V'},
         DAEMON_LONG_OPTIONS,
         VLOG_LONG_OPTIONS,
         STREAM_SSL_LONG_OPTIONS,
-        {"peer-ca-cert", required_argument, 0, OPT_PEER_CA_CERT},
-        {0, 0, 0, 0},
+        {"peer-ca-cert", required_argument, NULL, OPT_PEER_CA_CERT},
+        {NULL, 0, NULL, 0},
     };
     char *short_options = long_options_to_short_options(long_options);
 
index 2d0ec1267fbd1a18bb04fb9b13311caad7f29873..c7350e5c4433a947c9ba244e79dd6879532979de 100644 (file)
@@ -71,12 +71,12 @@ parse_options(int argc, char *argv[])
         VLOG_OPTION_ENUMS
     };
     static struct option long_options[] = {
-        {"statistics", no_argument, 0, 's'},
-        {"timeout", required_argument, 0, 't'},
-        {"help", no_argument, 0, 'h'},
-        {"version", no_argument, 0, 'V'},
+        {"statistics", no_argument, NULL, 's'},
+        {"timeout", required_argument, NULL, 't'},
+        {"help", no_argument, NULL, 'h'},
+        {"version", no_argument, NULL, 'V'},
         VLOG_LONG_OPTIONS,
-        {0, 0, 0, 0},
+        {NULL, 0, NULL, 0},
     };
     char *short_options = long_options_to_short_options(long_options);
 
index 6c2ca176681c4be2680786e7b9d3053c8dcb8c64..e1f365b133a17e24737fa42b328b29a07a8cc58c 100644 (file)
@@ -85,15 +85,15 @@ parse_options(int argc, char *argv[])
         VLOG_OPTION_ENUMS
     };
     static struct option long_options[] = {
-        {"timeout", required_argument, 0, 't'},
-        {"strict", no_argument, 0, OPT_STRICT},
-        {"flow-format", required_argument, 0, 'F'},
-        {"more", no_argument, 0, 'm'},
-        {"help", no_argument, 0, 'h'},
-        {"version", no_argument, 0, 'V'},
+        {"timeout", required_argument, NULL, 't'},
+        {"strict", no_argument, NULL, OPT_STRICT},
+        {"flow-format", required_argument, NULL, 'F'},
+        {"more", no_argument, NULL, 'm'},
+        {"help", no_argument, NULL, 'h'},
+        {"version", no_argument, NULL, 'V'},
         VLOG_LONG_OPTIONS,
         STREAM_SSL_LONG_OPTIONS,
-        {0, 0, 0, 0},
+        {NULL, 0, NULL, 0},
     };
     char *short_options = long_options_to_short_options(long_options);
 
index 33ebc68151b6d99f7993959d8c376a69afa260a1..aab5a2b077fa5f92d82621f6513d95eb905ede0e 100644 (file)
@@ -249,37 +249,37 @@ parse_options(int argc, char *argv[], struct ofsettings *s)
         DAEMON_OPTION_ENUMS
     };
     static struct option long_options[] = {
-        {"datapath-id", required_argument, 0, OPT_DATAPATH_ID},
-        {"mfr-desc", required_argument, 0, OPT_MFR_DESC},
-        {"hw-desc", required_argument, 0, OPT_HW_DESC},
-        {"sw-desc", required_argument, 0, OPT_SW_DESC},
-        {"serial-desc", required_argument, 0, OPT_SERIAL_DESC},
-        {"dp-desc", required_argument, 0, OPT_DP_DESC},
-        {"config",      required_argument, 0, 'F'},
-        {"br-name",     required_argument, 0, OPT_BR_NAME},
-        {"fail",        required_argument, 0, OPT_FAIL_MODE},
-        {"inactivity-probe", required_argument, 0, OPT_INACTIVITY_PROBE},
-        {"max-idle",    required_argument, 0, OPT_MAX_IDLE},
-        {"max-backoff", required_argument, 0, OPT_MAX_BACKOFF},
-        {"listen",      required_argument, 0, 'l'},
-        {"snoop",      required_argument, 0, OPT_SNOOP},
-        {"rate-limit",  optional_argument, 0, OPT_RATE_LIMIT},
-        {"burst-limit", required_argument, 0, OPT_BURST_LIMIT},
-        {"out-of-band", no_argument, 0, OPT_OUT_OF_BAND},
-        {"in-band",     no_argument, 0, OPT_IN_BAND},
-        {"netflow",     required_argument, 0, OPT_NETFLOW},
-        {"ports",       required_argument, 0, OPT_PORTS},
-        {"unixctl",     required_argument, 0, OPT_UNIXCTL},
-        {"enable-dummy", no_argument, 0, OPT_ENABLE_DUMMY},
-        {"verbose",     optional_argument, 0, 'v'},
-        {"help",        no_argument, 0, 'h'},
-        {"version",     no_argument, 0, 'V'},
+        {"datapath-id", required_argument, NULL, OPT_DATAPATH_ID},
+        {"mfr-desc", required_argument, NULL, OPT_MFR_DESC},
+        {"hw-desc", required_argument, NULL, OPT_HW_DESC},
+        {"sw-desc", required_argument, NULL, OPT_SW_DESC},
+        {"serial-desc", required_argument, NULL, OPT_SERIAL_DESC},
+        {"dp-desc", required_argument, NULL, OPT_DP_DESC},
+        {"config",      required_argument, NULL, 'F'},
+        {"br-name",     required_argument, NULL, OPT_BR_NAME},
+        {"fail",        required_argument, NULL, OPT_FAIL_MODE},
+        {"inactivity-probe", required_argument, NULL, OPT_INACTIVITY_PROBE},
+        {"max-idle",    required_argument, NULL, OPT_MAX_IDLE},
+        {"max-backoff", required_argument, NULL, OPT_MAX_BACKOFF},
+        {"listen",      required_argument, NULL, 'l'},
+        {"snoop",      required_argument, NULL, OPT_SNOOP},
+        {"rate-limit",  optional_argument, NULL, OPT_RATE_LIMIT},
+        {"burst-limit", required_argument, NULL, OPT_BURST_LIMIT},
+        {"out-of-band", no_argument, NULL, OPT_OUT_OF_BAND},
+        {"in-band",     no_argument, NULL, OPT_IN_BAND},
+        {"netflow",     required_argument, NULL, OPT_NETFLOW},
+        {"ports",       required_argument, NULL, OPT_PORTS},
+        {"unixctl",     required_argument, NULL, OPT_UNIXCTL},
+        {"enable-dummy", no_argument, NULL, OPT_ENABLE_DUMMY},
+        {"verbose",     optional_argument, NULL, 'v'},
+        {"help",        no_argument, NULL, 'h'},
+        {"version",     no_argument, NULL, 'V'},
         DAEMON_LONG_OPTIONS,
         VLOG_LONG_OPTIONS,
         LEAK_CHECKER_LONG_OPTIONS,
         STREAM_SSL_LONG_OPTIONS,
-        {"bootstrap-ca-cert", required_argument, 0, OPT_BOOTSTRAP_CA_CERT},
-        {0, 0, 0, 0},
+        {"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT},
+        {NULL, 0, NULL, 0},
     };
     char *short_options = long_options_to_short_options(long_options);
     struct ofproto_controller controller_opts;
index 54316ddc7db17d68d4524b83df6782d4da67ebb4..309d64e2a687d062b178635f7d8cdb9fa79d4123 100644 (file)
@@ -113,7 +113,7 @@ parse_options(int argc, char *argv[])
     static const struct option long_options[] = {
         {"help", no_argument, NULL, 'h'},
         {"version", no_argument, NULL, 'V'},
-        {0, 0, 0, 0},
+        {NULL, 0, NULL, 0},
     };
     char *short_options = long_options_to_short_options(long_options);
 
index 851696650e51a5659c5cdf5116d20e8353caea55..780d242772790b73315bdc6aae3630dbce18ccee 100644 (file)
@@ -207,19 +207,19 @@ parse_options(int argc, char *argv[])
         TABLE_OPTION_ENUMS
     };
     static struct option long_options[] = {
-        {"db", required_argument, 0, OPT_DB},
-        {"no-syslog", no_argument, 0, OPT_NO_SYSLOG},
-        {"no-wait", no_argument, 0, OPT_NO_WAIT},
-        {"dry-run", no_argument, 0, OPT_DRY_RUN},
-        {"oneline", no_argument, 0, OPT_ONELINE},
-        {"timeout", required_argument, 0, 't'},
-        {"help", no_argument, 0, 'h'},
-        {"version", no_argument, 0, 'V'},
+        {"db", required_argument, NULL, OPT_DB},
+        {"no-syslog", no_argument, NULL, OPT_NO_SYSLOG},
+        {"no-wait", no_argument, NULL, OPT_NO_WAIT},
+        {"dry-run", no_argument, NULL, OPT_DRY_RUN},
+        {"oneline", no_argument, NULL, OPT_ONELINE},
+        {"timeout", required_argument, NULL, 't'},
+        {"help", no_argument, NULL, 'h'},
+        {"version", no_argument, NULL, 'V'},
         VLOG_LONG_OPTIONS,
         TABLE_LONG_OPTIONS,
         STREAM_SSL_LONG_OPTIONS,
-        {"peer-ca-cert", required_argument, 0, OPT_PEER_CA_CERT},
-        {0, 0, 0, 0},
+        {"peer-ca-cert", required_argument, NULL, OPT_PEER_CA_CERT},
+        {NULL, 0, NULL, 0},
     };
     char *tmp, *short_options;
 
@@ -1111,7 +1111,7 @@ cmd_emer_reset(struct vsctl_context *ctx)
 static void
 cmd_add_br(struct vsctl_context *ctx)
 {
-    bool may_exist = shash_find(&ctx->options, "--may-exist") != 0;
+    bool may_exist = shash_find(&ctx->options, "--may-exist") != NULL;
     const char *br_name, *parent_name;
     struct vsctl_info info;
     int vlan;
@@ -1563,7 +1563,7 @@ add_port(struct vsctl_context *ctx,
 static void
 cmd_add_port(struct vsctl_context *ctx)
 {
-    bool may_exist = shash_find(&ctx->options, "--may-exist") != 0;
+    bool may_exist = shash_find(&ctx->options, "--may-exist") != NULL;
 
     add_port(ctx, ctx->argv[1], ctx->argv[2], may_exist, false,
              &ctx->argv[2], 1, &ctx->argv[3], ctx->argc - 3);
@@ -1572,7 +1572,7 @@ cmd_add_port(struct vsctl_context *ctx)
 static void
 cmd_add_bond(struct vsctl_context *ctx)
 {
-    bool may_exist = shash_find(&ctx->options, "--may-exist") != 0;
+    bool may_exist = shash_find(&ctx->options, "--may-exist") != NULL;
     bool fake_iface = shash_find(&ctx->options, "--fake-iface");
     int n_ifaces;
     int i;
index 9d5cdfb13d2686cdd9cd2dcddd3eba7da3eaea8e..973b098b2f1e43303964d28f146e5be0f18f9450 100644 (file)
@@ -1398,14 +1398,14 @@ parse_options(int argc, char *argv[])
         DAEMON_OPTION_ENUMS
     };
     static struct option long_options[] = {
-        {"help",             no_argument, 0, 'h'},
-        {"version",          no_argument, 0, 'V'},
-        {"prune-timeout",    required_argument, 0, OPT_PRUNE_TIMEOUT},
-        {"appctl-command",   required_argument, 0, OPT_APPCTL_COMMAND},
+        {"help",             no_argument, NULL, 'h'},
+        {"version",          no_argument, NULL, 'V'},
+        {"prune-timeout",    required_argument, NULL, OPT_PRUNE_TIMEOUT},
+        {"appctl-command",   required_argument, NULL, OPT_APPCTL_COMMAND},
         DAEMON_LONG_OPTIONS,
         VLOG_LONG_OPTIONS,
         LEAK_CHECKER_LONG_OPTIONS,
-        {0, 0, 0, 0},
+        {NULL, 0, NULL, 0},
     };
     char *short_options = long_options_to_short_options(long_options);
 
index 626cba4f63fa0a0ee8da69d1fa6e8ba87e9fcb6a..441dfb2255eb63ca4d40373fd6d2decb51412d7e 100644 (file)
@@ -122,17 +122,17 @@ parse_options(int argc, char *argv[])
         DAEMON_OPTION_ENUMS
     };
     static struct option long_options[] = {
-        {"help",        no_argument, 0, 'h'},
-        {"version",     no_argument, 0, 'V'},
-        {"mlockall",    no_argument, 0, OPT_MLOCKALL},
+        {"help",        no_argument, NULL, 'h'},
+        {"version",     no_argument, NULL, 'V'},
+        {"mlockall",    no_argument, NULL, OPT_MLOCKALL},
         DAEMON_LONG_OPTIONS,
         VLOG_LONG_OPTIONS,
         LEAK_CHECKER_LONG_OPTIONS,
         STREAM_SSL_LONG_OPTIONS,
-        {"peer-ca-cert", required_argument, 0, OPT_PEER_CA_CERT},
-        {"bootstrap-ca-cert", required_argument, 0, OPT_BOOTSTRAP_CA_CERT},
-        {"enable-dummy", no_argument, 0, OPT_ENABLE_DUMMY},
-        {0, 0, 0, 0},
+        {"peer-ca-cert", required_argument, NULL, OPT_PEER_CA_CERT},
+        {"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT},
+        {"enable-dummy", no_argument, NULL, OPT_ENABLE_DUMMY},
+        {NULL, 0, NULL, 0},
     };
     char *short_options = long_options_to_short_options(long_options);