about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorSteffen Jaeckel <jaeckel-floss@eyet-services.de>2023-04-02 14:39:54 +0200
committerSteffen Jaeckel <jaeckel-floss@eyet-services.de>2023-04-04 10:58:52 +0200
commit74415ae71d287d097a7adadea34cb8662735b530 (patch)
treeacf6c22d1f09ee071bfc7d8eb7a5b708861108ad /src/command
parent0242576d7c00e529f8fefc2c30d7415b13595c95 (diff)
downloadprofani-tty-74415ae71d287d097a7adadea34cb8662735b530.tar.gz
refactor into array of a `struct`
...instead of having two separate arrays.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_ac.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index c986be5e..0cc4a170 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -2083,11 +2083,21 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
         }
     }
 
-    gchar* cmds[] = { "/prefs", "/disco", "/room", "/autoping", "/mainwin", "/inputwin" };
-    Autocomplete completers[] = { prefs_ac, disco_ac, room_ac, autoping_ac, winpos_ac, winpos_ac };
-
-    for (int i = 0; i < ARRAY_SIZE(cmds); i++) {
-        result = autocomplete_param_with_ac(input, cmds[i], completers[i], TRUE, previous);
+    struct
+    {
+        gchar* cmd;
+        Autocomplete completer;
+    } ac_cmds[] = {
+        { "/prefs", prefs_ac },
+        { "/disco", disco_ac },
+        { "/room", room_ac },
+        { "/autoping", autoping_ac },
+        { "/mainwin", winpos_ac },
+        { "/inputwin", winpos_ac },
+    };
+
+    for (int i = 0; i < ARRAY_SIZE(ac_cmds); i++) {
+        result = autocomplete_param_with_ac(input, ac_cmds[i].cmd, ac_cmds[i].completer, TRUE, previous);
         if (result) {
             return result;
         }