From d053eb8096a790d81b67c844d918341e797c2659 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 6 Jan 2020 03:28:28 +0100 Subject: Cleanup: use parse_size function to parse compressor options The XZ option parser had a similar function to parse_size. This commit removes the other implementation and extends parse_size with the one missing feature, i.e. allowing a '%' suffix for a relative value. Signed-off-by: David Oberhollenzer --- include/common.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/common.h b/include/common.h index 5f768c1..386d8fd 100644 --- a/include/common.h +++ b/include/common.h @@ -164,7 +164,11 @@ sqfs_compressor_t *lzo_compressor_create(const sqfs_compressor_config_t *cfg); an error message to stderr and returns -1 on failure, 0 on success. The "what" string is used to prefix error messages (perror style). + + If reference is non-zero, the suffix '%' can be used to compute the result as + a multiple of the reference value. */ -int parse_size(const char *what, size_t *out, const char *str); +int parse_size(const char *what, size_t *out, const char *str, + size_t reference); #endif /* COMMON_H */ -- cgit v1.2.3