Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/util/virstring.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/util/virstring.h b/src/util/virstring.h
index a5550e30d2e2..603650aa1588 100644
--- a/src/util/virstring.h
+++ b/src/util/virstring.h
@@ -288,4 +288,12 @@ bool virStringBufferIsPrintable(const uint8_t *buf, size_t buflen);
char *virStringEncodeBase64(const uint8_t *buf, size_t buflen);
+static inline void
+virStringTrimOptionalNewline(char *str)
+{
+ char *tmp = str + strlen(str) - 1;
+ if (*tmp == '\n')
+ *tmp = '\0';
+}
+
#endif /* __VIR_STRING_H__ */
--
2.12.2