From a27b66cdd4f684117e9835bc40f5b5670c8e9655 Mon Sep 17 00:00:00 2001 From: Pierre Le Marre Date: Mon, 25 Sep 2023 09:09:05 +0200 Subject: [PATCH] Remove xkb_compose_table_iterator_current --- bench/compose-traversal.c | 5 +++-- include/xkbcommon/xkbcommon-compose.h | 16 ++-------------- src/compose/table.c | 6 ------ tools/compose.c | 6 +++--- xkbcommon.map | 1 - 5 files changed, 8 insertions(+), 26 deletions(-) diff --git a/bench/compose-traversal.c b/bench/compose-traversal.c index 76bec9043..d239231d1 100644 --- a/bench/compose-traversal.c +++ b/bench/compose-traversal.c @@ -50,6 +50,7 @@ main(void) FILE *file; struct xkb_compose_table *table; struct xkb_compose_table_iterator *iter; + struct xkb_compose_table_entry *entry; struct bench bench; char *elapsed; @@ -81,8 +82,8 @@ main(void) xkb_compose_table_for_each(table, compose_fn, NULL); #else iter = xkb_compose_table_iterator_new(table); - while (xkb_compose_table_iterator_next(iter)) { - assert (xkb_compose_table_iterator_current(iter)); + while ((entry = xkb_compose_table_iterator_next(iter))) { + assert (entry); } xkb_compose_table_iterator_free(iter); #endif diff --git a/include/xkbcommon/xkbcommon-compose.h b/include/xkbcommon/xkbcommon-compose.h index f0e9b9454..f748839b1 100644 --- a/include/xkbcommon/xkbcommon-compose.h +++ b/include/xkbcommon/xkbcommon-compose.h @@ -427,8 +427,8 @@ struct xkb_compose_table_iterator; * * ```c * struct xkb_compose_table_iterator *iter = xkb_compose_table_iterator_new(compose_table); - * while (xkb_compose_table_iterator_next(iter)) { - * struct xkb_compose_table_entry * entry = xkb_compose_table_iterator_current(iter); + * struct xkb_compose_table_entry *entry; + * while (entry = xkb_compose_table_iterator_next(iter)) { * // ... * } * xkb_compose_table_iterator_free(iter); @@ -452,18 +452,6 @@ xkb_compose_table_iterator_new(struct xkb_compose_table *table); void xkb_compose_table_iterator_free(struct xkb_compose_table_iterator *iter); -/** - * Return the current entry of a compose table iterator. - * - * Once the iterator reaches the last entry, this function will keep - * returning this entry. - * - * @memberof xkb_compose_table_iterator - * @since 1.6.0 - */ -struct xkb_compose_table_entry * -xkb_compose_table_iterator_current(struct xkb_compose_table_iterator *iter); - /** * Get the next compose entry from a compose table iterator. * diff --git a/src/compose/table.c b/src/compose/table.c index a8dafb52d..08b1723c4 100644 --- a/src/compose/table.c +++ b/src/compose/table.c @@ -368,12 +368,6 @@ xkb_compose_table_iterator_free(struct xkb_compose_table_iterator *iter) free(iter); } -XKB_EXPORT struct xkb_compose_table_entry * -xkb_compose_table_iterator_current(struct xkb_compose_table_iterator *iter) -{ - return &iter->entry; -} - XKB_EXPORT struct xkb_compose_table_entry * xkb_compose_table_iterator_next(struct xkb_compose_table_iterator *iter) { diff --git a/tools/compose.c b/tools/compose.c index 8321a25fe..3a77347b8 100644 --- a/tools/compose.c +++ b/tools/compose.c @@ -167,10 +167,10 @@ main(int argc, char *argv[]) } } - struct xkb_compose_table_iterator *iter = xkb_compose_table_iterator_new(compose_table); - while (xkb_compose_table_iterator_next(iter)) { - print_compose_table_entry(xkb_compose_table_iterator_current(iter)); + struct xkb_compose_table_entry *entry; + while ((entry = xkb_compose_table_iterator_next(iter))) { + print_compose_table_entry(entry); } xkb_compose_table_iterator_free(iter); diff --git a/xkbcommon.map b/xkbcommon.map index 85f4d67c1..46c98a05a 100644 --- a/xkbcommon.map +++ b/xkbcommon.map @@ -117,7 +117,6 @@ global: xkb_compose_table_entry_utf8; xkb_compose_table_iterator_new; xkb_compose_table_iterator_free; - xkb_compose_table_iterator_current; xkb_compose_table_iterator_next; // [FIXME] remove xkb_compose_table_for_each;