dict_ref & dict_cref returns a pointer to struct pair_s instead of pair_t (which

is an array of struct pair_s).
This will break API compatibility. However:
it makes the user code cleaner as a level of indirection is removed.
it uniformizes with the OA dict version
This commit is contained in:
Patrick Pelissier committed 2017-10-18 23:25:39 +02:00
1 parent 8265ccbb42
commit 8914d336a0
7 files changed
+32 -33

No files matched your search

+3 -3
View File
@@ -18,8 +18,8 @@ int main(void) {
dict_m32_remove(h, 5); // h is now empty
dict_m32_it_t it; // iterate over all dictionnary
for (dict_m32_it (it, h) ; !dict_m32_end_p (it); dict_m32_next(it)) {
dict_m32_pair_t *item = dict_m32_ref(it);
(*item)->value = 1; // Set its value to 1
struct dict_m32_pair_s *item = dict_m32_ref(it);
item->value = 1; // Set its value to 1
}
dict_m32_clear(h); // h is cleared
return 0;
@@ -35,7 +35,7 @@ int main(void) {
assert (is_missing);
dict_m32_remove(h, 5); // h is now empty
for M_EACH(item, h, M32_OPLIST) { // traverse each item
(*item)->value = 1; // Set its value to 1
item->value = 1; // Set its value to 1
}
} // h is cleared
return 0;