From 854789543b5332776051a5a709e467ce4c22bbd3 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Fri, 26 Sep 2025 15:25:02 +0200 Subject: [PATCH] export: use table to parse --format= --- src/import/export.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/import/export.c b/src/import/export.c index b3edc1a787e..d891ca18168 100644 --- a/src/import/export.c +++ b/src/import/export.c @@ -249,17 +249,8 @@ static int parse_argv(int argc, char *argv[]) { return version(); case ARG_FORMAT: - if (streq(optarg, "uncompressed")) - arg_compress = IMPORT_COMPRESS_UNCOMPRESSED; - else if (streq(optarg, "xz")) - arg_compress = IMPORT_COMPRESS_XZ; - else if (streq(optarg, "gzip")) - arg_compress = IMPORT_COMPRESS_GZIP; - else if (streq(optarg, "bzip2")) - arg_compress = IMPORT_COMPRESS_BZIP2; - else if (streq(optarg, "zstd")) - arg_compress = IMPORT_COMPRESS_ZSTD; - else + arg_compress = import_compress_type_from_string(optarg); + if (arg_compress < 0 || arg_compress == IMPORT_COMPRESS_UNKNOWN) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown format: %s", optarg); break; -- 2.47.3