From 644800f593f799502323e21f1ad4d6861f5c5b35 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sat, 7 Jul 2012 14:36:36 +0200 Subject: [PATCH] lzo: Allow for static inlining Signed-off-by: Sascha Hauer --- include/lzo.h | 8 ++++++-- lib/decompress_unlzo.c | 9 +++++++-- lib/lzo/lzo1x_decompress.c | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/lzo.h b/include/lzo.h index 0530a6806..ceacfba69 100644 --- a/include/lzo.h +++ b/include/lzo.h @@ -19,12 +19,16 @@ #define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3) +#ifndef STATIC +#define STATIC +#endif + /* This requires 'workmem' of size LZO1X_1_MEM_COMPRESS */ int lzo1x_1_compress(const unsigned char *src, size_t src_len, unsigned char *dst, size_t *dst_len, void *wrkmem); /* safe decompression with overrun testing */ -int lzo1x_decompress_safe(const unsigned char *src, size_t src_len, +STATIC int lzo1x_decompress_safe(const unsigned char *src, size_t src_len, unsigned char *dst, size_t *dst_len); /* @@ -41,7 +45,7 @@ int lzo1x_decompress_safe(const unsigned char *src, size_t src_len, #define LZO_E_INPUT_NOT_CONSUMED (-8) #define LZO_E_NOT_YET_IMPLEMENTED (-9) -int decompress_unlzo(u8 *input, int in_len, +STATIC int decompress_unlzo(u8 *input, int in_len, int (*fill) (void *, unsigned int), int (*flush) (void *, unsigned int), u8 *output, int *posp, diff --git a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c index 000bd704c..0e6a7ad6d 100644 --- a/lib/decompress_unlzo.c +++ b/lib/decompress_unlzo.c @@ -33,11 +33,16 @@ #include #include #include -#include #include #include #include +#ifdef STATIC +#include "lzo/lzo1x_decompress.c" +#endif + +#include + #include #include @@ -106,7 +111,7 @@ static inline int parse_header(u8 *input, int *skip, int in_len) return 1; } -int decompress_unlzo(u8 *input, int in_len, +STATIC int decompress_unlzo(u8 *input, int in_len, int (*fill) (void *, unsigned int), int (*flush) (void *, unsigned int), u8 *output, int *posp, diff --git a/lib/lzo/lzo1x_decompress.c b/lib/lzo/lzo1x_decompress.c index af943829d..7f1451f08 100644 --- a/lib/lzo/lzo1x_decompress.c +++ b/lib/lzo/lzo1x_decompress.c @@ -23,7 +23,7 @@ #define COPY4(dst, src) \ put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst)) -int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, +STATIC int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, unsigned char *out, size_t *out_len) { const unsigned char * const ip_end = in + in_len;