Re: [RFC PATCH 2/3] strbuf_commented_addf(): drop the comment_line_char parameter

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

 



Jonathan Tan <jonathantanmy@xxxxxxxxxx> writes:

> From: Junio C Hamano <gitster@xxxxxxxxx>
>
> All the callers of this function supply the global variable
> comment_line_char as an argument to its second parameter.  Remove
> the parameter to allow us in the future to change the reference to
> the global variable with something else, like a function call.
>
> Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
> Signed-off-by: Jonathan Tan <jonathantanmy@xxxxxxxxxx>
> ---

> diff --git a/environment.c b/environment.c
> index bb3c2a96a3..d9f64cffa0 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -416,3 +416,21 @@ int print_sha1_ellipsis(void)
>  	}
>  	return cached_result;
>  }
> +
> +void strbuf_commented_addf(struct strbuf *sb,
> +			   const char *fmt, ...)
> +{
> +	va_list params;
> +	struct strbuf buf = STRBUF_INIT;
> +	int incomplete_line = sb->len && sb->buf[sb->len - 1] != '\n';
> +
> +	va_start(params, fmt);
> +	strbuf_vaddf(&buf, fmt, params);
> +	va_end(params);
> +
> +	strbuf_add_commented_lines(sb, buf.buf, buf.len, comment_line_char);
> +	if (incomplete_line)
> +		sb->buf[--sb->len] = '\0';
> +
> +	strbuf_release(&buf);
> +}

This moving of the helper function does not belong to the "fix
commented_addf() not to take the comment_line_char" step.

The series should be restructured to have the two patches from me
first, and then your moving some stuff to environment.c, probably.




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

  Powered by Linux