diff --git a/m-string.h b/m-string.h index 7d2dfd68..f717e721 100644 --- a/m-string.h +++ b/m-string.h @@ -182,6 +182,7 @@ string_clear(string_t v) /* NOTE: Internaly used by STRING_DECL_INIT */ static inline void m_str1ng_clear2(string_t *v) { string_clear(*v); } +static inline string_ptr m_str1ng_init_ref(string_t v) { string_init(v); return v; } /* Clear the Dynamic string (destructor) and return a heap pointer to the string. @@ -1762,11 +1763,11 @@ namespace m_lib { /* Initialize and set a string to the given formatted value. */ #define string_init_printf(v, ...) \ - (string_init (v), string_printf (v, __VA_ARGS__) ) + (string_printf ( m_str1ng_init_ref(v), __VA_ARGS__) ) /* Initialize and set a string to the given formatted value. */ #define string_init_vprintf(v, format, args) \ - (string_init (v), string_vprintf (v, format, args) ) + (string_vprintf ( m_str1ng_init_ref(v), format, args) ) /* Initialize a string with the given list of arguments. Check if it is a formatted input or not by counting the number of arguments.