]> git.sesse.net Git - vlc/commitdiff
Add us_vasprintf() function
authorPierre Ynard <linkfanel@yahoo.fr>
Wed, 12 Jan 2011 18:33:19 +0000 (19:33 +0100)
committerPierre Ynard <linkfanel@yahoo.fr>
Wed, 12 Jan 2011 18:33:19 +0000 (19:33 +0100)
For use within already variadic functions

include/vlc_charset.h
src/libvlccore.sym
src/text/charset.c

index 07f9dee3e9b3adcb88782b074534c74aa23b021b..5c7590f10adadcc86462c4f329322e621fb2e229 100644 (file)
@@ -114,6 +114,7 @@ VLC_EXPORT( void *, ToCharset, ( const char *charset, const char *in, size_t *ou
 VLC_EXPORT( double, us_strtod, ( const char *, char ** ) LIBVLC_USED );
 VLC_EXPORT( float, us_strtof, ( const char *, char ** ) LIBVLC_USED );
 VLC_EXPORT( double, us_atof, ( const char * ) LIBVLC_USED );
+VLC_EXPORT( int, us_vasprintf, ( char **, const char *, va_list ) );
 VLC_EXPORT( int, us_asprintf, ( char **, const char *, ... ) LIBVLC_USED );
 
 #endif
index c35e1c33a0d25550c8c5997295def2c0e5d19f3d..23c41bc01f82873314e6afe184d34958329612ad 100644 (file)
@@ -453,6 +453,7 @@ us_asprintf
 us_atof
 us_strtod
 us_strtof
+us_vasprintf
 vlc_fopen
 utf8_fprintf
 vlc_loaddir
index 1722210821a2dbb8d2e036ab2fc6c27da44d1802..edb5dae8ca506c6b2c770cf3fcd71d0ec5f80cb1 100644 (file)
@@ -92,19 +92,15 @@ double us_atof( const char *str )
 
 
 /**
- * us_asprintf() has the same prototype as asprintf(), but doesn't use
+ * us_vasprintf() has the same prototype as vasprintf(), but doesn't use
  * the system locale.
  */
-int us_asprintf( char **ret, const char *format, ... )
+int us_vasprintf( char **ret, const char *format, va_list ap )
 {
-    va_list ap;
     locale_t loc = newlocale( LC_NUMERIC_MASK, "C", NULL );
     locale_t oldloc = uselocale( loc );
-    int i_rc;
 
-    va_start( ap, format );
-    i_rc = vasprintf( ret, format, ap );
-    va_end( ap );
+    int i_rc = vasprintf( ret, format, ap );
 
     if ( loc != (locale_t)0 )
     {
@@ -114,3 +110,20 @@ int us_asprintf( char **ret, const char *format, ... )
 
     return i_rc;
 }
+
+
+/**
+ * us_asprintf() has the same prototype as asprintf(), but doesn't use
+ * the system locale.
+ */
+int us_asprintf( char **ret, const char *format, ... )
+{
+    va_list ap;
+    int i_rc;
+
+    va_start( ap, format );
+    i_rc = us_vasprintf( ret, format, ap );
+    va_end( ap );
+
+    return i_rc;
+}