dlm: Simplify character output in three functions
Subsystems (2)
PATCH 1/1 dlm: Simplify character output in three functions
From: Markus Elfring <[email protected]>
Date: Mon, 15 Jul 2024 12:36:44 +0200
Single characters should be put into a sequence.
Thus use the corresponding function “seq_putc” for three selected calls.
This issue was transformed by using the Coccinelle software.
Suggested-by Christophe Jaillet <[email protected]>
Signed-off-by Markus Elfring <[email protected]>
--- fs/dlm/debug_fs.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
fs/dlm/debug_fs.c +4 -8
@@ -81,12 +81,8 @@ static void print_format1(struct dlm_rsb *res, struct seq_file *s)seq_printf (s,"\nResource %p Name (len=%d) \"" , res, res->res_length); -for (i =0 ; i < res->res_length; i++) { -if (isprint (res->res_name[i])) -seq_printf (s,"%c" , res->res_name[i]); -else -seq_printf (s,"%c" ,'.' ); - } +for (i =0 ; i < res->res_length; i++) +seq_putc (s, (isprint (res->res_name[i]) ? res->res_name[i] :'.' ));if (res->res_nodeid >0 ) seq_printf(s, "\"\nLocal Copy, Master is node %d\n",
@@ -284,7 +280,7 @@ static void print_format3(struct dlm_rsb *r, struct seq_file *s)for (i =0 ; i < r->res_length; i++) {if (print_name) -seq_printf (s,"%c" , r->res_name[i]); +seq_putc (s, r->res_name[i]);else seq_printf (s," %02x" , (unsigned char )r->res_name[i]); }
@@ -358,7 +354,7 @@ static void print_format4(struct dlm_rsb *r, struct seq_file *s)for (i =0 ; i < r->res_length; i++) {if (print_name) -seq_printf (s,"%c" , r->res_name[i]); +seq_putc (s, r->res_name[i]);else seq_printf (s," %02x" , (unsigned char )r->res_name[i]); }
--
2.45.2