[PATCH] tidy up lib/inflate.c error messages
authorAndrew Morton <akpm@osdl.org>
Tue, 9 Sep 2003 17:20:58 +0000 (10:20 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 9 Sep 2003 17:20:58 +0000 (10:20 -0700)
From: Andre McCurdy <armcc2000@yahoo.com>

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
arch/arm/boot/compressed/misc.c
arch/arm26/boot/compressed/misc.c
arch/cris/arch-v10/boot/compressed/misc.c
arch/i386/boot/compressed/misc.c
arch/i386/boot98/compressed/misc.c
arch/sh/boot/compressed/misc.c
arch/x86_64/boot/compressed/misc.c
init/do_mounts_rd.c
lib/inflate.c

index 15461c5..d9db7c2 100644 (file)
@@ -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;
index c882e28..b563e0e 100644 (file)
@@ -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];
index fbac9bf..f17f50e 100644 (file)
@@ -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];
index 9969c62..6506ac4 100644 (file)
@@ -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 */
 
index d55ca28..b79663c 100644 (file)
@@ -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
index 5051931..5574009 100644 (file)
@@ -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
index a2da3fe..1ed7425 100644 (file)
@@ -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;
index e7bd9a0..78d4c78 100644 (file)
@@ -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
index 61d46ca..e500fb1 100644 (file)
@@ -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;
 }
index 4d48e61..4122707 100644 (file)
@@ -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 */