diff options
Diffstat (limited to 'src/util.cc')
-rw-r--r-- | src/util.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/util.cc b/src/util.cc index de535b3..49b079c 100644 --- a/src/util.cc +++ b/src/util.cc @@ -143,13 +143,9 @@ bool CanonicalizePath(char* path, int* len, string* err) { components[component_count] = dst; ++component_count; - const char* sep = (const char*)memchr(src, '/', end - src); - if (sep == NULL) - sep = end; - while (src <= sep) { + while (*src != '/' && src != end) *dst++ = *src++; - } - src = sep + 1; + *dst++ = *src++; // Copy '/' or final \0 character as well. } if (dst == start) { |