Commit 28160177 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] tidy up lib/inflate.c error messages

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).
parent fa5349be
...@@ -106,8 +106,8 @@ static void *malloc(int size) ...@@ -106,8 +106,8 @@ static void *malloc(int size)
{ {
void *p; void *p;
if (size <0) error("Malloc error\n"); if (size <0) error("Malloc error");
if (free_mem_ptr <= 0) error("Memory error\n"); if (free_mem_ptr <= 0) error("Memory error");
free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
...@@ -140,7 +140,7 @@ static void gzip_release(void **ptr) ...@@ -140,7 +140,7 @@ static void gzip_release(void **ptr)
int fill_inbuf(void) int fill_inbuf(void)
{ {
if (insize != 0) if (insize != 0)
error("ran out of input data\n"); error("ran out of input data");
inbuf = input_data; inbuf = input_data;
insize = input_data_size; insize = input_data_size;
......
...@@ -191,8 +191,8 @@ static void *malloc(int size) ...@@ -191,8 +191,8 @@ static void *malloc(int size)
{ {
void *p; void *p;
if (size <0) error("Malloc error\n"); if (size <0) error("Malloc error");
if (free_mem_ptr <= 0) error("Memory error\n"); if (free_mem_ptr <= 0) error("Memory error");
free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
...@@ -236,7 +236,7 @@ static void gzip_release(void **ptr) ...@@ -236,7 +236,7 @@ static void gzip_release(void **ptr)
int fill_inbuf(void) int fill_inbuf(void)
{ {
if (insize != 0) if (insize != 0)
error("ran out of input data\n"); error("ran out of input data");
inbuf = input_data; inbuf = input_data;
insize = &input_data_end[0] - &input_data[0]; insize = &input_data_end[0] - &input_data[0];
......
...@@ -191,8 +191,8 @@ static void *malloc(int size) ...@@ -191,8 +191,8 @@ static void *malloc(int size)
{ {
void *p; void *p;
if (size <0) error("Malloc error\n"); if (size <0) error("Malloc error");
if (free_mem_ptr <= 0) error("Memory error\n"); if (free_mem_ptr <= 0) error("Memory error");
free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
...@@ -236,7 +236,7 @@ static void gzip_release(void **ptr) ...@@ -236,7 +236,7 @@ static void gzip_release(void **ptr)
int fill_inbuf(void) int fill_inbuf(void)
{ {
if (insize != 0) if (insize != 0)
error("ran out of input data\n"); error("ran out of input data");
inbuf = input_data; inbuf = input_data;
insize = &input_data_end[0] - &input_data[0]; insize = &input_data_end[0] - &input_data[0];
......
...@@ -115,7 +115,7 @@ static void *malloc(int size) ...@@ -115,7 +115,7 @@ static void *malloc(int size)
{ {
void *p; void *p;
if (size <0) error("Malloc error\n"); if (size <0) error("Malloc error");
free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
......
...@@ -132,8 +132,8 @@ static void *malloc(int size) ...@@ -132,8 +132,8 @@ static void *malloc(int size)
{ {
void *p; void *p;
if (size <0) error("Malloc error\n"); if (size <0) error("Malloc error");
if (free_mem_ptr <= 0) error("Memory error\n"); if (free_mem_ptr <= 0) error("Memory error");
free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
...@@ -141,7 +141,7 @@ static void *malloc(int size) ...@@ -141,7 +141,7 @@ static void *malloc(int size)
free_mem_ptr += size; free_mem_ptr += size;
if (free_mem_ptr >= free_mem_end_ptr) if (free_mem_ptr >= free_mem_end_ptr)
error("\nOut of memory\n"); error("Out of memory");
return p; return p;
} }
...@@ -232,7 +232,7 @@ static void* memcpy(void* __dest, __const void* __src, ...@@ -232,7 +232,7 @@ static void* memcpy(void* __dest, __const void* __src,
static int fill_inbuf(void) static int fill_inbuf(void)
{ {
if (insize != 0) { if (insize != 0) {
error("ran out of input data\n"); error("ran out of input data");
} }
inbuf = input_data; inbuf = input_data;
...@@ -306,9 +306,9 @@ struct { ...@@ -306,9 +306,9 @@ struct {
static void setup_normal_output_buffer(void) static void setup_normal_output_buffer(void)
{ {
#ifdef STANDARD_MEMORY_BIOS_CALL #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 #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 #endif
output_data = (char *)0x100000; /* Points to 1M */ output_data = (char *)0x100000; /* Points to 1M */
free_mem_end_ptr = (long)real_mode; free_mem_end_ptr = (long)real_mode;
...@@ -323,9 +323,9 @@ static void setup_output_buffer_if_we_run_high(struct moveparams *mv) ...@@ -323,9 +323,9 @@ static void setup_output_buffer_if_we_run_high(struct moveparams *mv)
{ {
high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE); high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE);
#ifdef STANDARD_MEMORY_BIOS_CALL #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 #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 #endif
mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START;
low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX
......
...@@ -132,8 +132,8 @@ static void *malloc(int size) ...@@ -132,8 +132,8 @@ static void *malloc(int size)
{ {
void *p; void *p;
if (size <0) error("Malloc error\n"); if (size <0) error("Malloc error");
if (free_mem_ptr <= 0) error("Memory error\n"); if (free_mem_ptr <= 0) error("Memory error");
free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
...@@ -141,7 +141,7 @@ static void *malloc(int size) ...@@ -141,7 +141,7 @@ static void *malloc(int size)
free_mem_ptr += size; free_mem_ptr += size;
if (free_mem_ptr >= free_mem_end_ptr) if (free_mem_ptr >= free_mem_end_ptr)
error("\nOut of memory\n"); error("Out of memory");
return p; return p;
} }
...@@ -232,7 +232,7 @@ static void* memcpy(void* __dest, __const void* __src, ...@@ -232,7 +232,7 @@ static void* memcpy(void* __dest, __const void* __src,
static int fill_inbuf(void) static int fill_inbuf(void)
{ {
if (insize != 0) { if (insize != 0) {
error("ran out of input data\n"); error("ran out of input data");
} }
inbuf = input_data; inbuf = input_data;
...@@ -306,9 +306,9 @@ struct { ...@@ -306,9 +306,9 @@ struct {
static void setup_normal_output_buffer(void) static void setup_normal_output_buffer(void)
{ {
#ifdef STANDARD_MEMORY_BIOS_CALL #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 #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 #endif
output_data = (char *)0x100000; /* Points to 1M */ output_data = (char *)0x100000; /* Points to 1M */
free_mem_end_ptr = (long)real_mode; free_mem_end_ptr = (long)real_mode;
...@@ -323,9 +323,9 @@ static void setup_output_buffer_if_we_run_high(struct moveparams *mv) ...@@ -323,9 +323,9 @@ static void setup_output_buffer_if_we_run_high(struct moveparams *mv)
{ {
high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE); high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE);
#ifdef STANDARD_MEMORY_BIOS_CALL #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 #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 #endif
mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START;
low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX
......
...@@ -105,8 +105,8 @@ static void *malloc(int size) ...@@ -105,8 +105,8 @@ static void *malloc(int size)
{ {
void *p; void *p;
if (size <0) error("Malloc error\n"); if (size <0) error("Malloc error");
if (free_mem_ptr == 0) error("Memory error\n"); if (free_mem_ptr == 0) error("Memory error");
free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
...@@ -114,7 +114,7 @@ static void *malloc(int size) ...@@ -114,7 +114,7 @@ static void *malloc(int size)
free_mem_ptr += size; free_mem_ptr += size;
if (free_mem_ptr >= free_mem_end_ptr) if (free_mem_ptr >= free_mem_end_ptr)
error("\nOut of memory\n"); error("Out of memory");
return p; return p;
} }
...@@ -180,7 +180,7 @@ void* memcpy(void* __dest, __const void* __src, ...@@ -180,7 +180,7 @@ void* memcpy(void* __dest, __const void* __src,
static int fill_inbuf(void) static int fill_inbuf(void)
{ {
if (insize != 0) { if (insize != 0) {
error("ran out of input data\n"); error("ran out of input data");
} }
inbuf = input_data; inbuf = input_data;
......
...@@ -116,8 +116,8 @@ static void *malloc(int size) ...@@ -116,8 +116,8 @@ static void *malloc(int size)
{ {
void *p; void *p;
if (size <0) error("Malloc error\n"); if (size <0) error("Malloc error");
if (free_mem_ptr <= 0) error("Memory error\n"); if (free_mem_ptr <= 0) error("Memory error");
free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
...@@ -125,7 +125,7 @@ static void *malloc(int size) ...@@ -125,7 +125,7 @@ static void *malloc(int size)
free_mem_ptr += size; free_mem_ptr += size;
if (free_mem_ptr >= free_mem_end_ptr) if (free_mem_ptr >= free_mem_end_ptr)
error("\nOut of memory\n"); error("Out of memory");
return p; return p;
} }
...@@ -215,7 +215,7 @@ void* memcpy(void* dest, const void* src, unsigned n) ...@@ -215,7 +215,7 @@ void* memcpy(void* dest, const void* src, unsigned n)
static int fill_inbuf(void) static int fill_inbuf(void)
{ {
if (insize != 0) { if (insize != 0) {
error("ran out of input data\n"); error("ran out of input data");
} }
inbuf = input_data; inbuf = input_data;
...@@ -280,9 +280,9 @@ static void error(char *x) ...@@ -280,9 +280,9 @@ static void error(char *x)
void setup_normal_output_buffer(void) void setup_normal_output_buffer(void)
{ {
#ifdef STANDARD_MEMORY_BIOS_CALL #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 #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 #endif
output_data = (char *)0x100000; /* Points to 1M */ output_data = (char *)0x100000; /* Points to 1M */
free_mem_end_ptr = (long)real_mode; free_mem_end_ptr = (long)real_mode;
...@@ -297,9 +297,9 @@ void setup_output_buffer_if_we_run_high(struct moveparams *mv) ...@@ -297,9 +297,9 @@ void setup_output_buffer_if_we_run_high(struct moveparams *mv)
{ {
high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE); high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE);
#ifdef STANDARD_MEMORY_BIOS_CALL #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 #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 #endif
mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START;
low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX
......
...@@ -332,7 +332,7 @@ static int __init fill_inbuf(void) ...@@ -332,7 +332,7 @@ static int __init fill_inbuf(void)
insize = read(crd_infd, inbuf, INBUFSIZ); insize = read(crd_infd, inbuf, INBUFSIZ);
if (insize == 0) { if (insize == 0) {
error("RAMDISK: ran out of compressed data\n"); error("RAMDISK: ran out of compressed data");
return -1; return -1;
} }
...@@ -369,7 +369,7 @@ static void __init flush_window(void) ...@@ -369,7 +369,7 @@ static void __init flush_window(void)
static void __init error(char *x) static void __init error(char *x)
{ {
printk(KERN_ERR "%s", x); printk(KERN_ERR "%s\n", x);
exit_code = 1; exit_code = 1;
unzip_error = 1; unzip_error = 1;
} }
......
...@@ -871,7 +871,7 @@ DEBG("dyn5a "); ...@@ -871,7 +871,7 @@ DEBG("dyn5a ");
{ {
DEBG("dyn5b "); DEBG("dyn5b ");
if (i == 1) { if (i == 1) {
error(" incomplete literal tree\n"); error("incomplete literal tree");
huft_free(tl); huft_free(tl);
} }
return i; /* incomplete code set */ return i; /* incomplete code set */
...@@ -882,7 +882,7 @@ DEBG("dyn5c "); ...@@ -882,7 +882,7 @@ DEBG("dyn5c ");
{ {
DEBG("dyn5d "); DEBG("dyn5d ");
if (i == 1) { if (i == 1) {
error(" incomplete distance tree\n"); error("incomplete distance tree");
#ifdef PKZIP_BUG_WORKAROUND #ifdef PKZIP_BUG_WORKAROUND
i = 0; i = 0;
} }
...@@ -1097,15 +1097,15 @@ static int gunzip(void) ...@@ -1097,15 +1097,15 @@ static int gunzip(void)
flags = (uch)get_byte(); flags = (uch)get_byte();
if ((flags & ENCRYPTED) != 0) { if ((flags & ENCRYPTED) != 0) {
error("Input is encrypted\n"); error("Input is encrypted");
return -1; return -1;
} }
if ((flags & CONTINUATION) != 0) { if ((flags & CONTINUATION) != 0) {
error("Multi part input\n"); error("Multi part input");
return -1; return -1;
} }
if ((flags & RESERVED) != 0) { if ((flags & RESERVED) != 0) {
error("Input has invalid flags\n"); error("Input has invalid flags");
return -1; return -1;
} }
(ulg)get_byte(); /* Get timestamp */ (ulg)get_byte(); /* Get timestamp */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment