[vlc-commits] cli: split variadic function

Rémi Denis-Courmont git at videolan.org
Sun Oct 18 20:26:01 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Oct 18 20:48:10 2020 +0300| [aac314d472af0ce4e72eef47a3b136a56212fc14] | committer: Rémi Denis-Courmont

cli: split variadic function

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

 modules/control/cli/cli.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/control/cli/cli.c b/modules/control/cli/cli.c
index 406b0e988a..e1500821f3 100644
--- a/modules/control/cli/cli.c
+++ b/modules/control/cli/cli.c
@@ -64,16 +64,13 @@
 
 #define MAX_LINE_LENGTH 1024
 
-void msg_print(intf_thread_t *p_intf, const char *psz_fmt, ...)
+static void msg_vprint(intf_thread_t *p_intf, const char *psz_fmt, va_list args)
 {
-    va_list args;
     char fmt_eol[strlen (psz_fmt) + 3], *msg;
     int len;
 
     snprintf (fmt_eol, sizeof (fmt_eol), "%s\r\n", psz_fmt);
-    va_start( args, psz_fmt );
     len = vasprintf( &msg, fmt_eol, args );
-    va_end( args );
 
     if( len < 0 )
         return;
@@ -90,6 +87,15 @@ void msg_print(intf_thread_t *p_intf, const char *psz_fmt, ...)
     free( msg );
 }
 
+void msg_print(intf_thread_t *intf, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    msg_vprint(intf, fmt, ap);
+    va_end(ap);
+}
+
 static int cmdcmp(const void *a, const void *b)
 {
     const char *const *na = a;



More information about the vlc-commits mailing list