Re: [PATCH 01/10] string_list: print_string_list to use trace_printf
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 9, 2018, 21:16 UTC
- Message-ID
- <xmqq7ekzb5qj.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180808221752.195419-2-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
> It is a debugging aid, so it should print to the debugging channel.
Who says? In-tree code may say so, and I do not think any in-flight topic up to 'pu' uses this to produce non-debugging output, but I do not think it is healthy attitude to assume that you can take over an existing function and change what it does unilaterally.
As there is no in-tree or in-flight user, I think it makes sense if the proposed change were to rename it to trace_string_list(). If there weren't any print_string_list() and we were adding a debugging aid to use trace_printf() to dump these, that would be the name we would use anyway.
Show 21 quoted lines
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> string-list.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/string-list.c b/string-list.c
> index 771c4550980..9f651bb4294 100644
> --- a/string-list.c
> +++ b/string-list.c
> @@ -200,9 +200,9 @@ void print_string_list(const struct string_list *p, const char *text)
> {
> int i;
> if ( text )
> - printf("%s\n", text);
> + trace_printf("%s\n", text);
> for (i = 0; i < p->nr; i++)
> - printf("%s:%p\n", p->items[i].string, p->items[i].util);
> + trace_printf("%s:%p\n", p->items[i].string, p->items[i].util);
> }
>
> struct string_list_item *string_list_append_nodup(struct string_list *list,