mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
util: new function virSkipToDigit()
This function skips over the beginning of a string until it reaches a decimal digit (0-9) or the NULL at the end of the string. The original pointer is modified in place (similar to virSkipSpaces()). Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
dc837a412f
commit
0e89a7b4e0
@ -3217,6 +3217,7 @@ virStorageFileBackendRegister;
|
||||
virSkipSpaces;
|
||||
virSkipSpacesAndBackslash;
|
||||
virSkipSpacesBackwards;
|
||||
virSkipToDigit;
|
||||
virStrcpy;
|
||||
virStringBufferIsPrintable;
|
||||
virStringFilterChars;
|
||||
|
@ -752,6 +752,24 @@ virSkipSpacesAndBackslash(const char **str)
|
||||
*str = cur;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virSkipToDigit:
|
||||
* @str: pointer to the char pointer used
|
||||
*
|
||||
* Skip over any character that is not 0-9
|
||||
*/
|
||||
void
|
||||
virSkipToDigit(const char **str)
|
||||
{
|
||||
const char *cur = *str;
|
||||
|
||||
while (*cur && !g_ascii_isdigit(*cur))
|
||||
cur++;
|
||||
*str = cur;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virTrimSpaces:
|
||||
* @str: string to modify to remove all trailing spaces
|
||||
|
@ -110,6 +110,7 @@ int virDoubleToStr(char **strp, double number)
|
||||
|
||||
void virSkipSpaces(const char **str) ATTRIBUTE_NONNULL(1);
|
||||
void virSkipSpacesAndBackslash(const char **str) ATTRIBUTE_NONNULL(1);
|
||||
void virSkipToDigit(const char **str) ATTRIBUTE_NONNULL(1);
|
||||
void virTrimSpaces(char *str, char **endp) ATTRIBUTE_NONNULL(1);
|
||||
void virSkipSpacesBackwards(const char *str, char **endp)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user