[PATCH 3/3] Optimize one-character output in dump_log_entry

Petr Tesarik ptesarik at suse.cz
Wed Mar 12 12:01:13 EDT 2014


Using sprintf to copy one character to the output buffer is overkill.

Signed-off-by: Petr Tesarik <ptesarik at suse.cz>
---
 makedumpfile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 261e1ad..a98258c 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3892,12 +3892,12 @@ dump_log_entry(char *logptr, int fp)
 		}
 
 		if (isprint(*p) || isspace(*p))
-			bufp =+ sprintf(bufp, "%c", *p);
+			*bufp++ = *p;
 		else
 			bufp += sprintf(bufp, "\\x%02x", *p);
 	}
 
-	bufp += sprintf(bufp, "\n");
+	*bufp++ = '\n';
 
 	if (write(info->fd_dumpfile, buf, bufp - buf) < 0)
 		return FALSE;
-- 
1.8.4.5




More information about the kexec mailing list