VLC_EXPORT( double, us_strtod, ( const char *, char ** ) LIBVLC_USED );
VLC_EXPORT( double, us_atof, ( const char * ) LIBVLC_USED );
+VLC_EXPORT( int, us_asprintf, ( char **, const char *, ... ) LIBVLC_USED );
#endif
return us_strtod( str, NULL );
}
+
+/**
+ * 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;
+ 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 );
+
+ if ( loc != (locale_t)0 )
+ {
+ uselocale( oldloc );
+ freelocale( loc );
+ }
+
+ return i_rc;
+}