path: root/dir.h
diff options
authorPrathamesh Chavan <>2017-06-08 18:08:12 (GMT)
committerJunio C Hamano <>2017-06-12 20:26:55 (GMT)
commite0556a928fdba489307d13d8d4c4d2a461fbc3ad (patch)
treef460fa671a19aa903c800cc611b9e7ed5ba1f304 /dir.h
parentb06d3643105c8758ed019125a4399cb7efdcce2c (diff)
dir: create function count_slashes()
Similar functions exist in apply.c and builtin/show-branch.c for counting the number of slashes in a string. Also in the later patches, we introduce a third caller for the same. Hence, we unify it now by cleaning the existing functions and declaring a common function count_slashes in dir.h and implementing it in dir.c to remove this code duplication. Mentored-by: Christian Couder <> Mentored-by: Stefan Beller <> Signed-off-by: Junio C Hamano <> Signed-off-by: Prathamesh Chavan <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'dir.h')
1 files changed, 3 insertions, 0 deletions
diff --git a/dir.h b/dir.h
index bf23a47..bdeeab7 100644
--- a/dir.h
+++ b/dir.h
@@ -196,6 +196,9 @@ struct dir_struct {
unsigned unmanaged_exclude_files;
+/*Count the number of slashes for string s*/
+extern int count_slashes(const char *s);
* The ordering of these constants is significant, with
* higher-numbered match types signifying "closer" (i.e. more