[ovs-discuss] [PATCH 1/3] Cleanup warnings about "save_ptr" in strtok_r argument

Justin Pettit jpettit at nicira.com
Wed Jul 29 22:52:53 UTC 2009


The compiler warns about the "save_ptr" argument to strtok_r being
unitialized.  This cleans that up.
---
 lib/vconn-ssl.c   |    3 ++-
 lib/vconn-tcp.c   |    2 +-
 lib/vlog.c        |    2 +-
 secchan/netflow.c |    2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/vconn-ssl.c b/lib/vconn-ssl.c
index ef1b564..f681bdf 100644
--- a/lib/vconn-ssl.c
+++ b/lib/vconn-ssl.c
@@ -280,7 +280,8 @@ ssl_vconn_cast(struct vconn *vconn)
 static int
 ssl_open(const char *name, char *suffix, struct vconn **vconnp)
 {
-    char *save_ptr, *host_name, *port_string;
+    char *save_ptr = NULL;
+    char *host_name, *port_string;
     struct sockaddr_in sin;
     int retval;
     int fd;
diff --git a/lib/vconn-tcp.c b/lib/vconn-tcp.c
index a91b7d3..1161713 100644
--- a/lib/vconn-tcp.c
+++ b/lib/vconn-tcp.c
@@ -72,7 +72,7 @@ new_tcp_vconn(const char *name, int fd, int connect_status,
 static int
 tcp_open(const char *name, char *suffix, struct vconn **vconnp)
 {
-    char *save_ptr;
+    char *save_ptr = NULL;
     const char *host_name;
     const char *port_string;
     struct sockaddr_in sin;
diff --git a/lib/vlog.c b/lib/vlog.c
index 97a930a..1b95d96 100644
--- a/lib/vlog.c
+++ b/lib/vlog.c
@@ -314,7 +314,7 @@ vlog_reopen_log_file(void)
 char *
 vlog_set_levels_from_string(const char *s_)
 {
-    char *save_ptr;
+    char *save_ptr = NULL;
     char *s = xstrdup(s_);
     char *module, *facility;
 
diff --git a/secchan/netflow.c b/secchan/netflow.c
index e867c0e..0162c45 100644
--- a/secchan/netflow.c
+++ b/secchan/netflow.c
@@ -107,7 +107,7 @@ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
 static int
 open_collector(char *dst)
 {
-    char *save_ptr;
+    char *save_ptr = NULL;
     const char *host_name;
     const char *port_string;
     struct sockaddr_in sin;
-- 
1.6.3.1





More information about the discuss mailing list