]> git.sesse.net Git - vlc/commitdiff
* ALL: added vlc_asprintf() to our libc.
authorGildas Bazin <gbazin@videolan.org>
Fri, 9 Jan 2004 18:32:04 +0000 (18:32 +0000)
committerGildas Bazin <gbazin@videolan.org>
Fri, 9 Jan 2004 18:32:04 +0000 (18:32 +0000)
configure.ac
include/vlc_common.h
src/extras/libc.c

index a266a34881c3c9008abc385d610d214114653b64..e940aad1bbb76dc7b84e908018aab8bf55bd2bc4 100644 (file)
@@ -1,5 +1,5 @@
 dnl Autoconf settings for vlc
-dnl $Id: configure.ac,v 1.147 2004/01/09 15:39:38 hartman Exp $
+dnl $Id: configure.ac,v 1.148 2004/01/09 18:32:03 gbazin Exp $
 
 AC_INIT(vlc,0.7.1-cvs)
 
@@ -273,7 +273,7 @@ CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcd
 dnl Check for system libs needed
 need_libc=false
 
-AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r)
+AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r)
 
 dnl Check for usual libc functions
 AC_CHECK_FUNCS(strdup strndup atof lseek)
index 82b141a1fa8fb5bcf8d5b268fdc003f381c65f9c..714c7aca1038763bd7d487b248f4e1bb128b6516 100644 (file)
@@ -3,7 +3,7 @@
  * Collection of useful common types and macros definitions
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vlc_common.h,v 1.100 2004/01/08 11:18:27 fenrir Exp $
+ * $Id: vlc_common.h,v 1.101 2004/01/09 18:32:03 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@via.ecp.fr>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -619,6 +619,13 @@ static inline uint64_t GetQWLE( void * _p )
 #   define vlc_vasprintf NULL
 #endif
 
+#if !defined(HAVE_ASPRINTF) || defined(SYS_DARWIN) || defined(SYS_BEOS)
+#   define asprintf vlc_asprintf
+    VLC_EXPORT( int, vlc_asprintf, (char **, const char *, ... ) );
+#elif !defined(__PLUGIN__)
+#   define vlc_asprintf NULL
+#endif
+
 #ifndef HAVE_STRNDUP
 #   if defined(STRNDUP_IN_GNOME_H) && \
         (defined(MODULE_NAME_IS_gnome)||defined(MODULE_NAME_IS_gnome_main)||\
index 6708b359e85bffeaf03c3bfaf16a2e353cc7d718..deb18177a9949e7fecfe8c80b418e8b6cb8aacb5 100644 (file)
@@ -2,7 +2,7 @@
  * libc.c: Extra libc function for some systems.
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: libc.c,v 1.13 2004/01/08 11:36:40 jlj Exp $
+ * $Id: libc.c,v 1.14 2004/01/09 18:32:04 gbazin Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Samuel Hocevar <sam@zoy.org>
@@ -173,6 +173,19 @@ int vlc_vasprintf(char **strp, const char *fmt, va_list ap)
 }
 #endif
 
+/*****************************************************************************
+ * asprintf:
+ *****************************************************************************/
+#if !defined(HAVE_ASPRINTF) || defined(SYS_DARWIN) || defined(SYS_BEOS)
+int vlc_asprintf( char **strp, const char *fmt, ... )
+{
+    va_list args;
+    va_start( args, fmt );
+    vasprintf( strp, fmt, args );
+    va_end( args );
+}
+#endif
+
 /*****************************************************************************
  * atof: convert a string to a double.
  *****************************************************************************/