summaryrefslogtreecommitdiff
path: root/libarchive/archive_write_add_filter_gzip.c
diff options
context:
space:
mode:
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>2012-10-12 05:15:29 +0900
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>2012-10-12 05:15:29 +0900
commitee9bf37b9215d46783afec37c0b8abb807868c93 (patch)
tree9a05ec61903a8bc530f5be1207de4329cdcc5b83 /libarchive/archive_write_add_filter_gzip.c
parentd3c337cca933f6e46bf36b60f3ee06954e68f2dc (diff)
downloadlibarchive-ee9bf37b9215d46783afec37c0b8abb807868c93.tar.gz
Move archive_compressor_gzip_free and archive_compressor_gzip_options
after archive_write_add_filter_gzip. This is preparation to use an external program gzip if zlib is not available.
Diffstat (limited to 'libarchive/archive_write_add_filter_gzip.c')
-rw-r--r--libarchive/archive_write_add_filter_gzip.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/libarchive/archive_write_add_filter_gzip.c b/libarchive/archive_write_add_filter_gzip.c
index 398751f3..3d3f1f47 100644
--- a/libarchive/archive_write_add_filter_gzip.c
+++ b/libarchive/archive_write_add_filter_gzip.c
@@ -120,6 +120,39 @@ archive_write_add_filter_gzip(struct archive *_a)
return (ARCHIVE_OK);
}
+static int
+archive_compressor_gzip_free(struct archive_write_filter *f)
+{
+ struct private_data *data = (struct private_data *)f->data;
+ free(data->compressed);
+ free(data);
+ f->data = NULL;
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Set write options.
+ */
+static int
+archive_compressor_gzip_options(struct archive_write_filter *f, const char *key,
+ const char *value)
+{
+ struct private_data *data = (struct private_data *)f->data;
+
+ if (strcmp(key, "compression-level") == 0) {
+ if (value == NULL || !(value[0] >= '0' && value[0] <= '9') ||
+ value[1] != '\0')
+ return (ARCHIVE_WARN);
+ data->compression_level = value[0] - '0';
+ return (ARCHIVE_OK);
+ }
+
+ /* Note: The "warn" return is just to inform the options
+ * supervisor that we didn't handle it. It will generate
+ * a suitable error if no one used this option. */
+ return (ARCHIVE_WARN);
+}
+
/*
* Setup callback.
*/
@@ -215,29 +248,6 @@ archive_compressor_gzip_open(struct archive_write_filter *f)
}
/*
- * Set write options.
- */
-static int
-archive_compressor_gzip_options(struct archive_write_filter *f, const char *key,
- const char *value)
-{
- struct private_data *data = (struct private_data *)f->data;
-
- if (strcmp(key, "compression-level") == 0) {
- if (value == NULL || !(value[0] >= '0' && value[0] <= '9') ||
- value[1] != '\0')
- return (ARCHIVE_WARN);
- data->compression_level = value[0] - '0';
- return (ARCHIVE_OK);
- }
-
- /* Note: The "warn" return is just to inform the options
- * supervisor that we didn't handle it. It will generate
- * a suitable error if no one used this option. */
- return (ARCHIVE_WARN);
-}
-
-/*
* Write data to the compressed stream.
*/
static int
@@ -303,16 +313,6 @@ archive_compressor_gzip_close(struct archive_write_filter *f)
return (r1 < ret ? r1 : ret);
}
-static int
-archive_compressor_gzip_free(struct archive_write_filter *f)
-{
- struct private_data *data = (struct private_data *)f->data;
- free(data->compressed);
- free(data);
- f->data = NULL;
- return (ARCHIVE_OK);
-}
-
/*
* Utility function to push input data through compressor,
* writing full output blocks as necessary.