Re: [PATCH] readelf.c: Avoid repeating calls to gettext _() in hotpath

2025-07-02 Thread Henning Meyer
Btw, I would really like to add colored output to readelf, but the way gettext is used currently, translating raw printf format strings instead of actual words makes that impossible without breaking all translations. From a security perspective, _("%zu byte block") allows a translator to reord

Re: [PATCH] readelf.c: Avoid repeating calls to gettext _() in hotpath

2025-07-02 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-06-29 at 23:51 -0400, Aaron Merey wrote: > Calls to the gettext _() macro in hotpaths cause many runtime lookups > of the same translation strings. This patch introduces macro __() > which caches the result of _() at each call site where __() is used. > > When a cached tra

[PATCH] readelf.c: Avoid repeating calls to gettext _() in hotpath

2025-06-29 Thread Aaron Merey
Calls to the gettext _() macro in hotpaths cause many runtime lookups of the same translation strings. This patch introduces macro __() which caches the result of _() at each call site where __() is used. When a cached translation string is used as the format string for fprintf, the compiler migh