diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2018-08-02 11:44:08 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2018-08-02 11:44:08 +0000 |
commit | 924aa77b8e2ecb14ecf7bf69a06a923addea022e (patch) | |
tree | 5d9113dcf4e4af4d5b29f96b91f5c407c69e259c /usr.bin/tmux/cmd-list-keys.c | |
parent | f6d0e683c295297f990b38b0d7387619243b12f5 (diff) |
Make key trees and some other bits static.
Diffstat (limited to 'usr.bin/tmux/cmd-list-keys.c')
-rw-r--r-- | usr.bin/tmux/cmd-list-keys.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-list-keys.c b/usr.bin/tmux/cmd-list-keys.c index 919571f15e8..897def1e0c5 100644 --- a/usr.bin/tmux/cmd-list-keys.c +++ b/usr.bin/tmux/cmd-list-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-keys.c,v 1.44 2017/05/01 12:20:55 nicm Exp $ */ +/* $OpenBSD: cmd-list-keys.c,v 1.45 2018/08/02 11:44:07 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -75,10 +75,14 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) repeat = 0; tablewidth = keywidth = 0; - RB_FOREACH(table, key_tables, &key_tables) { - if (tablename != NULL && strcmp(table->name, tablename) != 0) + table = key_bindings_first_table (); + while (table != NULL) { + if (tablename != NULL && strcmp(table->name, tablename) != 0) { + table = key_bindings_next_table(table); continue; - RB_FOREACH(bd, key_bindings, &table->key_bindings) { + } + bd = key_bindings_first(table); + while (bd != NULL) { key = key_string_lookup_key(bd->key); if (bd->flags & KEY_BINDING_REPEAT) @@ -90,13 +94,20 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) width = utf8_cstrwidth(key); if (width > keywidth) keywidth = width; + + bd = key_bindings_next(table, bd); } + table = key_bindings_next_table(table); } - RB_FOREACH(table, key_tables, &key_tables) { - if (tablename != NULL && strcmp(table->name, tablename) != 0) + table = key_bindings_first_table (); + while (table != NULL) { + if (tablename != NULL && strcmp(table->name, tablename) != 0) { + table = key_bindings_next_table(table); continue; - RB_FOREACH(bd, key_bindings, &table->key_bindings) { + } + bd = key_bindings_first(table); + while (bd != NULL) { key = key_string_lookup_key(bd->key); if (!repeat) @@ -122,7 +133,9 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) free(cp); cmdq_print(item, "bind-key %s", tmp); + bd = key_bindings_next(table, bd); } + table = key_bindings_next_table(table); } return (CMD_RETURN_NORMAL); |