]> granicus.if.org Git - python/commitdiff
Issue #28152: Fix -Wunreachable-code warning on clang
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 5 Dec 2016 16:55:36 +0000 (17:55 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 5 Dec 2016 16:55:36 +0000 (17:55 +0100)
Replace C if() with precompiler #if to fix a warning on dead code when using
clang.

Modules/zipimport.c

index 59046aaae41f51240baa94e16c749ec539629280..950e4f4a28ac48b26dc05263a9e6c44ee383ab4c 100644 (file)
@@ -998,13 +998,13 @@ read_directory(PyObject *archive)
             goto file_error;
         }
         name[name_size] = '\0';  /* Add terminating null byte */
-        if (SEP != '/') {
-            for (i = 0; i < name_size; i++) {
-                if (name[i] == '/') {
-                    name[i] = SEP;
-                }
+#if SEP != '/'
+        for (i = 0; i < name_size; i++) {
+            if (name[i] == '/') {
+                name[i] = SEP;
             }
         }
+#endif
         /* Skip the rest of the header.
          * On Windows, calling fseek to skip over the fields we don't use is
          * slower than reading the data because fseek flushes stdio's