Commit d5712ed2b33a18a4f9417d112bda7813c0570caa

Carlos Martín Nieto 2015-01-15T14:57:37

Merge pull request #2821 from maksqwe/strlen_optimization Remove strlen() calls from loop condition

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/util.h b/src/util.h
index dafb740..89816a8 100644
--- a/src/util.h
+++ b/src/util.h
@@ -277,7 +277,7 @@ GIT_INLINE(int) git__fromhex(char h)
 GIT_INLINE(int) git__ishex(const char *str)
 {
 	unsigned i;
-	for (i=0; i<strlen(str); i++)
+	for (i=0; str[i] != '\0'; i++)
 		if (git__fromhex(str[i]) < 0)
 			return 0;
 	return 1;