@@ -1094,7 +1094,8 @@ int critnib_find(struct critnib *c, uintptr_t key, enum find_dir_t dir,
1094
1094
*
1095
1095
* If func() returns non-zero, the search is aborted.
1096
1096
*/
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 ,
1098
1099
int (* func )(word key , void * value , void * privdata ),
1099
1100
void * privdata ) {
1100
1101
if (is_leaf (n )) {
@@ -1129,9 +1130,21 @@ static int iter(struct critnib_node *__restrict n, word min, word max,
1129
1130
void critnib_iter (critnib * c , uintptr_t min , uintptr_t max ,
1130
1131
int (* func )(uintptr_t key , void * value , void * privdata ),
1131
1132
void * privdata ) {
1133
+ bool wasIterating = false;
1132
1134
utils_mutex_lock (& c -> mutex );
1133
1135
if (c -> root ) {
1134
1136
iter (c -> root , min , max , func , privdata );
1137
+ wasIterating = true;
1135
1138
}
1136
1139
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 );
1137
1150
}
0 commit comments