From 8109c094db618bbcae87212e131e59157e7c3a54 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Mon, 29 Apr 2024 22:43:46 +0200 Subject: [PATCH] Update comments --- m-bitset.h | 3 +++ m-string.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/m-bitset.h b/m-bitset.h index 33ff38a5..d8ba32f6 100644 --- a/m-bitset.h +++ b/m-bitset.h @@ -145,6 +145,9 @@ M_INLINE void m_bitset_init_set(m_bitset_t d, const m_bitset_t s) { M_ASSERT (d != s); + // In case of exception, d remains initialized, + // but without any allocation done. + // Therefore it is safe, not to clear d on exception. m_bitset_init(d); m_bitset_set(d, s); } diff --git a/m-string.h b/m-string.h index 9802d9d5..fc0ff412 100644 --- a/m-string.h +++ b/m-string.h @@ -470,6 +470,9 @@ m_string_set_n(m_string_t v, const m_string_t ref, size_t offset, size_t length) M_INLINE void m_string_init_set(m_string_t v1, const m_string_t v2) { + // In case of exception, v1 remains initialized, + // but without any allocation done. + // Therefore it is safe, not to clear v1 on exception. m_string_init(v1); m_string_set(v1,v2); } @@ -479,6 +482,9 @@ m_string_init_set(m_string_t v1, const m_string_t v2) M_INLINE void m_string_init_set_cstr(m_string_t v1, const char str[]) { + // In case of exception, v1 remains initialized, + // but without any allocation done. + // Therefore it is safe, not to clear v1 on exception. m_string_init(v1); m_string_set_cstr(v1, str); }