kernel/params.c: Refactor dash2underscore
PATCH 1/1 kernel/params.c: Refactor dash2underscore
This patch refactors the dash2underscore function
to use the ternary operator.
Signed-off-by Jim Christian Haukvik <[email protected]>
--- kernel/params.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/params.c +1 -3
@@ -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)
Signature · 1 line
2.33.1
Quoted 13 lines · Jim Christian Haukvik
This patch refactors the dash2underscore function
to use the ternary operator.Signed-off-by Jim Christian Haukvik <[email protected]>--- kernel/params.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)kernel/params.c +0
-0
kernel/params.c static void maybe_kfree_parameter(void *param) · line 80
Quoted 8 lines
kernel/params.c +1
-3@@ -76,9 +76,7 @@ static void maybe_kfree_parameter(void *param)static char dash2underscore (char c) { -if (c =='-' ) -return '_' ; -return c; +return (c =='-' ) ?'_' : c; }
This is not an improvement. You're just making the code harder to read for no good reason (the ternary operator tends to do so).
Johan