8000 add ul_ prefix by karelzak · Pull Request #3569 · util-linux/util-linux · GitHub
[go: up one dir, main page]

Skip to content

add ul_ prefix #3569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

< 8000 /details>
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
treewide: add ul_ to parse_size() function name
Signed-off-by: Karel Zak <kzak@redhat.com>
  • Loading branch information
karelzak committed May 13, 2025
commit c6b3e9888dca27942f38a85ada8710c44e82ef02
2 changes: 1 addition & 1 deletion disk-utils/cfdisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion disk-utils/fdisk.c
< 8000 tr data-hunk="a66b60b4d1e6a2827cb78438934c5e1cc065fbc0206863c162982f0ca036556f" class="show-top-border">
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion include/strutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions lib/strutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -220,7 +220,7 @@ int parse_size(const char *str, uintmax_t *res, int *power)

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)
Expand Down
2 changes: 1 addition & 1 deletion libfdisk/src/gpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions libfdisk/src/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion 2 sys-utils/lscpu-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
0