Use strchr in \ conversion in CanonicalizePath on Windows
authorScott Graham <scottmg@chromium.org>
Thu, 30 Oct 2014 23:52:55 +0000 (16:52 -0700)
committerScott Graham <scottmg@chromium.org>
Thu, 30 Oct 2014 23:52:55 +0000 (16:52 -0700)
src/util.cc

index 66ef113..cb8adf1 100644 (file)
@@ -107,9 +107,8 @@ bool CanonicalizePath(char* path, size_t* len, string* err) {
   }
 
 #ifdef _WIN32
-  for (char* c = path; *c; ++c)
-    if (*c == '\\')
-      *c = '/';
+  for (char* c = path; (c = strchr(c, '\\')) != NULL;)
+    *c = '/';
 #endif
 
   const int kMaxPathComponents = 30;