mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
util: Remove virParseNumber
We have more modern replacements. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
29a7c2e5d8
commit
e26712d35b
@ -3223,7 +3223,6 @@ virIsSUID;
|
||||
virMemoryLimitIsSet;
|
||||
virMemoryLimitTruncate;
|
||||
virMemoryMaxValue;
|
||||
virParseNumber;
|
||||
virParseOwnershipIds;
|
||||
virParseVersionString;
|
||||
virScaleInteger;
|
||||
|
@ -278,37 +278,6 @@ virScaleInteger(unsigned long long *value, const char *suffix,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virParseNumber:
|
||||
* @str: pointer to the char pointer used
|
||||
*
|
||||
* Parse an unsigned number
|
||||
*
|
||||
* Returns the unsigned number or -1 in case of error. @str will be
|
||||
* updated to skip the number.
|
||||
*/
|
||||
int
|
||||
virParseNumber(const char **str)
|
||||
{
|
||||
int ret = 0;
|
||||
const char *cur = *str;
|
||||
|
||||
if ((*cur < '0') || (*cur > '9'))
|
||||
return -1;
|
||||
|
||||
while (c_isdigit(*cur)) {
|
||||
unsigned int c = *cur - '0';
|
||||
|
||||
if ((ret > INT_MAX / 10) ||
|
||||
((ret == INT_MAX / 10) && (c > INT_MAX % 10)))
|
||||
return -1;
|
||||
ret = ret * 10 + c;
|
||||
cur++;
|
||||
}
|
||||
*str = cur;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* virParseVersionString:
|
||||
* @str: const char pointer to the version string
|
||||
|
@ -54,7 +54,6 @@ int virScaleInteger(unsigned long long *value, const char *suffix,
|
||||
|
||||
int virHexToBin(unsigned char c);
|
||||
|
||||
int virParseNumber(const char **str);
|
||||
int virParseVersionString(const char *str, unsigned long *version,
|
||||
bool allowMissing);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user