Thread (2 messages) flat view 2 messages, 2 authors, 2017-06-28

Re: [PATCH] submodule--helper: do not call utf8_fprintf() unnecessarily

From: Junio C Hamano <hidden>
Date: 2017-06-28 20:58:47

Stefan Beller [off-list ref] writes:
On Wed, Jun 28, 2017 at 1:38 PM, Junio C Hamano [off-list ref] wrote:
quoted
The helper function utf8_fprintf(fp, ...) has exactly the same
effect to the output stream fp as fprintf(fp, ...) does, and the
only difference is that its return value counts in display columns
consumed (assuming that the payload is encoded in UTF-8), as opposed
to number of bytes.

There is no reason to call it unless the caller cares about its
return value.

Signed-off-by: Junio C Hamano <redacted>
---

 * The helper was introduced at c0821965 ("Add utf8_fprintf helper
   that returns correct number of columns", 2013-02-09), which also
   taught the help text output from the parse_options API to use it
   to align columns.  These original callers naturally do use the
   returned value and left alone by this fix, which corrects all the
   later callers that misuses it.
The patch looks correct.
Thanks.  I had a small voice back in my head telling me that I may
have misread the code and this patch breaks things, which you
cleared up for me ;-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help