Convert resolve_ref+xstrdup to new resolve_refdup function

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2011-12-13 21:17:48 +07:00
committed by Junio C Hamano
parent e4776bd936
commit 96ec7b1e70
12 changed files with 47 additions and 50 deletions

6
refs.c
View File

@ -605,6 +605,12 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
return ref;
}
char *resolve_refdup(const char *ref, unsigned char *sha1, int reading, int *flag)
{
const char *ret = resolve_ref(ref, sha1, reading, flag);
return ret ? xstrdup(ret) : NULL;
}
/* The argument to filter_refs */
struct ref_filter {
const char *pattern;