]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: str - Add str_replace().
authorStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 14 Mar 2019 23:14:05 +0000 (00:14 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 10 Sep 2019 08:51:09 +0000 (11:51 +0300)
src/lib/str.h

index e29b9b0cad69d563a29336419c0d45ed99c823fa..3dc83208afc026f5a2140a0b6aae6c40ce3f9cef 100644 (file)
@@ -70,6 +70,12 @@ static inline void str_delete(string_t *str, size_t pos, size_t len)
        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)