diff options
| author | Lasse Collin <lasse.collin@tukaani.org> | 2011-01-12 20:01:14 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 11:03:23 -0500 |
| commit | 93685ad247ef65b7d6f90ffe97b44f5cfeaf40d3 (patch) | |
| tree | 979868b5a03a7e73c792e222646a1876b3dc0216 | |
| parent | 6b01ed64c19b52121a717274d271d9915f8d3e94 (diff) | |
Decompressors: get rid of set_error_fn() macro
set_error_fn() has become a useless complication after c1e7c3ae59
("bzip2/lzma/gzip: pre-boot malloc doesn't return NULL on failure") fixed
the use of error() in malloc(). Only decompress_unlzma.c had some use for
it and that was easy to change too.
This also gets rid of the static function pointer "error", which
should have been marked as __initdata.
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Alain Knaff <alain@knaff.lu>
Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | include/linux/decompress/mm.h | 5 | ||||
| -rw-r--r-- | lib/decompress_bunzip2.c | 7 | ||||
| -rw-r--r-- | lib/decompress_inflate.c | 3 | ||||
| -rw-r--r-- | lib/decompress_unlzma.c | 11 | ||||
| -rw-r--r-- | lib/decompress_unlzo.c | 4 |
5 files changed, 11 insertions, 19 deletions
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h index ad5ec1d0475e..a31e9820710a 100644 --- a/include/linux/decompress/mm.h +++ b/include/linux/decompress/mm.h | |||
| @@ -61,8 +61,6 @@ static void free(void *where) | |||
| 61 | #define large_malloc(a) malloc(a) | 61 | #define large_malloc(a) malloc(a) |
| 62 | #define large_free(a) free(a) | 62 | #define large_free(a) free(a) |
| 63 | 63 | ||
| 64 | #define set_error_fn(x) | ||
| 65 | |||
| 66 | #define INIT | 64 | #define INIT |
| 67 | 65 | ||
| 68 | #else /* STATIC */ | 66 | #else /* STATIC */ |
| @@ -84,9 +82,6 @@ static void free(void *where) | |||
| 84 | #define large_malloc(a) vmalloc(a) | 82 | #define large_malloc(a) vmalloc(a) |
| 85 | #define large_free(a) vfree(a) | 83 | #define large_free(a) vfree(a) |
| 86 | 84 | ||
| 87 | static void(*error)(char *m); | ||
| 88 | #define set_error_fn(x) error = x; | ||
| 89 | |||
| 90 | #define INIT __init | 85 | #define INIT __init |
| 91 | #define STATIC | 86 | #define STATIC |
| 92 | 87 | ||
diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c index 81c8bb1cc6aa..e805087f5561 100644 --- a/lib/decompress_bunzip2.c +++ b/lib/decompress_bunzip2.c | |||
| @@ -682,13 +682,12 @@ STATIC int INIT bunzip2(unsigned char *buf, int len, | |||
| 682 | int(*flush)(void*, unsigned int), | 682 | int(*flush)(void*, unsigned int), |
| 683 | unsigned char *outbuf, | 683 | unsigned char *outbuf, |
| 684 | int *pos, | 684 | int *pos, |
| 685 | void(*error_fn)(char *x)) | 685 | void(*error)(char *x)) |
| 686 | { | 686 | { |
| 687 | struct bunzip_data *bd; | 687 | struct bunzip_data *bd; |
| 688 | int i = -1; | 688 | int i = -1; |
| 689 | unsigned char *inbuf; | 689 | unsigned char *inbuf; |
| 690 | 690 | ||
| 691 | set_error_fn(error_fn); | ||
| 692 | if (flush) | 691 | if (flush) |
| 693 | outbuf = malloc(BZIP2_IOBUF_SIZE); | 692 | outbuf = malloc(BZIP2_IOBUF_SIZE); |
| 694 | 693 | ||
| @@ -751,8 +750,8 @@ STATIC int INIT decompress(unsigned char *buf, int len, | |||
| 751 | int(*flush)(void*, unsigned int), | 750 | int(*flush)(void*, unsigned int), |
| 752 | unsigned char *outbuf, | 751 | unsigned char *outbuf, |
| 753 | int *pos, | 752 | int *pos, |
| 754 | void(*error_fn)(char *x)) | 753 | void(*error)(char *x)) |
| 755 | { | 754 | { |
| 756 | return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error_fn); | 755 | return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error); |
| 757 | } | 756 | } |
| 758 | #endif | 757 | #endif |
diff --git a/lib/decompress_inflate.c b/lib/decompress_inflate.c index 1eea07e8f21b..9a7f5dfc0ed7 100644 --- a/lib/decompress_inflate.c +++ b/lib/decompress_inflate.c | |||
| @@ -38,13 +38,12 @@ STATIC int INIT gunzip(unsigned char *buf, int len, | |||
| 38 | int(*flush)(void*, unsigned int), | 38 | int(*flush)(void*, unsigned int), |
| 39 | unsigned char *out_buf, | 39 | unsigned char *out_buf, |
| 40 | int *pos, | 40 | int *pos, |
| 41 | void(*error_fn)(char *x)) { | 41 | void(*error)(char *x)) { |
| 42 | u8 *zbuf; | 42 | u8 *zbuf; |
| 43 | struct z_stream_s *strm; | 43 | struct z_stream_s *strm; |
| 44 | int rc; | 44 | int rc; |
| 45 | size_t out_len; | 45 | size_t out_len; |
| 46 | 46 | ||
| 47 | set_error_fn(error_fn); | ||
| 48 | rc = -1; | 47 | rc = -1; |
| 49 | if (flush) { | 48 | if (flush) { |
| 50 | out_len = 0x8000; /* 32 K */ | 49 | out_len = 0x8000; /* 32 K */ |
diff --git a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c index 951f7277e98a..2787dc560e4b 100644 --- a/lib/decompress_unlzma.c +++ b/lib/decompress_unlzma.c | |||
| @@ -74,6 +74,7 @@ struct rc { | |||
| 74 | uint32_t code; | 74 | uint32_t code; |
| 75 | uint32_t range; | 75 | uint32_t range; |
| 76 | uint32_t bound; | 76 | uint32_t bound; |
| 77 | void (*error)(char *); | ||
| 77 | }; | 78 | }; |
| 78 | 79 | ||
| 79 | 80 | ||
| @@ -92,7 +93,7 @@ static void INIT rc_read(struct rc *rc) | |||
| 92 | { | 93 | { |
| 93 | rc->buffer_size = rc->fill((char *)rc->buffer, LZMA_IOBUF_SIZE); | 94 | rc->buffer_size = rc->fill((char *)rc->buffer, LZMA_IOBUF_SIZE); |
| 94 | if (rc->buffer_size <= 0) | 95 | if (rc->buffer_size <= 0) |
| 95 | error("unexpected EOF"); | 96 | rc->error("unexpected EOF"); |
| 96 | rc->ptr = rc->buffer; | 97 | rc->ptr = rc->buffer; |
| 97 | rc->buffer_end = rc->buffer + rc->buffer_size; | 98 | rc->buffer_end = rc->buffer + rc->buffer_size; |
| 98 | } | 99 | } |
| @@ -536,7 +537,7 @@ STATIC inline int INIT unlzma(unsigned char *buf, int in_len, | |||
| 536 | int(*flush)(void*, unsigned int), | 537 | int(*flush)(void*, unsigned int), |
| 537 | unsigned char *output, | 538 | unsigned char *output, |
| 538 | int *posp, | 539 | int *posp, |
| 539 | void(*error_fn)(char *x) | 540 | void(*error)(char *x) |
| 540 | ) | 541 | ) |
| 541 | { | 542 | { |
| 542 | struct lzma_header header; | 543 | struct lzma_header header; |
| @@ -552,7 +553,7 @@ STATIC inline int INIT unlzma(unsigned char *buf, int in_len, | |||
| 552 | unsigned char *inbuf; | 553 | unsigned char *inbuf; |
| 553 | int ret = -1; | 554 | int ret = -1; |
| 554 | 555 | ||
| 555 | set_error_fn(error_fn); | 556 | rc.error = error; |
| 556 | 557 | ||
| 557 | if (buf) | 558 | if (buf) |
| 558 | inbuf = buf; | 559 | inbuf = buf; |
| @@ -659,9 +660,9 @@ STATIC int INIT decompress(unsigned char *buf, int in_len, | |||
| 659 | int(*flush)(void*, unsigned int), | 660 | int(*flush)(void*, unsigned int), |
| 660 | unsigned char *output, | 661 | unsigned char *output, |
| 661 | int *posp, | 662 | int *posp, |
| 662 | void(*error_fn)(char *x) | 663 | void(*error)(char *x) |
| 663 | ) | 664 | ) |
| 664 | { | 665 | { |
| 665 | return unlzma(buf, in_len - 4, fill, flush, output, posp, error_fn); | 666 | return unlzma(buf, in_len - 4, fill, flush, output, posp, error); |
| 666 | } | 667 | } |
| 667 | #endif | 668 | #endif |
diff --git a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c index bcb3a4bd68ff..df3e98f945a6 100644 --- a/lib/decompress_unlzo.c +++ b/lib/decompress_unlzo.c | |||
| @@ -91,7 +91,7 @@ STATIC inline int INIT unlzo(u8 *input, int in_len, | |||
| 91 | int (*fill) (void *, unsigned int), | 91 | int (*fill) (void *, unsigned int), |
| 92 | int (*flush) (void *, unsigned int), | 92 | int (*flush) (void *, unsigned int), |
| 93 | u8 *output, int *posp, | 93 | u8 *output, int *posp, |
| 94 | void (*error_fn) (char *x)) | 94 | void (*error) (char *x)) |
| 95 | { | 95 | { |
| 96 | u8 skip = 0, r = 0; | 96 | u8 skip = 0, r = 0; |
| 97 | u32 src_len, dst_len; | 97 | u32 src_len, dst_len; |
| @@ -99,8 +99,6 @@ STATIC inline int INIT unlzo(u8 *input, int in_len, | |||
| 99 | u8 *in_buf, *in_buf_save, *out_buf; | 99 | u8 *in_buf, *in_buf_save, *out_buf; |
| 100 | int ret = -1; | 100 | int ret = -1; |
| 101 | 101 | ||
| 102 | set_error_fn(error_fn); | ||
| 103 | |||
| 104 | if (output) { | 102 | if (output) { |
| 105 | out_buf = output; | 103 | out_buf = output; |
| 106 | } else if (!flush) { | 104 | } else if (!flush) { |
