From af82437171e074535ae9d5737126e680008332aa Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 13 May 2025 11:25:39 +0200
Subject: [PATCH 2/4] treewide: add ul_ to parse_size() function name

Signed-off-by: Karel Zak <kzak@redhat.com>
---
 disk-utils/cfdisk.c        | 2 +-
 disk-utils/fdisk.c         | 2 +-
 include/strutils.h         | 2 +-
 lib/strutils.c             | 4 ++--
 libfdisk/src/gpt.c         | 2 +-
 libfdisk/src/script.c      | 8 ++++----
 sys-utils/lscpu-topology.c | 2 +-
 7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c
index e8a8b959a..cdd27f496 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 198d625ba..7aaca5696 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 dd098a318..56a53fdbb 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 374246ce6..b11c325f8 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 <num><suffix> */
 				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 <size><suffix> */
 				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;
 		}
-- 
2.48.1

