From: Duy Nguyen Date: Wed, 06 Feb 2013 10:45:41 GMT Subject: Re: [PATCH v2 2/2] i18n: mark OPTION_NUMBER (-NUM) for translation Message-ID: In-Reply-To: <7vip66njpj.fsf@alter.siamese.dyndns.org> On Wed, Feb 6, 2013 at 11:35 AM, Junio C Hamano wrote: >> How about this since [PATCH v3]: >> >> diff --git a/utf8.c b/utf8.c >> index 52dbd..b893a 100644 >> --- a/utf8.c >> +++ b/utf8.c >> @@ -443,8 +443,11 @@ int utf8_fprintf(FILE *stream, const char *format, ...) >> strbuf_vaddf(&buf, format, arg); >> va_end (arg); >> >> - fputs(buf.buf, stream); >> - columns = utf8_strwidth(buf.buf); >> + columns = fputs(buf.buf, stream); >> + /* If no error occurs, and really write something (columns > 0), >> + * calculate really columns width with utf8_strwidth. */ >> + if (columns > 0) >> + columns = utf8_strwidth(buf.buf); >> strbuf_release(&buf); >> return columns; >> } > > The above bugfix does not address my original concern about > the name, though. How about utf8_fwprintf? wprintf() deals with wide characters and returns the number of wide characters, I think the name fits. And we could just drop utf8_ and use the existing name, because we don't use wchar_t* anyway. -- Duy