diff options
author | raylu-hdf <60487644+raylu-hdf@users.noreply.github.com> | 2022-04-07 21:03:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 21:03:05 (GMT) |
commit | 43ab4e6db135f0d0bacda7d64257b9532381e24a (patch) | |
tree | 46e512e46b1f03ffb7a25a0aabb7be1f10e6d182 /src/H5ESlist.c | |
parent | 715cf1a29b14abd81b4a03421fc742d6f4542fd0 (diff) | |
parent | 33cfd642b55edd63f8c192b941e227b920149fdc (diff) | |
download | hdf5-43ab4e6db135f0d0bacda7d64257b9532381e24a.zip hdf5-43ab4e6db135f0d0bacda7d64257b9532381e24a.tar.gz hdf5-43ab4e6db135f0d0bacda7d64257b9532381e24a.tar.bz2 |
Merge pull request #1601 from HDFGroup/raylu_onion_vfd_4
Sync with the develop branch
Diffstat (limited to 'src/H5ESlist.c')
-rw-r--r-- | src/H5ESlist.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/H5ESlist.c b/src/H5ESlist.c index c0e24cc..61a9dd1 100644 --- a/src/H5ESlist.c +++ b/src/H5ESlist.c @@ -88,6 +88,8 @@ H5ES__list_append(H5ES_event_list_t *el, H5ES_event_t *ev) HDassert(el); HDassert(ev); + ev->next = NULL; + /* Append event onto the event list */ if (NULL == el->tail) el->head = el->tail = ev; @@ -133,7 +135,10 @@ H5ES__list_count(const H5ES_event_list_t *el) * each event. * * Note: Iteration is safe for deleting the current event. Modifying - * the list in other ways is likely unsafe. + * the list in other ways is likely unsafe. If order is + * H5_ITER_INC or H5_ITER_NATIVE events are visited starting + * with the oldest, otherwise they are visited starting with + * the newest. * * Return: SUCCEED / FAIL * @@ -143,7 +148,7 @@ H5ES__list_count(const H5ES_event_list_t *el) *------------------------------------------------------------------------- */ int -H5ES__list_iterate(H5ES_event_list_t *el, H5ES_list_iter_func_t cb, void *ctx) +H5ES__list_iterate(H5ES_event_list_t *el, H5_iter_order_t order, H5ES_list_iter_func_t cb, void *ctx) { H5ES_event_t *ev; /* Event in list */ int ret_value = H5_ITER_CONT; /* Return value */ @@ -155,12 +160,12 @@ H5ES__list_iterate(H5ES_event_list_t *el, H5ES_list_iter_func_t cb, void *ctx) HDassert(cb); /* Iterate over events in list */ - ev = el->head; + ev = (order == H5_ITER_DEC) ? el->tail : el->head; while (ev) { H5ES_event_t *tmp; /* Temporary event */ /* Get pointer to next node, so it's safe if this one is removed */ - tmp = ev->next; + tmp = (order == H5_ITER_DEC) ? ev->prev : ev->next; /* Perform iterator callback */ if ((ret_value = (*cb)(ev, ctx)) != H5_ITER_CONT) { |