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-next>] [day] [month] [year] [list]
Date:	Wed, 10 Sep 2014 13:20:19 +0400
From:	Dmitry Voytik <voytikd@...il.com>
To:	Alexander Viro <viro@...iv.linux.org.uk>
Cc:	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	Dmitry Voytik <voytikd@...il.com>
Subject: [PATCH] fs: seq_file: optimize seq_pad()

Use seq_putc() instead of seq_printf() in seq_pad() because the
former is faster.

Signed-off-by: Dmitry Voytik <voytikd@...il.com>
---
 fs/seq_file.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/seq_file.c b/fs/seq_file.c
index 3857b72..fef338e 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -787,8 +787,10 @@ EXPORT_SYMBOL(seq_write);
 void seq_pad(struct seq_file *m, char c)
 {
 	int size = m->pad_until - m->count;
-	if (size > 0)
-		seq_printf(m, "%*s", size, "");
+
+	while (size-- > 0)
+		if (unlikely(seq_putc(m, ' ')))
+			return;
 	if (c)
 		seq_putc(m, c);
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists