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) {
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));
/* 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);
* 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;
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)
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)
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) {
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) {
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)
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);
}
/* 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;
}