Commit 29f72aa63844967cfd56d2edce804af243ef3ddd

nulltoken 2012-07-04T22:02:54

revparse: leverage git__isdigit()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/src/revparse.c b/src/revparse.c
index f5cf93b..3b9b2c9 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -115,10 +115,11 @@ static int revparse_lookup_object(git_object **out, git_repository *repo, const 
 
 static int all_chars_are_digits(const char *str, size_t len)
 {
-	size_t i=0;
-	for (i=0; i<len; i++) {
-		if (str[i] < '0' || str[i] > '9') return 0;
-	}
+	size_t i = 0;
+
+	for (i = 0; i < len; i++)
+		if (!git__isdigit(str[i])) return 0;
+
 	return 1;
 }