mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: gfs2@lists.linux.dev, kernel-janitors@vger.kernel.org,
	Alexander Aring <aahringo@redhat.com>,
	Christophe Jaillet <christophe.jaillet@wanadoo.fr>,
	David Teigland <teigland@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] dlm: Simplify character output in three functions
Date: Mon, 15 Jul 2024 12:52:07 +0200	[thread overview]
Message-ID: <f69334a0-ccdb-4caf-b5b4-177cbf0ed1d7@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
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 <christophe.jaillet@wanadoo.fr>
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/dlm/debug_fs.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index 7112958c2e5b..0d21007930ed 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -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


                 reply	other threads:[~2024-07-15 10:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f69334a0-ccdb-4caf-b5b4-177cbf0ed1d7@web.de \
    --to=markus.elfring@web.de \
    --cc=aahringo@redhat.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=gfs2@lists.linux.dev \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=teigland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®