On Tue, Apr 7, 2009 at 09:44, Jeff King <peff@xxxxxxxx> wrote: > On Tue, Apr 07, 2009 at 09:33:19AM +0200, Bert Wesarg wrote: > >> Now that get_short_ref() always return an malloced string, consolidate to >> one xstrcpy() call. > > Makes sense to squash in on top of what I have. But I think it actually > is pretty easy to always return a pointer into the existing string > (patch based on current master): Yes, thats probably a good idea. The caller can always do a xstrdup(get_short_ref(ref)). > @@ -637,12 +637,14 @@ static char *get_short_ref(struct refinfo *ref) > * short name is non-ambiguous if all previous rules > * haven't resolved to a valid ref > */ > - if (j == i) > - return short_name; > + if (j == i) { > + ref += strlen(ref) - strlen(short_name); we have strlen(short_name) in short_name_len already. Bert -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html