@@ -1094,7 +1094,8 @@ int critnib_find(struct critnib *c, uintptr_t key, enum find_dir_t dir,
10941094 *
10951095 * If func() returns non-zero, the search is aborted.
10961096 */
1097- static int iter (struct critnib_node * __restrict n , word min , word max ,
1097+ static int iter (struct critnib_node * __restrict n , const word min ,
1098+ const word max ,
10981099 int (* func )(word key , void * value , void * privdata ),
10991100 void * privdata ) {
11001101 if (is_leaf (n )) {
@@ -1129,9 +1130,21 @@ static int iter(struct critnib_node *__restrict n, word min, word max,
11291130void critnib_iter (critnib * c , uintptr_t min , uintptr_t max ,
11301131 int (* func )(uintptr_t key , void * value , void * privdata ),
11311132 void * privdata ) {
1133+ bool wasIterating = false;
11321134 utils_mutex_lock (& c -> mutex );
11331135 if (c -> root ) {
11341136 iter (c -> root , min , max , func , privdata );
1137+ wasIterating = true;
11351138 }
11361139 utils_mutex_unlock (& c -> mutex );
1140+ if (!wasIterating ) {
1141+ LOG_DEBUG ("there was no root, iterating critnib: %p was skipped" ,
1142+ (void * )c );
1143+ }
1144+ }
1145+
1146+ void critnib_iter_all (critnib * c ,
1147+ int (* func )(uintptr_t key , void * value , void * privdata ),
1148+ void * privdata ) {
1149+ critnib_iter (c , 0 , (uintptr_t )-1 , func , privdata );
11371150}
0 commit comments