From 2816017743e689adec72c1d24541170ef4979409 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 9 Sep 2003 10:20:58 -0700 Subject: [PATCH] [PATCH] tidy up lib/inflate.c error messages From: Andre McCurdy There is some inconsistency within lib/inflate.c and its users about whether the error message text or the error() function should provide the '\n'. This patch tries to make everyone consistent - by removing the newline from all message texts, and adding one to the only error() function which did not provide it (in init/do_mounts_rd.c). --- arch/alpha/boot/misc.c | 6 +++--- arch/arm/boot/compressed/misc.c | 6 +++--- arch/arm26/boot/compressed/misc.c | 6 +++--- arch/cris/arch-v10/boot/compressed/misc.c | 2 +- arch/i386/boot/compressed/misc.c | 16 ++++++++-------- arch/i386/boot98/compressed/misc.c | 16 ++++++++-------- arch/sh/boot/compressed/misc.c | 8 ++++---- arch/x86_64/boot/compressed/misc.c | 16 ++++++++-------- init/do_mounts_rd.c | 4 ++-- lib/inflate.c | 10 +++++----- 10 files changed, 45 insertions(+), 45 deletions(-) diff --git a/arch/alpha/boot/misc.c b/arch/alpha/boot/misc.c index 15461c5feb20b..d9db7c21b9309 100644 --- a/arch/alpha/boot/misc.c +++ b/arch/alpha/boot/misc.c @@ -106,8 +106,8 @@ static void *malloc(int size) { void *p; - if (size <0) error("Malloc error\n"); - if (free_mem_ptr <= 0) error("Memory error\n"); + if (size <0) error("Malloc error"); + if (free_mem_ptr <= 0) error("Memory error"); free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ @@ -140,7 +140,7 @@ static void gzip_release(void **ptr) int fill_inbuf(void) { if (insize != 0) - error("ran out of input data\n"); + error("ran out of input data"); inbuf = input_data; insize = input_data_size; diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index c882e283f7f70..b563e0e82c681 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -191,8 +191,8 @@ static void *malloc(int size) { void *p; - if (size <0) error("Malloc error\n"); - if (free_mem_ptr <= 0) error("Memory error\n"); + if (size <0) error("Malloc error"); + if (free_mem_ptr <= 0) error("Memory error"); free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ @@ -236,7 +236,7 @@ static void gzip_release(void **ptr) int fill_inbuf(void) { if (insize != 0) - error("ran out of input data\n"); + error("ran out of input data"); inbuf = input_data; insize = &input_data_end[0] - &input_data[0]; diff --git a/arch/arm26/boot/compressed/misc.c b/arch/arm26/boot/compressed/misc.c index fbac9bf4eedc5..f17f50e5516fe 100644 --- a/arch/arm26/boot/compressed/misc.c +++ b/arch/arm26/boot/compressed/misc.c @@ -191,8 +191,8 @@ static void *malloc(int size) { void *p; - if (size <0) error("Malloc error\n"); - if (free_mem_ptr <= 0) error("Memory error\n"); + if (size <0) error("Malloc error"); + if (free_mem_ptr <= 0) error("Memory error"); free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ @@ -236,7 +236,7 @@ static void gzip_release(void **ptr) int fill_inbuf(void) { if (insize != 0) - error("ran out of input data\n"); + error("ran out of input data"); inbuf = input_data; insize = &input_data_end[0] - &input_data[0]; diff --git a/arch/cris/arch-v10/boot/compressed/misc.c b/arch/cris/arch-v10/boot/compressed/misc.c index 9969c6242f75b..6506ac4a822d5 100644 --- a/arch/cris/arch-v10/boot/compressed/misc.c +++ b/arch/cris/arch-v10/boot/compressed/misc.c @@ -115,7 +115,7 @@ static void *malloc(int size) { void *p; - if (size <0) error("Malloc error\n"); + if (size <0) error("Malloc error"); free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ diff --git a/arch/i386/boot/compressed/misc.c b/arch/i386/boot/compressed/misc.c index d55ca2805c759..b79663ca2ffe8 100644 --- a/arch/i386/boot/compressed/misc.c +++ b/arch/i386/boot/compressed/misc.c @@ -132,8 +132,8 @@ static void *malloc(int size) { void *p; - if (size <0) error("Malloc error\n"); - if (free_mem_ptr <= 0) error("Memory error\n"); + if (size <0) error("Malloc error"); + if (free_mem_ptr <= 0) error("Memory error"); free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ @@ -141,7 +141,7 @@ static void *malloc(int size) free_mem_ptr += size; if (free_mem_ptr >= free_mem_end_ptr) - error("\nOut of memory\n"); + error("Out of memory"); return p; } @@ -232,7 +232,7 @@ static void* memcpy(void* __dest, __const void* __src, static int fill_inbuf(void) { if (insize != 0) { - error("ran out of input data\n"); + error("ran out of input data"); } inbuf = input_data; @@ -306,9 +306,9 @@ struct { static void setup_normal_output_buffer(void) { #ifdef STANDARD_MEMORY_BIOS_CALL - if (EXT_MEM_K < 1024) error("Less than 2MB of memory.\n"); + if (EXT_MEM_K < 1024) error("Less than 2MB of memory"); #else - if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory.\n"); + if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory"); #endif output_data = (char *)0x100000; /* Points to 1M */ free_mem_end_ptr = (long)real_mode; @@ -323,9 +323,9 @@ static void setup_output_buffer_if_we_run_high(struct moveparams *mv) { high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE); #ifdef STANDARD_MEMORY_BIOS_CALL - if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory.\n"); + if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory"); #else - if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory.\n"); + if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory"); #endif mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX diff --git a/arch/i386/boot98/compressed/misc.c b/arch/i386/boot98/compressed/misc.c index 5051931e3bf4d..5574009726240 100644 --- a/arch/i386/boot98/compressed/misc.c +++ b/arch/i386/boot98/compressed/misc.c @@ -132,8 +132,8 @@ static void *malloc(int size) { void *p; - if (size <0) error("Malloc error\n"); - if (free_mem_ptr <= 0) error("Memory error\n"); + if (size <0) error("Malloc error"); + if (free_mem_ptr <= 0) error("Memory error"); free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ @@ -141,7 +141,7 @@ static void *malloc(int size) free_mem_ptr += size; if (free_mem_ptr >= free_mem_end_ptr) - error("\nOut of memory\n"); + error("Out of memory"); return p; } @@ -232,7 +232,7 @@ static void* memcpy(void* __dest, __const void* __src, static int fill_inbuf(void) { if (insize != 0) { - error("ran out of input data\n"); + error("ran out of input data"); } inbuf = input_data; @@ -306,9 +306,9 @@ struct { static void setup_normal_output_buffer(void) { #ifdef STANDARD_MEMORY_BIOS_CALL - if (EXT_MEM_K < 1024) error("Less than 2MB of memory.\n"); + if (EXT_MEM_K < 1024) error("Less than 2MB of memory"); #else - if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory.\n"); + if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory"); #endif output_data = (char *)0x100000; /* Points to 1M */ free_mem_end_ptr = (long)real_mode; @@ -323,9 +323,9 @@ static void setup_output_buffer_if_we_run_high(struct moveparams *mv) { high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE); #ifdef STANDARD_MEMORY_BIOS_CALL - if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory.\n"); + if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory"); #else - if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory.\n"); + if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory"); #endif mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c index a2da3fe75ad04..1ed7425a44678 100644 --- a/arch/sh/boot/compressed/misc.c +++ b/arch/sh/boot/compressed/misc.c @@ -105,8 +105,8 @@ static void *malloc(int size) { void *p; - if (size <0) error("Malloc error\n"); - if (free_mem_ptr == 0) error("Memory error\n"); + if (size <0) error("Malloc error"); + if (free_mem_ptr == 0) error("Memory error"); free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ @@ -114,7 +114,7 @@ static void *malloc(int size) free_mem_ptr += size; if (free_mem_ptr >= free_mem_end_ptr) - error("\nOut of memory\n"); + error("Out of memory"); return p; } @@ -180,7 +180,7 @@ void* memcpy(void* __dest, __const void* __src, static int fill_inbuf(void) { if (insize != 0) { - error("ran out of input data\n"); + error("ran out of input data"); } inbuf = input_data; diff --git a/arch/x86_64/boot/compressed/misc.c b/arch/x86_64/boot/compressed/misc.c index e7bd9a02a7a75..78d4c784701c7 100644 --- a/arch/x86_64/boot/compressed/misc.c +++ b/arch/x86_64/boot/compressed/misc.c @@ -116,8 +116,8 @@ static void *malloc(int size) { void *p; - if (size <0) error("Malloc error\n"); - if (free_mem_ptr <= 0) error("Memory error\n"); + if (size <0) error("Malloc error"); + if (free_mem_ptr <= 0) error("Memory error"); free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ @@ -125,7 +125,7 @@ static void *malloc(int size) free_mem_ptr += size; if (free_mem_ptr >= free_mem_end_ptr) - error("\nOut of memory\n"); + error("Out of memory"); return p; } @@ -215,7 +215,7 @@ void* memcpy(void* dest, const void* src, unsigned n) static int fill_inbuf(void) { if (insize != 0) { - error("ran out of input data\n"); + error("ran out of input data"); } inbuf = input_data; @@ -280,9 +280,9 @@ static void error(char *x) void setup_normal_output_buffer(void) { #ifdef STANDARD_MEMORY_BIOS_CALL - if (EXT_MEM_K < 1024) error("Less than 2MB of memory.\n"); + if (EXT_MEM_K < 1024) error("Less than 2MB of memory"); #else - if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory.\n"); + if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory"); #endif output_data = (char *)0x100000; /* Points to 1M */ free_mem_end_ptr = (long)real_mode; @@ -297,9 +297,9 @@ void setup_output_buffer_if_we_run_high(struct moveparams *mv) { high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE); #ifdef STANDARD_MEMORY_BIOS_CALL - if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory.\n"); + if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory"); #else - if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory.\n"); + if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory"); #endif mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c index 61d46ca0fd641..e500fb11033b6 100644 --- a/init/do_mounts_rd.c +++ b/init/do_mounts_rd.c @@ -332,7 +332,7 @@ static int __init fill_inbuf(void) insize = read(crd_infd, inbuf, INBUFSIZ); if (insize == 0) { - error("RAMDISK: ran out of compressed data\n"); + error("RAMDISK: ran out of compressed data"); return -1; } @@ -369,7 +369,7 @@ static void __init flush_window(void) static void __init error(char *x) { - printk(KERN_ERR "%s", x); + printk(KERN_ERR "%s\n", x); exit_code = 1; unzip_error = 1; } diff --git a/lib/inflate.c b/lib/inflate.c index 4d48e61c2490a..41227073442b1 100644 --- a/lib/inflate.c +++ b/lib/inflate.c @@ -871,7 +871,7 @@ DEBG("dyn5a "); { DEBG("dyn5b "); if (i == 1) { - error(" incomplete literal tree\n"); + error("incomplete literal tree"); huft_free(tl); } return i; /* incomplete code set */ @@ -882,7 +882,7 @@ DEBG("dyn5c "); { DEBG("dyn5d "); if (i == 1) { - error(" incomplete distance tree\n"); + error("incomplete distance tree"); #ifdef PKZIP_BUG_WORKAROUND i = 0; } @@ -1097,15 +1097,15 @@ static int gunzip(void) flags = (uch)get_byte(); if ((flags & ENCRYPTED) != 0) { - error("Input is encrypted\n"); + error("Input is encrypted"); return -1; } if ((flags & CONTINUATION) != 0) { - error("Multi part input\n"); + error("Multi part input"); return -1; } if ((flags & RESERVED) != 0) { - error("Input has invalid flags\n"); + error("Input has invalid flags"); return -1; } (ulg)get_byte(); /* Get timestamp */ -- 2.53.0