]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix build warning on Lenny about strtok_r unit test
authorNick Mathewson <nickm@torproject.org>
Mon, 4 Jun 2012 15:07:52 +0000 (11:07 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 4 Jun 2012 15:11:04 +0000 (11:11 -0400)
This fixes a warning in efb8a09f, where Debain Lenny's GCC doesn't get
that
    for (i=0; i<3; ++i) {
      const char *p;
      switch(i) {
       case 0:
         p="X"; break;
       case 1:
         p="Y"; break;
       case 2:
         p="Z"; break;
      }
      printf("%s\n", p);
    }
will never try to print an uninitialezed value.

Found by buildbots.  Bug in no released versions of Tor.

src/test/test_util.c

index e05269252b71b57fd89f37700ced37da6b6a7bc3..0d132ee8c83dbce1546f8bac6d63f4702e5bc9ec 100644 (file)
@@ -1826,10 +1826,9 @@ test_util_strtok(void)
   char *cp1, *cp2;
 
   for (i = 0; i < 3; i++) {
-    const char *pad1, *pad2;
+    const char *pad1="", *pad2="";
     switch (i) {
     case 0:
-      pad1 = pad2 = "";
       break;
     case 1:
       pad1 = " ";