# HG changeset patch
# User Lasse Collin <lasse.collin@xxxxxxxxxxx>
# Date 1321018161 -3600
# Node ID b2891cecc67630767cdf81a08ee82ed5c9929a45
# Parent b44278816b72557c9de29681f58daf107806a18d
Decompressors: get rid of set_error_fn() macro
From: Lasse Collin <lasse.collin@xxxxxxxxxxx>
set_error_fn() is a useless complication. Only unlzma.c had some use
for it and that was easy to change too.
This also gets rid of the static function pointer "error".
Signed-off-by: Lasse Collin <lasse.collin@xxxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
diff -r b44278816b72 -r b2891cecc676 xen/common/bunzip2.c
--- a/xen/common/bunzip2.c Fri Nov 11 14:27:41 2011 +0100
+++ b/xen/common/bunzip2.c Fri Nov 11 14:29:21 2011 +0100
@@ -666,13 +666,12 @@
int(*flush)(void*, unsigned int),
unsigned char *outbuf,
unsigned int *pos,
- void(*error_fn)(const char *x))
+ void(*error)(const char *x))
{
struct bunzip_data *bd;
int i = -1;
unsigned char *inbuf;
- set_error_fn(error_fn);
if (flush)
outbuf = malloc(BZIP2_IOBUF_SIZE);
diff -r b44278816b72 -r b2891cecc676 xen/common/decompress.h
--- a/xen/common/decompress.h Fri Nov 11 14:27:41 2011 +0100
+++ b/xen/common/decompress.h Fri Nov 11 14:29:21 2011 +0100
@@ -10,9 +10,6 @@
#define INIT __init
#define INITDATA __initdata
-static void(*__initdata error)(const char *);
-#define set_error_fn(x) error = x;
-
#define malloc xmalloc_bytes
#define free xfree
diff -r b44278816b72 -r b2891cecc676 xen/common/unlzma.c
--- a/xen/common/unlzma.c Fri Nov 11 14:27:41 2011 +0100
+++ b/xen/common/unlzma.c Fri Nov 11 14:29:21 2011 +0100
@@ -67,6 +67,7 @@
uint32_t code;
uint32_t range;
uint32_t bound;
+ void (*error)(const char *);
};
@@ -85,7 +86,7 @@
{
rc->buffer_size = rc->fill((char *)rc->buffer, LZMA_IOBUF_SIZE);
if (rc->buffer_size <= 0)
- error("unexpected EOF");
+ rc->error("unexpected EOF");
rc->ptr = rc->buffer;
rc->buffer_end = rc->buffer + rc->buffer_size;
}
@@ -529,7 +530,7 @@
int(*flush)(void*, unsigned int),
unsigned char *output,
unsigned int *posp,
- void(*error_fn)(const char *x)
+ void(*error)(const char *x)
)
{
struct lzma_header header;
@@ -545,7 +546,7 @@
unsigned char *inbuf;
int ret = -1;
- set_error_fn(error_fn);
+ rc.error = error;
if (buf)
inbuf = buf;
diff -r b44278816b72 -r b2891cecc676 xen/common/unlzo.c
--- a/xen/common/unlzo.c Fri Nov 11 14:27:41 2011 +0100
+++ b/xen/common/unlzo.c Fri Nov 11 14:29:21 2011 +0100
@@ -105,7 +105,7 @@
int (*fill) (void *, unsigned int),
int (*flush) (void *, unsigned int),
u8 *output, unsigned int *posp,
- void (*error_fn) (const char *x))
+ void (*error) (const char *x))
{
u8 skip = 0, r = 0;
u32 src_len, dst_len;
@@ -113,8 +113,6 @@
u8 *in_buf, *in_buf_save, *out_buf;
int ret = -1;
- set_error_fn(error_fn);
-
if (output) {
out_buf = output;
} else if (!flush) {
diff -r b44278816b72 -r b2891cecc676 xen/common/unxz.c
--- a/xen/common/unxz.c Fri Nov 11 14:27:41 2011 +0100
+++ b/xen/common/unxz.c Fri Nov 11 14:29:21 2011 +0100
@@ -161,15 +161,13 @@
int (*fill)(void *dest, unsigned int size),
int (*flush)(void *src, unsigned int size),
unsigned char *out, unsigned int *in_used,
- void (*error_fn)(const char *x))
+ void (*error)(const char *x))
{
struct xz_buf b;
struct xz_dec *s;
enum xz_ret ret;
bool_t must_free_in = false;
- set_error_fn(error_fn);
-
xz_crc32_init();
if (in_used != NULL)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|