On 05/13, Stefan Beller wrote:
> In the following patches we'll convert all printing functions to use
> the emit_line_* family of functions.
> 
> Many of the printing functions to be converted are formatted. So offer
> a formatted function in the emit_line function family as well.
> 
> Signed-off-by: Stefan Beller <sbel...@google.com>
> ---
>  diff.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/diff.c b/diff.c
> index 48f0fb98dc..aef159a919 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -552,6 +552,20 @@ static void emit_line(struct diff_options *o, const char 
> *set, const char *reset
>       emit_line_0(o, set, reset, 0, line, len);
>  }
>  
> +static void emit_line_fmt(struct diff_options *o,
> +                       const char *set, const char *reset,
> +                       const char *fmt, ...)
> +{
> +     struct strbuf sb = STRBUF_INIT;
> +     va_list ap;
> +     va_start(ap, fmt);
> +     strbuf_vaddf(&sb, fmt, ap);
> +     va_end(ap);
> +
> +     emit_line(o, set, reset, sb.buf, sb.len);
> +     strbuf_release(&sb);
> +}
> +
>  static int new_blank_line_at_eof(struct emit_callback *ecbdata, const char 
> *line, int len)
>  {
>       if (!((ecbdata->ws_rule & WS_BLANK_AT_EOF) &&
> -- 
> 2.13.0.18.g183880de0a
> 

Since this is a new function, and it is marked static, this patch
shouldn't compile or the compiler should throw a warning or something.

-- 
Brandon Williams

Reply via email to