Re: [PATCH 2/8] strbuf: add strbuf_addv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Thu, Feb 24, 2011 at 3:27 PM, Jeff King <peff@xxxxxxxx> wrote:
> +void strbuf_addv(struct strbuf *sb, const char *fmt, va_list ap)
> +{
> +       int len;
> +       va_list cp;
>
>        if (!strbuf_avail(sb))
>                strbuf_grow(sb, 64);
> -       va_start(ap, fmt);
> -       len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
> -       va_end(ap);
> +       va_copy(cp, ap);
> +       len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, cp);
> +       va_end(cp);
>        if (len < 0)
> -               die("your vsnprintf is broken");
> +               die("BUG: your vsnprintf is broken (returned -1)");

Minor nit: why not:

 +               die("BUG: your vsnprintf is broken (returned %d)", len);

Thanks,
Christian.
--
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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]