X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=urcu%2Frcuja.h;h=82e272bd4ede1aec436845aef287754dd1dab8b6;hb=refs%2Fheads%2Furcu%2Frcuja-range;hp=637366778d0ff1e664723e3ff2e006d50f171b22;hpb=170e11866c8a4bb6c3b2bf0a1e86e8b60a44059b;p=userspace-rcu.git diff --git a/urcu/rcuja.h b/urcu/rcuja.h index 6373667..82e272b 100644 --- a/urcu/rcuja.h +++ b/urcu/rcuja.h @@ -25,12 +25,10 @@ * Include this file _after_ including your URCU flavor. */ -#include #include #include #include #include -#include #ifdef __cplusplus extern "C" { @@ -58,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. @@ -204,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. @@ -218,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 }