vlc | branch: master | Rémi Denis-Courmont <[email protected]> | 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 _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
