Skip to content

Commit

Permalink
Clarify constraint on _splice
Browse files Browse the repository at this point in the history
  • Loading branch information
P-p-H-d committed Dec 25, 2024
1 parent 9136a4a commit 4ab2615
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)`

Expand Down Expand Up @@ -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)`

Expand Down Expand Up @@ -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.

_________________

Expand Down Expand Up @@ -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.

_________________

Expand Down Expand Up @@ -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)`

Expand Down Expand Up @@ -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.

_________________

Expand Down Expand Up @@ -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)`

Expand Down
1 change: 1 addition & 0 deletions m-array.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 2 additions & 0 deletions m-bstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions m-dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */ \
Expand Down

0 comments on commit 4ab2615

Please sign in to comment.