X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=urcu%2Frcuja.h;h=82e272bd4ede1aec436845aef287754dd1dab8b6;hb=1e88c1e4bd36d144cb7c08f434209e48aa560170;hp=164b05a3fdf481904270412e0225f042a42310df;hpb=12f246ace65311b9b269abec5572078293065f4b;p=userspace-rcu.git diff --git a/urcu/rcuja.h b/urcu/rcuja.h index 164b05a..82e272b 100644 --- a/urcu/rcuja.h +++ b/urcu/rcuja.h @@ -56,6 +56,10 @@ void cds_ja_node_init(struct cds_ja_node *node) { } +/* + * Note: key UINT64_MAX is reserved internally for iteration. + */ + /* * cds_ja_lookup - look up by key. * @ja: the Judy array. @@ -202,7 +206,9 @@ int cds_ja_destroy(struct cds_ja *ja); */ #define cds_ja_for_each_key_rcu(ja, key, pos) \ for ((key) = 0; \ - ((pos) = cds_ja_lookup_above_equal(ja, key, &(key))); ) + ((key) != UINT64_MAX ? \ + ((pos) = cds_ja_lookup_above_equal(ja, key, &(key))) : 0); \ + (key)++) /* * cds_ja_for_each_key_prev_rcu: Iterate over all keys in descending order. @@ -216,8 +222,10 @@ int cds_ja_destroy(struct cds_ja *ja); * Safe against node removal during iteration. */ #define cds_ja_for_each_key_prev_rcu(ja, key, pos) \ - for ((key) = UINT64_MAX; \ - ((pos) = cds_ja_lookup_below_equal(ja, key, &(key))); ) + for ((key) = UINT64_MAX - 1; \ + ((key) != UINT64_MAX ? \ + ((pos) = cds_ja_lookup_below_equal(ja, key, &(key))) : 0); \ + (key)--) #ifdef __cplusplus }