Skip to content

Commit

Permalink
* Added void iwulist_reset(IWULIST *list) (iwarr.h)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamansky committed Nov 11, 2023
1 parent 4c00de5 commit 3ef4018
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
iowow (1.4.17) UNRELEASED; urgency=medium

* Added void iwulist_reset(IWULIST *list) (iwarr.h)
* Added experimental jbn_from_js() (iwjson.h)
* Fixed C++ compilation errors https://github.com/Softmotions/ejdb/issues/381
* Fixed Correct UCS-16 surrogate pair start code point. #51
Expand Down
7 changes: 7 additions & 0 deletions src/utils/iwarr.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ iwrc iwulist_clear(IWULIST *list) {
return 0;
}

void iwulist_reset(IWULIST *list) {
if (list) {
list->start = 0;
list->num = 0;
}
}

void iwulist_destroy_keep(IWULIST *list) {
if (list) {
free(list->array);
Expand Down
6 changes: 6 additions & 0 deletions src/utils/iwarr.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ IW_EXPORT IW_ALLOC IWULIST* iwulist_create(size_t initial_length, size_t unit_si
*/
IW_EXPORT iwrc iwulist_clear(IWULIST *list);

/**
* @brief Resets number of elements to zero.
* Underlying list array is not destroyed.
*/
IW_EXPORT void iwulist_reset(IWULIST *list);

/**
* @brief Destroys and deallocates a given unit list.
*
Expand Down

0 comments on commit 3ef4018

Please sign in to comment.