CLEANUP: compression: statify all algo-specific functions
There's no reason for exporting identity_* nor deflate_*, they're only
used in the same file. Mark them static, it will make it easier to add
other algorithms.
diff --git a/src/compression.c b/src/compression.c
index 074902e..eadeb9d 100644
--- a/src/compression.c
+++ b/src/compression.c
@@ -55,6 +55,21 @@
unsigned int compress_min_idle = 0;
static struct pool_head *pool_comp_ctx = NULL;
+static int identity_init(struct comp_ctx **comp_ctx, int level);
+static int identity_add_data(struct comp_ctx *comp_ctx, const char *in_data, int in_len, struct buffer *out);
+static int identity_flush(struct comp_ctx *comp_ctx, struct buffer *out, int flag);
+static int identity_reset(struct comp_ctx *comp_ctx);
+static int identity_end(struct comp_ctx **comp_ctx);
+
+#ifdef USE_ZLIB
+static int gzip_init(struct comp_ctx **comp_ctx, int level);
+static int deflate_init(struct comp_ctx **comp_ctx, int level);
+static int deflate_add_data(struct comp_ctx *comp_ctx, const char *in_data, int in_len, struct buffer *out);
+static int deflate_flush(struct comp_ctx *comp_ctx, struct buffer *out, int flag);
+static int deflate_reset(struct comp_ctx *comp_ctx);
+static int deflate_end(struct comp_ctx **comp_ctx);
+#endif /* USE_ZLIB */
+
const struct comp_algo comp_algos[] =
{
@@ -374,7 +389,7 @@
/*
* Init the identity algorithm
*/
-int identity_init(struct comp_ctx **comp_ctx, int level)
+static int identity_init(struct comp_ctx **comp_ctx, int level)
{
return 0;
}
@@ -383,7 +398,7 @@
* Process data
* Return size of consumed data or -1 on error
*/
-int identity_add_data(struct comp_ctx *comp_ctx, const char *in_data, int in_len, struct buffer *out)
+static int identity_add_data(struct comp_ctx *comp_ctx, const char *in_data, int in_len, struct buffer *out)
{
char *out_data = bi_end(out);
int out_len = out->size - buffer_len(out);
@@ -398,12 +413,12 @@
return in_len;
}
-int identity_flush(struct comp_ctx *comp_ctx, struct buffer *out, int flag)
+static int identity_flush(struct comp_ctx *comp_ctx, struct buffer *out, int flag)
{
return 0;
}
-int identity_reset(struct comp_ctx *comp_ctx)
+static int identity_reset(struct comp_ctx *comp_ctx)
{
return 0;
}
@@ -411,7 +426,7 @@
/*
* Deinit the algorithm
*/
-int identity_end(struct comp_ctx **comp_ctx)
+static int identity_end(struct comp_ctx **comp_ctx)
{
return 0;
}
@@ -506,7 +521,7 @@
/**************************
**** gzip algorithm ****
***************************/
-int gzip_init(struct comp_ctx **comp_ctx, int level)
+static int gzip_init(struct comp_ctx **comp_ctx, int level)
{
z_stream *strm;
@@ -528,7 +543,7 @@
**** Deflate algorithm ****
***************************/
-int deflate_init(struct comp_ctx **comp_ctx, int level)
+static int deflate_init(struct comp_ctx **comp_ctx, int level)
{
z_stream *strm;
@@ -548,7 +563,7 @@
}
/* Return the size of consumed data or -1 */
-int deflate_add_data(struct comp_ctx *comp_ctx, const char *in_data, int in_len, struct buffer *out)
+static int deflate_add_data(struct comp_ctx *comp_ctx, const char *in_data, int in_len, struct buffer *out)
{
int ret;
z_stream *strm = &comp_ctx->strm;
@@ -577,7 +592,7 @@
return in_len - strm->avail_in;
}
-int deflate_flush(struct comp_ctx *comp_ctx, struct buffer *out, int flag)
+static int deflate_flush(struct comp_ctx *comp_ctx, struct buffer *out, int flag)
{
int ret;
int out_len = 0;
@@ -611,7 +626,7 @@
return out_len;
}
-int deflate_reset(struct comp_ctx *comp_ctx)
+static int deflate_reset(struct comp_ctx *comp_ctx)
{
z_stream *strm = &comp_ctx->strm;
@@ -620,7 +635,7 @@
return -1;
}
-int deflate_end(struct comp_ctx **comp_ctx)
+static int deflate_end(struct comp_ctx **comp_ctx)
{
z_stream *strm = &(*comp_ctx)->strm;
int ret;