Eric Sunshine <sunsh...@sunshineco.com> writes:

>>  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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to