[tor-commits] [tor/master] Fix build warning on Lenny about strtok_r unit test

nickm at torproject.org nickm at torproject.org
Mon Jun 4 15:11:10 UTC 2012


commit 75b72bf62122c74f4c0c193e9364928aecdba695
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Jun 4 11:07:52 2012 -0400

    Fix build warning on Lenny about strtok_r unit test
    
    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 |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index e052692..0d132ee 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -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 = " ";



More information about the tor-commits mailing list