From 18731cb366587735c357eb0c33ede364b85357c9 Mon Sep 17 00:00:00 2001 From: Levente Kurusa Date: Sat, 5 Apr 2014 17:09:11 +0200 Subject: [PATCH] qr: print_oops: use memcpy instead of looping Cleanup some indented empty lines as well. Signed-off-by: Levente Kurusa --- kernel/print_oops.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/kernel/print_oops.c b/kernel/print_oops.c index 042f8ea..f0a3513 100644 --- a/kernel/print_oops.c +++ b/kernel/print_oops.c @@ -37,15 +37,15 @@ static struct z_stream_s stream; void qr_append(char *text) { - while (*text != '\0') { - if (buf_pos == QR_BUFSIZE - 1) { - qr_buffer[QR_BUFSIZE - 1] = '\0'; - return; - } - qr_buffer[buf_pos] = *text; - buf_pos++; - text++; + size_t len; + + len = strlen(text); + if (len + buf_pos >= QR_BUFSIZE - 1) { + len = QR_BUFSIZE - 1 - buf_pos; + qr_buffer[QR_BUFSIZE - 1] = '\0'; } + memcpy(&qr_buffer[buf_pos], text, len); + buf_pos += len; } @@ -120,10 +120,10 @@ void print_qr_err(void) int w; int is_black; char compr_qr_buffer[buf_pos]; - + if (!qr_oops) return; - + info = registered_fb[0]; if (!info) { printk(KERN_WARNING "Unable to get hand of a framebuffer!\n"); -- 1.8.3.1