diff options
-rw-r--r-- | sord/sord.h | 4 | ||||
-rw-r--r-- | src/sord.c | 12 | ||||
-rw-r--r-- | src/sord_test.c | 14 | ||||
-rw-r--r-- | src/sordi.c | 2 |
4 files changed, 16 insertions, 16 deletions
diff --git a/sord/sord.h b/sord/sord.h index 0820f9b..4720e76 100644 --- a/sord/sord.h +++ b/sord/sord.h @@ -315,12 +315,12 @@ sord_iter_get_sord(SordIter iter); /** Increment @a iter to point to the next statement. */ SORD_API bool -sord_iter_increment(SordIter iter); +sord_iter_next(SordIter iter); /** Return true iff @a iter is at the end of its range. */ SORD_API bool -sord_iter_is_end(SordIter iter); +sord_iter_end(SordIter iter); /** Free @a iter. */ SORD_API @@ -256,7 +256,7 @@ sord_tuple_compare(const void* x_ptr, const void* y_ptr, void* user_data) } static inline bool -sord_iter_next(SordIter iter) +sord_iter_forward(SordIter iter) { if (!iter->skip_graphs) { iter->cur = g_sequence_iter_next(iter->cur); @@ -286,7 +286,7 @@ sord_iter_seek_match(SordIter iter) { for (iter->end = true; !g_sequence_iter_is_end(iter->cur); - sord_iter_next(iter)) { + sord_iter_forward(iter)) { const SordID* const key = (const SordID*)g_sequence_get(iter->cur); if (sord_tuple_match_inline(key, iter->pat)) return (iter->end = false); @@ -316,7 +316,7 @@ sord_iter_seek_match_range(SordIter iter) return true; } } - } while (!sord_iter_next(iter)); + } while (!sord_iter_forward(iter)); return (iter->end = true); // Reached end } @@ -381,13 +381,13 @@ sord_iter_get(SordIter iter, SordTuple id) } bool -sord_iter_increment(SordIter iter) +sord_iter_next(SordIter iter) { if (iter->end) return true; const SordID* key; - iter->end = sord_iter_next(iter); + iter->end = sord_iter_forward(iter); if (!iter->end) { switch (iter->mode) { case ALL: @@ -432,7 +432,7 @@ sord_iter_increment(SordIter iter) } bool -sord_iter_is_end(SordIter iter) +sord_iter_end(SordIter iter) { return !iter || iter->end; } diff --git a/src/sord_test.c b/src/sord_test.c index 3df3ccc..97b7b4d 100644 --- a/src/sord_test.c +++ b/src/sord_test.c @@ -118,11 +118,11 @@ test_read(Sord sord, const size_t n_tuples, const int n_objects_per) return test_fail(); } - for (; !sord_iter_is_end(iter); sord_iter_increment(iter)) + for (; !sord_iter_end(iter); sord_iter_next(iter)) sord_iter_get(iter, id); // Attempt to increment past end - if (!sord_iter_increment(iter)) { + if (!sord_iter_next(iter)) { fprintf(stderr, "Fail: Successfully incremented past end\n"); return test_fail(); } @@ -149,7 +149,7 @@ test_read(Sord sord, const size_t n_tuples, const int n_objects_per) iter = sord_find(sord, pat); int num_results = 0; - for (; !sord_iter_is_end(iter); sord_iter_increment(iter)) { + for (; !sord_iter_end(iter); sord_iter_next(iter)) { sord_iter_get(iter, id); ++num_results; if (!sord_tuple_match(pat, id)) { @@ -177,7 +177,7 @@ test_read(Sord sord, const size_t n_tuples, const int n_objects_per) fprintf(stderr, "Query " TUP_FMT "... ", TUP_FMT_ARGS(pat)); iter = sord_find(sord, pat); int num_results = 0; - for (; !sord_iter_is_end(iter); sord_iter_increment(iter)) { + for (; !sord_iter_end(iter); sord_iter_next(iter)) { sord_iter_get(iter, id); ++num_results; if (!sord_tuple_match(pat, id)) { @@ -199,7 +199,7 @@ test_read(Sord sord, const size_t n_tuples, const int n_objects_per) pat[0] = pat[1] = pat[2] = 0; SordID last_subject = 0; iter = sord_find(sord, pat); - for (; !sord_iter_is_end(iter); sord_iter_increment(iter)) { + for (; !sord_iter_end(iter); sord_iter_next(iter)) { sord_iter_get(iter, id); if (id[0] == last_subject) continue; @@ -207,7 +207,7 @@ test_read(Sord sord, const size_t n_tuples, const int n_objects_per) SordTuple subpat = { id[0], 0, 0 }; SordIter subiter = sord_find(sord, subpat); int num_sub_results = 0; - for (; !sord_iter_is_end(subiter); sord_iter_increment(subiter)) { + for (; !sord_iter_end(subiter); sord_iter_next(subiter)) { SordTuple subid; sord_iter_get(subiter, subid); if (!sord_tuple_match(subpat, subid)) { @@ -241,7 +241,7 @@ test_write(Sord sord, const size_t n_tuples, const int n_objects_per) // Remove statements SordIter iter; - for (iter = sord_begin(sord); !sord_iter_is_end(iter);) { + for (iter = sord_begin(sord); !sord_iter_end(iter);) { sord_remove_iter(sord, iter); } sord_iter_free(iter); diff --git a/src/sordi.c b/src/sordi.c index 9220c54..6260879 100644 --- a/src/sordi.c +++ b/src/sordi.c @@ -138,7 +138,7 @@ main(int argc, char** argv) // Query SordTuple pat = { 0, 0, 0, 0 }; SordIter iter = sord_find(sord, pat); - for (; !sord_iter_is_end(iter); sord_iter_increment(iter)) { + for (; !sord_iter_end(iter); sord_iter_next(iter)) { SordTuple tup; sord_iter_get(iter, tup); SordNode s, p, o; |