mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kernel/params.c: Refactor dash2underscore
@ 2021-10-23 18:04 Jim Christian Haukvik
  2021-10-24 10:39 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Christian Haukvik @ 2021-10-23 18:04 UTC (permalink / raw)
  To: johan; +Cc: linux-kernel, Jim Christian Haukvik

This patch refactors the dash2underscore function
to use the ternary operator.

Signed-off-by: Jim Christian Haukvik <jchaukvik@gmail.com>
---
 kernel/params.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/params.c b/kernel/params.c
index 8299bd764e42..865a76fec79a 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -76,9 +76,7 @@ static void maybe_kfree_parameter(void *param)
 
 static char dash2underscore(char c)
 {
-	if (c == '-')
-		return '_';
-	return c;
+	return (c == '-') ? '_' : c;
 }
 
 bool parameqn(const char *a, const char *b, size_t n)
-- 
2.33.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-24 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-23 18:04 [PATCH] kernel/params.c: Refactor dash2underscore Jim Christian Haukvik
2021-10-24 10:39 ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®