On Sun, Apr 7, 2013 at 11:30 AM, John Keeping <[email protected]> wrote:
>         /* Prepend repo path to relative readme path unless tracked. */
> -       if (!ref && *ctx.repo->readme != '/')
> -               ctx.repo->readme = xstrdup(fmt("%s/%s", ctx.repo->path,
> -                                              ctx.repo->readme));
> +       if (!ref && *ctx.repo->readme != '/') {
> +               struct strbuf buf = STRBUF_INIT;
> +               strbuf_addf(&buf, "%s/%s", ctx.repo->path, ctx.repo->readme);
> +               ctx.repo->readme = strbuf_detach(&buf, NULL);
> +       }

I do in fact see the merits of using strbuf and the purpose of this
patch set, but OTOH, this little chunk here illustrates the downsides
-- the extra verbosity this adds is really a bummer. Perhaps this
could be moved into a new fmtalloc helper function, if this pattern is
common?

_______________________________________________
cgit mailing list
[email protected]
http://hjemli.net/mailman/listinfo/cgit

Reply via email to