Add a surprisingly missing simple function to the arsenal.
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/virstring.c | 17 +++++++++++++++++
src/util/virstring.h | 1 +
3 files changed, 19 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index a943a79e01..3e8eded81e 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3409,6 +3409,7 @@ virSkipSpaces;
virSkipSpacesAndBackslash;
virSkipSpacesBackwards;
virSkipToDigit;
+virSkipToSpace;
virStrcpy;
virStringBufferIsPrintable;
virStringFilterChars;
diff --git a/src/util/virstring.c b/src/util/virstring.c
index 6b728ff047..4a732de5dc 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -441,6 +441,23 @@ virSkipToDigit(const char **str)
}
+/**
+ * virSkipToSApace:
+ * @str: pointer to the char pointer used
+ *
+ * Skip over any character that is not whitespace
+ */
+void
+virSkipToSpace(const char **str)
+{
+ const char *cur = *str;
+
+ while (*cur && !g_ascii_isspace(*cur))
+ cur++;
+ *str = cur;
+}
+
+
/**
* virTrimSpaces:
* @str: string to modify to remove all trailing spaces
diff --git a/src/util/virstring.h b/src/util/virstring.h
index 16dcce98f4..9fd8be44cf 100644
--- a/src/util/virstring.h
+++ b/src/util/virstring.h
@@ -74,6 +74,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 virSkipToSpace(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);
--
2.41.0