diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-11-28 16:11:22 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-11-28 16:11:22 +0100 |
commit | 7f53d2785816e5b65dfdb0daa4039249569e58f9 (patch) | |
tree | b8d44ef940d87ccc110501cbe66c5a5a3cbedbfb /tar | |
parent | 9e91c1558c40eaabd38f8f422555d6d8831e527f (diff) |
Cleanup: Return combined return value from compressor id by name
Instead of returning the ID through a pointer and an error code as
return status, return a single int that could be a compressor ID
(positive values) or an error code (negative values).
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tar')
-rw-r--r-- | tar/tar2sqfs.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c index 0076537..56ae5dc 100644 --- a/tar/tar2sqfs.c +++ b/tar/tar2sqfs.c @@ -97,7 +97,7 @@ static FILE *input_file = NULL; static void process_args(int argc, char **argv) { bool have_compressor; - int i; + int i, ret; sqfs_writer_cfg_init(&cfg); @@ -120,23 +120,23 @@ static void process_args(int argc, char **argv) break; case 'c': have_compressor = true; + ret = sqfs_compressor_id_from_name(optarg); - if (sqfs_compressor_id_from_name(optarg, &cfg.comp_id)) + if (ret < 0) { have_compressor = false; - - if (!sqfs_compressor_exists(cfg.comp_id)) - have_compressor = false; - #ifdef WITH_LZO - if (cfg.comp_id == SQFS_COMP_LZO) - have_compressor = true; + if (cfg.comp_id == SQFS_COMP_LZO) + have_compressor = true; #endif + } if (!have_compressor) { fprintf(stderr, "Unsupported compressor '%s'\n", optarg); exit(EXIT_FAILURE); } + + cfg.comp_id = ret; break; case 'j': cfg.num_jobs = strtol(optarg, NULL, 0); |