Skip to content

Commit 78fbdbb

Browse files
committed
Avoid unnecessary recursion in find_path_start_and_type()
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 0b2d287 commit 78fbdbb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

winsup/cygwin/msys2_path_conv.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,10 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en
341341

342342
if (*it == '\0' || it == end) return NONE;
343343

344-
if (!isalnum(*it) && *it != '/' && *it != '\\' && *it != ':' && *it != '-' && *it != '.') {
345-
return find_path_start_and_type(move(src, 1), true, end);
344+
while (!isalnum(*it) && *it != '/' && *it != '\\' && *it != ':' && *it != '-' && *it != '.') {
345+
recurse = true;
346+
it = ++*src;
347+
if (it == end || *it == '\0') return NONE;
346348
}
347349

348350
path_type result = NONE;

0 commit comments

Comments
 (0)