lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250212123609.GP1977892@ZenIV>
Date: Wed, 12 Feb 2025 12:36:09 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Christian Brauner <brauner@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jeff Layton <jlayton@...nel.org>,
	Adrian Ratiu <adrian.ratiu@...labora.com>,
	xu xin <xu.xin16@....com.cn>,
	Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
	Felix Moessbauer <felix.moessbauer@...mens.com>,
	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] proc: Use str_yes_no() helper in proc_pid_ksm_stat()

On Wed, Feb 12, 2025 at 01:11:08PM +0100, Thorsten Blum wrote:
> /*
>  * Here provide a series of helpers in the str_$TRUE_$FALSE format (you can
>  * also expand some helpers as needed), where $TRUE and $FALSE are their
>  * corresponding literal strings. These helpers can be used in the printing
>  * and also in other places where constant strings are required. Using these
>  * helpers offers the following benefits:
>  *  1) Reducing the hardcoding of strings, which makes the code more elegant
>  *     through these simple literal-meaning helpers.
>  *  2) Unifying the output, which prevents the same string from being printed
>  *     in various forms, such as enable/disable, enabled/disabled, en/dis.
>  *  3) Deduping by the linker, which results in a smaller binary file.
>  */

Printf modifiers would've covered all of that, though...

The thing is, <expr> ? "yes" : "no" is visually easier to distinguish than
str_yes_no(<expr>), especially when expression itself is a function call, etc.
So I'd question elegance, actually...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ