Re: [RFC/PATCH] i18n of multi-line messages

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

 



Am 12/22/2011 8:38, schrieb Junio C Hamano:
> +static void v_format(const char *prefix, const char *fmt, va_list params,
> +		     emit_fn emit, void *cb_data)
> +{
> +	struct strbuf buf = STRBUF_INIT;
> +	struct strbuf line = STRBUF_INIT;
> +	const char *cp, *np;
> +
> +	strbuf_vaddf(&buf, fmt, params);
...
>  void vreportf(const char *prefix, const char *err, va_list params)
>  {
> -	char msg[4096];
> -	vsnprintf(msg, sizeof(msg), err, params);
> -	fprintf(stderr, "%s%s\n", prefix, msg);
> +	v_format(prefix, err, params, emit_report, NULL);
>  }

Using strbuf (or xmalloc for that matter) from a function that can be
called from die() is a big no-no. You should keep the fixed-sized buffer.

-- Hannes
--
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]