Commit 6d8d3f195c9377a1fdb3cbde32ec4a677d93b588

J. David Ibáñez 2011-09-30T19:41:29

oid: optimize git_oid_fromstrn by using memset Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/oid.c b/src/oid.c
index 2adaadc..1f72274 100644
--- a/src/oid.c
+++ b/src/oid.c
@@ -55,8 +55,7 @@ int git_oid_fromstrn(git_oid *out, const char *str, size_t length)
 		p += 2;
 	}
 
-	for (; p < GIT_OID_HEXSZ; p += 2)
-		out->id[p / 2] = 0x0;
+	memset(out->id + p / 2, 0, (GIT_OID_HEXSZ - p) / 2);
 
 	return GIT_SUCCESS;
 }