summaryrefslogtreecommitdiff
path: root/dir.h
diff options
context:
space:
mode:
authorAlexander Potashev <aspotashev@gmail.com>2009-01-10 12:07:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-01-11 21:21:57 (GMT)
commit8ca12c0d62c0be4a4987c4a936467ea2a92e915a (patch)
tree42b4cafd04bbbdfa90a38b6a49396cd3b06a97db /dir.h
parentc123b7c5fb596d93cd015645212c379fc3c381d5 (diff)
downloadgit-8ca12c0d62c0be4a4987c4a936467ea2a92e915a.zip
git-8ca12c0d62c0be4a4987c4a936467ea2a92e915a.tar.gz
git-8ca12c0d62c0be4a4987c4a936467ea2a92e915a.tar.bz2
add is_dot_or_dotdot inline function
A new inline function is_dot_or_dotdot is used to check if the directory name is either "." or "..". It returns a non-zero value if the given string is "." or "..". It's applicable to a lot of Git source code. Signed-off-by: Alexander Potashev <aspotashev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.h')
-rw-r--r--dir.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/dir.h b/dir.h
index 768425a..02875ec 100644
--- a/dir.h
+++ b/dir.h
@@ -77,6 +77,13 @@ extern int file_exists(const char *);
extern char *get_relative_cwd(char *buffer, int size, const char *dir);
extern int is_inside_dir(const char *dir);
+static inline int is_dot_or_dotdot(const char *name)
+{
+ return (name[0] == '.' &&
+ (name[1] == '\0' ||
+ (name[1] == '.' && name[2] == '\0')));
+}
+
extern void setup_standard_excludes(struct dir_struct *dir);
extern int remove_dir_recursively(struct strbuf *path, int only_empty);