Re: [PATCH 2/4] refs.c: refactor resolve_ref_unsafe() to use strbuf internally From: Junio C Hamano <hidden> Date: 2016-06-15 23:02:05 Eric Sunshine [off-list ref] writes: quoted char *resolve_refdup(const char *ref, unsigned char *sha1, int reading, int *flag) { - const char *ret = resolve_ref_unsafe(ref, sha1, reading, flag); - return ret ? xstrdup(ret) : NULL; + struct strbuf buf = STRBUF_INIT; + if (!resolve_ref(ref, &buf, sha1, reading, flag)) + return buf.buf; return strbuf_detach(&buf, NULL); Yeah, the end result is the same, but it is a very good discipline.
Keyboard shortcuts hback out one level jnext message in thread kprevious message in thread ldrill in Escclose help / fold thread tree ?toggle this help