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=ae0a944c361948800583666bbdedff91d37ccd58

commit ae0a944c361948800583666bbdedff91d37ccd58
Author: Guillem Jover <[email protected]>
AuthorDate: Sun Aug 21 01:48:52 2022 +0200

    dpkg-deb: Refactor parse_compress_type() from set_compress_type()
    
    Changelog: internal
---
 src/deb/main.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/deb/main.c b/src/deb/main.c
index fb997b335..5a7b445e7 100644
--- a/src/deb/main.c
+++ b/src/deb/main.c
@@ -190,16 +190,26 @@ set_compress_strategy(const struct cmdinfo *cip, const 
char *value)
     badusage(_("unknown compression strategy '%s'!"), value);
 }
 
-static void
-set_compress_type(const struct cmdinfo *cip, const char *value)
+static enum compressor_type
+parse_compress_type(const char *value)
 {
-  compress_params.type = compressor_find_by_name(value);
-  if (compress_params.type == COMPRESSOR_TYPE_UNKNOWN)
+  enum compressor_type type;
+
+  type = compressor_find_by_name(value);
+  if (type == COMPRESSOR_TYPE_UNKNOWN)
     badusage(_("unknown compression type '%s'!"), value);
-  if (compress_params.type == COMPRESSOR_TYPE_LZMA)
+  if (type == COMPRESSOR_TYPE_LZMA)
     badusage(_("obsolete compression type '%s'; use xz instead"), value);
-  if (compress_params.type == COMPRESSOR_TYPE_BZIP2)
+  if (type == COMPRESSOR_TYPE_BZIP2)
     badusage(_("obsolete compression type '%s'; use xz or gzip instead"), 
value);
+
+  return type;
+}
+
+static void
+set_compress_type(const struct cmdinfo *cip, const char *value)
+{
+  compress_params.type = parse_compress_type(value);
 }
 
 static long

-- 
Dpkg.Org's dpkg

Reply via email to