Re: [PATCHv4] pretty: Initialize notes if %N is used

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

 



Johannes Gilger <heipei@xxxxxxxxxxxx> writes:

> +void userformat_find_requirements(const char *fmt, struct userformat_want *w)
> +{
> +	struct strbuf dummy = STRBUF_INIT;
> +
> +	memset(w, 0, sizeof(*w));
> +	if (!fmt) {
> +		if (!user_format)
> +			return;
> +		fmt = user_format;
> +	}
> +	strbuf_expand(&dummy, user_format, userformat_want_item, w);
> +	strbuf_release(&dummy);
> +}

It does not matter for the current set of callers, but it might make sense
to make it the responsibility of the caller to clear *w instead of
unconditionally clearing what have been accumulated in there by previous
calls to this function.  It is not entirely implausible for a new caller
to have more than one user formats, it uses one or more on the same commit
depending on the context, and wants to find all the requirements by
feeding the possible formats upfront to this function to fill a single *w
structure.
--
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]