This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=33b0a98e1573de74c3726e4ab79dbaf7d3aef8b6

commit 33b0a98e1573de74c3726e4ab79dbaf7d3aef8b6
Author: Guillem Jover <[email protected]>
AuthorDate: Thu Oct 12 06:07:43 2023 +0200

    dpkg-deb: Refactor legacy compress_params
    
    This is the compression parameters for legacy modes, which we will use
    in other instances. Instead of repeating them, use a single variable
    that we can use to initialize from.
    
    Changelog: internal
---
 src/deb/build.c    | 6 ++----
 src/deb/dpkg-deb.h | 1 +
 src/deb/main.c     | 7 +++++++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/deb/build.c b/src/deb/build.c
index e292de413..597872ba2 100644
--- a/src/deb/build.c
+++ b/src/deb/build.c
@@ -627,10 +627,8 @@ do_build(const char *const *argv)
   if (opt_uniform_compression) {
     control_compress_params = compress_params;
   } else {
-    control_compress_params.type = COMPRESSOR_TYPE_GZIP;
-    control_compress_params.strategy = COMPRESSOR_STRATEGY_NONE;
-    control_compress_params.level = -1;
-    control_compress_params.threads_max = -1;
+    control_compress_params = compress_params_deb0;
+
     if (!compressor_check_params(&control_compress_params, &err))
       internerr("invalid control member compressor params: %s", err.str);
   }
diff --git a/src/deb/dpkg-deb.h b/src/deb/dpkg-deb.h
index c93f07750..eafb5b7c4 100644
--- a/src/deb/dpkg-deb.h
+++ b/src/deb/dpkg-deb.h
@@ -63,6 +63,7 @@ enum DPKG_ATTR_ENUM_FLAGS dpkg_tar_options {
 void extracthalf(const char *debar, const char *dir,
                  enum dpkg_tar_options taroption, int admininfo);
 
+extern struct compress_params compress_params_deb0;
 extern struct compress_params compress_params;
 
 #define ARCHIVEVERSION         "2.0"
diff --git a/src/deb/main.c b/src/deb/main.c
index dbf325ba0..23e06ffda 100644
--- a/src/deb/main.c
+++ b/src/deb/main.c
@@ -163,6 +163,13 @@ set_deb_format(const struct cmdinfo *cip, const char 
*value)
     badusage(_("unknown deb format version: %s"), value);
 }
 
+struct compress_params compress_params_deb0 = {
+  .type = COMPRESSOR_TYPE_GZIP,
+  .strategy = COMPRESSOR_STRATEGY_NONE,
+  .level = -1,
+  .threads_max = -1,
+};
+
 struct compress_params compress_params = {
   .type = DEB_DEFAULT_COMPRESSOR,
   .strategy = COMPRESSOR_STRATEGY_NONE,

-- 
Dpkg.Org's dpkg

Reply via email to