diff --git a/README.md b/README.md index 0e477b68..8c726695 100644 --- a/README.md +++ b/README.md @@ -1929,6 +1929,7 @@ and `it1` references the inserted element in `list1`. Move all the element of the list `list2` into the list `list1`, moving the last element of `list2` after the first element of `list1`. Afterwards, `list2` remains initialized but is emptied. +`list1` and `list2` shall reference different objects. ##### `void name_reverse(name_t list)` @@ -2082,6 +2083,7 @@ Afterwards, `it` points to the next element of `list2`. Move all the element of the list `list2` into the list `list1`, moving the last element of `list2` after the first element of `list1`. Afterwards, `list2` is emptied. +`list1` and `list2` shall reference different objects. ##### `void name_reverse(name_t list)` @@ -2294,6 +2296,7 @@ comparisons. Move all the elements of the array `array2` to the end of the array `array1`. Afterwards, `array2` is empty. +`array1` and `array2` shall reference different objects. _________________ @@ -2702,6 +2705,7 @@ If there is the same key between `dict2` into `dict1`, then their values are added (as per the `ADD` method of the value type). Afterward `dict2` is reset (i.e. empty). This method is only defined if the value type defines an `ADD` method. +`dict1` and `dict2` shall reference different objects. _________________ @@ -4724,6 +4728,7 @@ This method is created only if the `DIV` operator is defined. Append in `*a` all elements of `*b` and reset `*b`. This method is created only if the `SPLICE` operator is defined. +`a` and `b` shall reference different objects. ##### `bool name_get(value_type *val, const name_t *a, key_type const key)` @@ -5468,6 +5473,7 @@ Afterwards, `it` points to the next element of `list2`. Move all the element of `list2` into `list1`, moving the last element of `list2` after the first element of `list1`. Afterwards, `list2` is emptied. +`list1` and `list2` shall reference different objects. _________________ @@ -6602,6 +6608,7 @@ Append the buffer of 'n' bytes to the byte string `v` Append the byte string `src` to the byte string `dst`, emptying 'src' afterwards. +`dst` and `src` shall reference different objects. ##### `uint8_t bstring_pop_back (bstring_t v)` diff --git a/m-array.h b/m-array.h index 7061986f..7f3a2267 100644 --- a/m-array.h +++ b/m-array.h @@ -958,6 +958,7 @@ { \ M_ARRA4_CONTRACT(a1); \ M_ARRA4_CONTRACT(a2); \ + M_ASSERT(a1 != a2); \ if (M_LIKELY (a2->size > 0)) { \ size_t newSize = a1->size + a2->size; \ /* To overflow newSize, we need to a1 and a2 a little bit above \ diff --git a/m-bstring.h b/m-bstring.h index 50257bcf..37dbb841 100644 --- a/m-bstring.h +++ b/m-bstring.h @@ -214,7 +214,9 @@ m_bstring_push_back_bytes (m_bstring_t v, size_t n, const void *buffer) M_INLINE void m_bstring_splice(m_bstring_t dst, m_bstring_t src) { + M_BSTRING_CONTRACT (dst); M_BSTRING_CONTRACT (src); + M_ASSERT(src != dst); m_bstring_push_back_bytes(dst, m_bstring_size(src), m_bstr1ng_cstr(src)); m_bstring_reset(src); } diff --git a/m-dict.h b/m-dict.h index 5e3d7856..bedbf1ee 100644 --- a/m-dict.h +++ b/m-dict.h @@ -1223,6 +1223,7 @@ ARRAY_DEF(m_array_index, m_indexhash_t, M_POD_OPLIST) M_F(name, _splice)(dict_t d1, dict_t d2) \ { \ dict_it_t it; \ + M_ASSERT(d1 != d2); \ /* NOTE: Despite using set_at, the accessing of the item in d1 \ is not as random as other uses of the HASH table as d2 \ uses the same order than d1 */ \