Skip to content

Commit

Permalink
Add doxygen and some checks for advance_set_u_iter
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Apr 20, 2024
1 parent 28acc4e commit 57c7acb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion librz/util/set.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,15 @@ RZ_API void set_u_free(RZ_NULLABLE SetU *set) {
ht_up_free((HtUP *)set);
}

/**
* \brief Advances an SetUIter to the next element in
* the set \p s and saves it in \p it->v.
*
* \param s The set to iterate over.
* \param it The iterator over the set.
*/
RZ_API void advance_set_u_iter(SetU *s, SetUIter *it) {
rz_return_if_fail(s && it);
if (it->ti >= s->size) {
it->ti++;
return;
Expand All @@ -93,7 +101,7 @@ RZ_API void advance_set_u_iter(SetU *s, SetUIter *it) {
if (s->table[it->ti].count == 0) {
continue;
}
for (; it->bi < s->table[it->ti].count;) {
if (it->bi < s->table[it->ti].count) {
it->v = s->table[it->ti].arr[it->bi].key;
it->bi++;
return;
Expand Down

0 comments on commit 57c7acb

Please sign in to comment.