From: Stephan Bosch Date: Fri, 6 Jan 2023 15:43:56 +0000 (+0100) Subject: lib: str - Add str_clear() and str_clear_safe(). X-Git-Tag: 2.4.0~3151 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0d2d2d86c2572e8738a491d36c543b900f4b6be;p=thirdparty%2Fdovecot%2Fcore.git lib: str - Add str_clear() and str_clear_safe(). --- diff --git a/src/lib/str.h b/src/lib/str.h index f0ec8f1f4f..0fc148ec94 100644 --- a/src/lib/str.h +++ b/src/lib/str.h @@ -91,6 +91,16 @@ static inline void str_truncate(string_t *str, size_t len) buffer_set_used_size(str, len); } +/* Clear the string */ +static inline void str_clear(string_t *str) +{ + buffer_clear(str); +} +static inline void str_clear_safe(string_t *str) +{ + buffer_clear_safe(str); +} + /* Truncate the string to specified length, but also make sure the truncation doesn't happen in the middle of an UTF-8 character sequence. In that case, the string will end up being up to a few bytes smaller than len. If it's