diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2011-09-15 23:10:32 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-05 13:45:30 -0700 |
commit | b54cb795970628714a3a9fa0f4a73cd117b0207f (patch) | |
tree | 820693fa86362579525df41f6f53125df80d7e69 /refs.c | |
parent | 7bb2bf8e5cc47f7731c9c012ecc943b14f99ee5a (diff) | |
download | git-b54cb795970628714a3a9fa0f4a73cd117b0207f.tar.gz |
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 <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) |