Skip to content

Commit

Permalink
lockfile.c: use is_dir_sep() instead of hardcoded '/' checks
Browse files Browse the repository at this point in the history
Signed-off-by: Karsten Blees <blees@dcon.de>
  • Loading branch information
kblees authored and dscho committed Apr 20, 2020
1 parent 4f1bc0c commit 09e19b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lockfile.c
Expand Up @@ -17,14 +17,14 @@ static void trim_last_path_component(struct strbuf *path)
int i = path->len;

/* back up past trailing slashes, if any */
while (i && path->buf[i - 1] == '/')
while (i && is_dir_sep(path->buf[i - 1]))
i--;

/*
* then go backwards until a slash, or the beginning of the
* string
*/
while (i && path->buf[i - 1] != '/')
while (i && !is_dir_sep(path->buf[i - 1]))
i--;

strbuf_setlen(path, i);
Expand Down

0 comments on commit 09e19b8

Please sign in to comment.