Merge branch 'pc/dir-count-slashes'
Three instances of the same helper function have been consolidated to one. * pc/dir-count-slashes: dir: create function count_slashes()
This commit is contained in:
9
dir.c
9
dir.c
@ -52,6 +52,15 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
|
||||
static int get_dtype(struct dirent *de, struct index_state *istate,
|
||||
const char *path, int len);
|
||||
|
||||
int count_slashes(const char *s)
|
||||
{
|
||||
int cnt = 0;
|
||||
while (*s)
|
||||
if (*s++ == '/')
|
||||
cnt++;
|
||||
return cnt;
|
||||
}
|
||||
|
||||
int fspathcmp(const char *a, const char *b)
|
||||
{
|
||||
return ignore_case ? strcasecmp(a, b) : strcmp(a, b);
|
||||
|
Reference in New Issue
Block a user