diff options
author | Jonathan Lebon <jlebon@redhat.com> | 2017-06-27 20:07:16 -0700 |
---|---|---|
committer | Jonathan Lebon <jlebon@redhat.com> | 2017-06-28 08:04:11 -0700 |
commit | 5ab15ac175ca45fce1b63a910f8ae2c488b92cfe (patch) | |
tree | 3816319bf7ec5b3f4a0bd5ab5d59ff77a787234e /tests | |
parent | 4d34066a2ff5d806db35c3ac765f87ace460fa7e (diff) | |
download | libglnx-5ab15ac175ca45fce1b63a910f8ae2c488b92cfe.tar.gz |
macros: add GLNX_HASH_TABLE_FOREACH_V
Looking at converting the ostree codebase, iterating over only the
values of a hash table (while ignoring the key) is actually a more
common pattern than I thought. So let's give it its own macro as well so
users don't have to resort to the _KV variant.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-libglnx-macros.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test-libglnx-macros.c b/tests/test-libglnx-macros.c index 2a115fc..ffde8fa 100644 --- a/tests/test-libglnx-macros.c +++ b/tests/test-libglnx-macros.c @@ -90,6 +90,14 @@ test_hash_table_foreach (void) i++; } g_assert_cmpuint (i, ==, 2); + + i = 0; + GLNX_HASH_TABLE_FOREACH_V (table, const char*, val) + { + g_assert_cmpstr (val, ==, vals[i]); + i++; + } + g_assert_cmpuint (i, ==, 2); } int main (int argc, char **argv) |