[ovs-dev] [PATCH] Make struct stress_option members const

Simon Horman horms at verge.net.au
Thu Mar 22 06:43:35 UTC 2012


Make the name and description members of struct stress_option
const as they are used to store constant strings.

Signed-off-by: Simon Horman <horms at verge.net.au>

---

$ gcc --version
gcc (Debian 4.6.2-4) 4.6.2
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make
...
lib/netlink-socket.c:294:2: warning: initialization discards ‘const’ qualifier from pointer target type [enabled by default]
lib/netlink-socket.c:294:2: warning: initialization discards ‘const’ qualifier from pointer target type [enabled by default]
---
 lib/stress.h         |    4 ++--
 ovsdb/ovsdb-server.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/stress.h b/lib/stress.h
index 9d6ea97..386db29 100644
--- a/lib/stress.h
+++ b/lib/stress.h
@@ -21,8 +21,8 @@
 
 struct stress_option {
     /* Properties. */
-    char *name;                 /* Short identifier string */
-    char *description;          /* Description of what the option stresses. */
+    const char *name;           /* Short identifier string */
+    const char *description;    /* Description of what the option stresses. */
     unsigned int recommended;   /* Recommended period. */
     unsigned int min;           /* Minimum period that can be set. */
     unsigned int max;           /* Maximum period that can be set. */
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 9e0636e..f79e529 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -118,7 +118,7 @@ main(int argc, char *argv[])
     }
 
     if (run_command) {
-        char *run_argv[4];
+        const char *run_argv[4];
 
         run_argv[0] = "/bin/sh";
         run_argv[1] = "-c";
-- 
1.7.6.3




More information about the dev mailing list