From: Michael Haggerty Date: Thu, 15 Sep 2011 21:10:32 +0000 (+0200) Subject: resolve_ref(): use prefixcmp() X-Git-Tag: v1.7.8-rc0~19^2~14 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b54cb795970628714a3a9fa0f4a73cd117b0207f;p=git.git resolve_ref(): use prefixcmp() Terminate the link content string one step earlier, allowing prefixcmp() to be used instead of the less clear memcmp(). Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- diff --git a/refs.c b/refs.c index c51fd45f9..da9737f99 100644 --- a/refs.c +++ b/refs.c @@ -520,8 +520,8 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int * len = readlink(path, buffer, sizeof(buffer)-1); if (len < 0) return NULL; - if (len >= 5 && !memcmp("refs/", buffer, 5)) { - buffer[len] = 0; + buffer[len] = 0; + if (!prefixcmp(buffer, "refs/")) { strcpy(ref_buffer, buffer); ref = ref_buffer; if (flag)