powertop.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [Powertop] [PATCH 0/2] Align multi-column characters properly (SPLIT [po] Updated zh_CN translation)
@ 2018-03-03 19:49 Mingye Wang
  0 siblings, 0 replies; only message in thread
From: Mingye Wang @ 2018-03-03 19:49 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1786 bytes --]

Hi folks,

On 18/03/03 03:14, Mingcong Bai wrote:
> Updated Mingye Wang's patches to fix build - PowerTOP has been built and 
> tested and columns are now aligned correctly when using zh_CN.
> 
> Best Regards,
> Mingcong Bai

I will post the patches below, as I just found something else to revise. 
Here are some quick answers to typical code reviewer questions:

Q. What strings does measure_string fail on?
A. Strings with invalid multibyte sequences (-3), non-printable 
characters such as newlines and tabs (-1), NULL (-2), and huge strings 
that fail malloc (-2).

Q. Why is measure_string returning an int instead of a size_t?
A. I blame wcswidth.

Q. What does measure_string depend on?
A. malloc/free, mbsrtowcs, and wcswidth.

Q. Is align_string slower now?
A. Yes. It needs to do a full encoding conversion in measure_string 
instead of just counting.

Q. Are you making a more "naive" version of align_string?
A. Not now. But note that the unit-printing parts (watts, rpm...) 
generally only involve printable ASCII, so strlen() will suffice for 
them. It should not matter too much.

Q. Is the "ctr" variable useless in cpu.cpp now?
A. Yes, but it still should sync up with the actual column count.

Things we want you all to fix up that aren't included in the patch:

1. LINGUAS, or we will never see the translations used.

2. The use of #include <stdfoo.h> in C++ where #include <cstdfoo> is 
available. The C++ variants of these headers work much better (you don't 
have to memset the mbstate_t, for example) in C++.

3. Use some C++ strings maybe? It's not that bad for me as compilers 
know how to optimize out stuff like "if (strlen(x))", but those new 
stuff sure are much easier to use.

--
Regards,
Mingye Wang


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-03 19:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-03 19:49 [Powertop] [PATCH 0/2] Align multi-column characters properly (SPLIT [po] Updated zh_CN translation) Mingye Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).