summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorAlexander Potashev <aspotashev@gmail.com>2009-01-10 15:07:50 +0300
committerJunio C Hamano <gitster@pobox.com>2009-01-11 13:21:57 -0800
commit8ca12c0d62c0be4a4987c4a936467ea2a92e915a (patch)
tree42b4cafd04bbbdfa90a38b6a49396cd3b06a97db /transport.c
parentc123b7c5fb596d93cd015645212c379fc3c381d5 (diff)
downloadgit-8ca12c0d62c0be4a4987c4a936467ea2a92e915a.tar.gz
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 'transport.c')
-rw-r--r--transport.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/transport.c b/transport.c
index 56831c57c5..9ad4a16c31 100644
--- a/transport.c
+++ b/transport.c
@@ -50,9 +50,7 @@ static int read_loose_refs(struct strbuf *path, int name_offset,
memset (&list, 0, sizeof(list));
while ((de = readdir(dir))) {
- if (de->d_name[0] == '.' && (de->d_name[1] == '\0' ||
- (de->d_name[1] == '.' &&
- de->d_name[2] == '\0')))
+ if (is_dot_or_dotdot(de->d_name))
continue;
ALLOC_GROW(list.entries, list.nr + 1, list.alloc);
list.entries[list.nr++] = xstrdup(de->d_name);