From: Karel Zak Date: Tue, 13 May 2025 09:25:39 +0000 (+0200) Subject: treewide: add ul_ to parse_size() function name X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c6b3e9888dca27942f38a85ada8710c44e82ef02;p=thirdparty%2Futil-linux.git treewide: add ul_ to parse_size() function name Signed-off-by: Karel Zak --- diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c index 594dacaac..fdd74fbf9 100644 --- a/disk-utils/cfdisk.c +++ b/disk-utils/cfdisk.c @@ -1955,7 +1955,7 @@ static int ui_get_size(struct cfdisk *cf, /* context */ insec = 1; buf[len - 1] = '\0'; } - rc = parse_size(buf, (uintmax_t *)&user, &pwr); /* parse */ + rc = ul_parse_size(buf, (uintmax_t *)&user, &pwr); /* parse */ } if (rc == 0) { diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index 7c459c734..42a429c1f 100644 --- a/disk-utils/fdisk.c +++ b/disk-utils/fdisk.c @@ -359,7 +359,7 @@ static int ask_offset(struct fdisk_context *cxt, p++; } - rc = parse_size(p, &num, &pwr); + rc = ul_parse_size(p, &num, &pwr); if (rc) continue; DBG(ASK, ul_debug("parsed size: %ju", num)); diff --git a/include/strutils.h b/include/strutils.h index 58cca41c9..aab45fe4c 100644 --- a/include/strutils.h +++ b/include/strutils.h @@ -21,7 +21,7 @@ /* initialize a custom exit code for all *_or_err functions */ extern void strutils_set_exitcode(int exit_code); -extern int parse_size(const char *str, uintmax_t *res, int *power); +extern int ul_parse_size(const char *str, uintmax_t *res, int *power); extern int strtosize(const char *str, uintmax_t *res); extern uintmax_t strtosize_or_err(const char *str, const char *errmesg); diff --git a/lib/strutils.c b/lib/strutils.c index cfa4d262d..a0f0dc224 100644 --- a/lib/strutils.c +++ b/lib/strutils.c @@ -64,7 +64,7 @@ static int do_scale_by_power (uintmax_t *x, int base, int power) * Note that the function does not accept numbers with '-' (negative sign) * prefix. */ -int parse_size(const char *str, uintmax_t *res, int *power) +int ul_parse_size(const char *str, uintmax_t *res, int *power) { const char *p; char *end; @@ -220,7 +220,7 @@ err: int strtosize(const char *str, uintmax_t *res) { - return parse_size(str, res, NULL); + return ul_parse_size(str, res, NULL); } int isdigit_strend(const char *str, const char **end) diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c index 2f850fa8a..8a052852a 100644 --- a/libfdisk/src/gpt.c +++ b/libfdisk/src/gpt.c @@ -735,7 +735,7 @@ static int get_script_u64(struct fdisk_context *cxt, uint64_t *num, const char * if (!str) return 1; - rc = parse_size(str, (uintmax_t *) num, &pwr); + rc = ul_parse_size(str, (uintmax_t *) num, &pwr); if (rc < 0) return rc; if (pwr) diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c index 6bb642f02..e782f37c5 100644 --- a/libfdisk/src/script.c +++ b/libfdisk/src/script.c @@ -1024,7 +1024,7 @@ static int parse_start_value(struct fdisk_script *dp, struct fdisk_partition *pa int pow = 0, sign = skip_optional_sign(&tk); uint64_t num; - rc = parse_size(tk, (uintmax_t *) &num, &pow); + rc = ul_parse_size(tk, (uintmax_t *) &num, &pow); if (!rc) { if (pow) { /* specified as */ if (!dp->cxt->sector_size) { @@ -1080,7 +1080,7 @@ static int parse_size_value(struct fdisk_script *dp, struct fdisk_partition *pa, int pow = 0, sign = skip_optional_sign(&tk); uint64_t num; - rc = parse_size(tk, (uintmax_t *) &num, &pow); + rc = ul_parse_size(tk, (uintmax_t *) &num, &pow); if (!rc) { if (pow) { /* specified as */ if (!dp->cxt->sector_size) { @@ -1564,7 +1564,7 @@ int fdisk_apply_script_headers(struct fdisk_context *cxt, struct fdisk_script *d if (str) { uintmax_t sz; - rc = parse_size(str, &sz, NULL); + rc = ul_parse_size(str, &sz, NULL); if (rc == 0) rc = fdisk_save_user_grain(cxt, sz); if (rc) @@ -1591,7 +1591,7 @@ int fdisk_apply_script_headers(struct fdisk_context *cxt, struct fdisk_script *d if (str) { uintmax_t sz; - rc = parse_size(str, &sz, NULL); + rc = ul_parse_size(str, &sz, NULL); if (rc == 0) rc = fdisk_gpt_set_npartitions(cxt, sz); } diff --git a/sys-utils/lscpu-topology.c b/sys-utils/lscpu-topology.c index 36a217bc7..6e0782f64 100644 --- a/sys-utils/lscpu-topology.c +++ b/sys-utils/lscpu-topology.c @@ -509,7 +509,7 @@ static int read_caches(struct lscpu_cxt *cxt, struct lscpu_cpu *cpu) /* cache size */ if (ul_path_readf_buffer(sys, buf, sizeof(buf), "cpu%d/cache/index%zu/size", num, i) > 0) - parse_size(buf, &ca->size, NULL); + ul_parse_size(buf, &ca->size, NULL); else ca->size = 0; }