[vlc-commits] cli: inline UnknownCmd()

Rémi Denis-Courmont git at videolan.org
Sun Nov 29 14:55:45 CET 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov 28 16:01:13 2020 +0200| [665ee931e1ffe6c94529d4d34ef87af535614696] | committer: Rémi Denis-Courmont

cli: inline UnknownCmd()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=665ee931e1ffe6c94529d4d34ef87af535614696
---

 modules/control/cli/cli.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/modules/control/cli/cli.c b/modules/control/cli/cli.c
index f82465acbd..185ccdf089 100644
--- a/modules/control/cli/cli.c
+++ b/modules/control/cli/cli.c
@@ -300,14 +300,6 @@ static const struct cli_handler cmds[] =
     { "hotkey", KeyAction },
 };
 
-static int UnknownCmd(intf_thread_t *intf, const char *const *args,
-                       size_t count)
-{
-    msg_print(intf, _("Unknown command `%s'. Type `help' for help."), args[0]);
-    (void) count;
-    return VLC_EGENERIC;
-}
-
 static int Process(intf_thread_t *intf, const char *line)
 {
     intf_sys_t *sys = intf->p_sys;
@@ -365,13 +357,21 @@ error:      wordfree(&we);
 
     if (count > 0)
     {
-        cli_callback cb = UnknownCmd;
-        const struct command **c = tfind(&args[0], &sys->commands, cmdcmp);
+        const struct command **pp = tfind(&args[0], &sys->commands, cmdcmp);
 
-        if (c != NULL)
-            cb = (*c)->handler.callback;
+        if (pp != NULL)
+        {
+            const struct command *c = *pp;;
 
-        ret = cb(intf, args, count);
+            ret = c->handler.callback(intf, args, count);
+        }
+        else
+        {
+            msg_print(intf,
+                      _("Unknown command `%s'. Type `help' for help."),
+                      args[0]);
+            ret = VLC_EGENERIC;
+        }
     }
 
 #ifdef HAVE_WORDEXP



More information about the vlc-commits mailing list