diff --git a/m-string.h b/m-string.h index a86bbc3c..31157590 100644 --- a/m-string.h +++ b/m-string.h @@ -185,8 +185,17 @@ string_get_cstr(const string_t v) static inline void string_set (string_t v1, const string_t v2) { + STRING_CONTRACT (v1) STRING_CONTRACT (v2); - string_set_str (v1, string_get_cstr(v2)); + size_t size = v2->size; + stringi_fit2size(v1, size+1); + if (v2->ptr != NULL) { + memcpy(v1->ptr, v2->ptr, size+1); + } else { + v1->ptr[0] = 0; + } + v1->size = size; + STRING_CONTRACT (v1); } static inline void