[vlc-commits] cli: define callback type for command handler

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


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov 28 15:54:54 2020 +0200| [bf0b93c721cdee237205ea3b34a5a9e0808976dc] | committer: Rémi Denis-Courmont

cli: define callback type for command handler

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

 modules/control/cli/cli.c | 2 +-
 modules/control/cli/cli.h | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/control/cli/cli.c b/modules/control/cli/cli.c
index 9cb5b9ffaa..f82465acbd 100644
--- a/modules/control/cli/cli.c
+++ b/modules/control/cli/cli.c
@@ -365,7 +365,7 @@ error:      wordfree(&we);
 
     if (count > 0)
     {
-        int (*cb)(intf_thread_t *, const char *const *, size_t) = UnknownCmd;
+        cli_callback cb = UnknownCmd;
         const struct command **c = tfind(&args[0], &sys->commands, cmdcmp);
 
         if (c != NULL)
diff --git a/modules/control/cli/cli.h b/modules/control/cli/cli.h
index 8149b40170..d526d3fd20 100644
--- a/modules/control/cli/cli.h
+++ b/modules/control/cli/cli.h
@@ -53,10 +53,12 @@ void msg_print(intf_thread_t *p_intf, const char *psz_fmt, ...);
 #define msg_rc(...) msg_print(p_intf, __VA_ARGS__)
 #define STATUS_CHANGE "status change: "
 
+typedef int (*cli_callback)(intf_thread_t *, const char *const *, size_t);
+
 struct cli_handler
 {
     const char *name;
-    int (*callback)(intf_thread_t *intf, const char *const *, size_t);
+    cli_callback callback;
 };
 
 void RegisterHandlers(intf_thread_t *intf, const struct cli_handler *handlers,



More information about the vlc-commits mailing list