From 6d8d3f195c9377a1fdb3cbde32ec4a677d93b588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= Date: Fri, 30 Sep 2011 19:41:29 +0200 Subject: [PATCH] oid: optimize git_oid_fromstrn by using memset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: J. David Ibáñez --- src/oid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/oid.c b/src/oid.c index 2adaadcbd..1f7227410 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; }