resolve_ref_1(): eliminate local variable
In place of `buf`, use `refname`, which is anyway a better description of what is being pointed at. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Apr 7, 2016 at 15:02 UTC
90c28ae11c5a9d8386606c727be1d80699c9aa92
1 file changed
+6
-7
refs/files-backend.c
+6
-7
@@ -1426,7 +1426,6 @@ static const char *resolve_ref_1(const char *refname,
1426
for (symref_count = 0; symref_count < MAXDEPTH; symref_count++) {
1427
const char *path;
1428
struct stat st;
1429
- char *buf;
1429
int fd;
1430
1431
strbuf_reset(sb_path);
@@ -1532,21 +1531,21 @@ static const char *resolve_ref_1(const char *refname,
1531
return refname;
1532
}
1533
*flags |= REF_ISSYMREF;
1535
- buf = sb_contents->buf + 4;
1536
- while (isspace(*buf))
1537
- buf++;
1534
+ refname = sb_contents->buf + 4;
1535
+ while (isspace(*refname))
1536
+ refname++;
1537
strbuf_reset(sb_refname);
1539
- strbuf_addstr(sb_refname, buf);
1538
+ strbuf_addstr(sb_refname, refname);
1539
refname = sb_refname->buf;
1540
if (resolve_flags & RESOLVE_REF_NO_RECURSE) {
1541
hashclr(sha1);
1542
return refname;
1543
}
1545
- if (check_refname_format(buf, REFNAME_ALLOW_ONELEVEL)) {
1544
+ if (check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) {
1545
*flags |= REF_ISBROKEN;
1546
1547
if (!(resolve_flags & RESOLVE_REF_ALLOW_BAD_NAME) ||
1549
- !refname_is_safe(buf)) {
1548
+ !refname_is_safe(refname)) {
1549
errno = EINVAL;
1550
return NULL;
1551
}