summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-06-22 14:15:21 -0700
committerJunio C Hamano <gitster@pobox.com>2017-06-22 14:15:21 -0700
commit52ab95cfea15ae8a60fb4febc99d54034c8800b8 (patch)
treeba06be7965dcd1ed226dab1cbb3cf70818bb187d /dir.c
parent46f32fb92c72a877d87af6435f1b4d653a860e2e (diff)
parente0556a928fdba489307d13d8d4c4d2a461fbc3ad (diff)
downloadgit-52ab95cfea15ae8a60fb4febc99d54034c8800b8.tar.gz
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()
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/dir.c b/dir.c
index 1759063817..5f1afb56bc 100644
--- a/dir.c
+++ b/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);