summaryrefslogtreecommitdiff
path: root/builtin-count-objects.c
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 /builtin-count-objects.c
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 'builtin-count-objects.c')
-rw-r--r--builtin-count-objects.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin-count-objects.c b/builtin-count-objects.c
index ab35b65..62fd1f0 100644
--- a/builtin-count-objects.c
+++ b/builtin-count-objects.c
@@ -5,6 +5,7 @@
*/
#include "cache.h"
+#include "dir.h"
#include "builtin.h"
#include "parse-options.h"
@@ -21,9 +22,7 @@ static void count_objects(DIR *d, char *path, int len, int verbose,
const char *cp;
int bad = 0;
- if ((ent->d_name[0] == '.') &&
- (ent->d_name[1] == 0 ||
- ((ent->d_name[1] == '.') && (ent->d_name[2] == 0))))
+ if (is_dot_or_dotdot(ent->d_name))
continue;
for (cp = ent->d_name; *cp; cp++) {
int ch = *cp;