changeset 23009:7f2568b494ac

lib: str - Add str_replace().
author Stephan Bosch <stephan.bosch@dovecot.fi>
date Fri, 15 Mar 2019 00:14:05 +0100
parents d7ad84cec527
children 727d9990373e
files src/lib/str.h
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/str.h	Thu Mar 14 23:55:00 2019 +0100
+++ b/src/lib/str.h	Fri Mar 15 00:14:05 2019 +0100
@@ -64,6 +64,12 @@
 	buffer_delete(str, pos, len);
 }
 
+static inline void str_replace(string_t *str, size_t pos, size_t len,
+			       const char *cstr)
+{
+	buffer_replace(str, pos, len, cstr, strlen(cstr));
+}
+
 /* Truncate the string to specified length. If it's already smaller,
    do nothing. */
 static inline void str_truncate(string_t *str, size_t len)