X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=urcu%2Frcuja.h;h=82e272bd4ede1aec436845aef287754dd1dab8b6;hb=102b3189f786194f1a78b53077cf9a4e100ee2e3;hp=164b05a3fdf481904270412e0225f042a42310df;hpb=cd7eb7a38f2a34ff10674795f3022f676b201e49;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 }