From 2985342b90e77abf6899ba2aa05785fd63e2e392 Mon Sep 17 00:00:00 2001 From: Tomas Mlcoch Date: Thu, 12 Sep 2013 16:33:10 +0200 Subject: [PATCH] mergerepo: refactoring --- src/mergerepo_c.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/mergerepo_c.c b/src/mergerepo_c.c index e096b9d..ca3d8c5 100644 --- a/src/mergerepo_c.c +++ b/src/mergerepo_c.c @@ -319,19 +319,17 @@ check_arguments(struct CmdOptions *options) // Compress type if (options->compress_type) { - if (!g_strcmp0(options->compress_type, "gz")) { - options->db_compression_type = CR_CW_GZ_COMPRESSION; - options->groupfile_compression_type = CR_CW_GZ_COMPRESSION; - } else if (!g_strcmp0(options->compress_type, "bz2")) { - options->db_compression_type = CR_CW_BZ2_COMPRESSION; - options->groupfile_compression_type = CR_CW_BZ2_COMPRESSION; - } else if (!g_strcmp0(options->compress_type, "xz")) { - options->db_compression_type = CR_CW_XZ_COMPRESSION; - options->groupfile_compression_type = CR_CW_XZ_COMPRESSION; - } else { + + cr_CompressionType type; + type = cr_compression_type(options->compress_type); + + if (type == CR_CW_UNKNOWN_COMPRESSION) { g_critical("Compression %s not available: Please choose from: " "gz or bz2 or xz", options->compress_type); ret = FALSE; + } else { + options->db_compression_type = type; + options->groupfile_compression_type = type; } } -- 2.7.4