[vlc-devel] commit: Inline atoll and atof ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat May 24 11:07:29 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Sat May 24 12:06:24 2008 +0300| [cb63940a0b567471603b667c391770309ad15c31]

Inline atoll and atof

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

 include/vlc_fixups.h |   16 +++++++---------
 src/extras/libc.c    |   31 -------------------------------
 src/libvlccore.sym   |    2 --
 3 files changed, 7 insertions(+), 42 deletions(-)

diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index 8045ed5..3f185ab 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -70,24 +70,22 @@ static inline char *strndup (const char *str, size_t max)
 # define strlcpy vlc_strlcpy
 #endif
 
-#ifndef HAVE_ATOF
-# define atof vlc_atof
-#endif
-
 #ifndef HAVE_STRTOF
-# ifdef HAVE_STRTOD
-#  define strtof( a, b ) ((float)strtod (a, b))
-# endif
+# define strtof( a, b ) ((float)strtod (a, b))
 #endif
 
-#ifndef HAVE_ATOLL
-# define atoll vlc_atoll
+#ifndef HAVE_ATOF
+# define atof( str ) (strtod ((str), (char **)NULL, 10))
 #endif
 
 #ifndef HAVE_STRTOLL
 # define strtoll vlc_strtoll
 #endif
 
+#ifndef HAVE_ATOLL
+# define atoll( str ) (strtoll ((str), (char **)NULL, 10))
+#endif
+
 #ifndef HAVE_LLDIV
 typedef struct {
     long long quot; /* Quotient. */
diff --git a/src/extras/libc.c b/src/extras/libc.c
index e9bb77b..3e537ad 100644
--- a/src/extras/libc.c
+++ b/src/extras/libc.c
@@ -226,27 +226,6 @@ int vlc_asprintf( char **strp, const char *fmt, ... )
 #endif
 
 /*****************************************************************************
- * atof: convert a string to a double.
- *****************************************************************************/
-#if !defined( HAVE_ATOF )
-double vlc_atof( const char *nptr )
-{
-    double f_result;
-    wchar_t *psz_tmp = NULL;
-    int i_len = strlen( nptr ) + 1;
-
-    psz_tmp = malloc( i_len * sizeof(wchar_t) );
-    if( !psz_tmp )
-        return NULL;
-    MultiByteToWideChar( CP_ACP, 0, nptr, -1, psz_tmp, i_len );
-    f_result = wcstod( psz_tmp, NULL );
-    free( psz_tmp );
-
-    return f_result;
-}
-#endif
-
-/*****************************************************************************
  * strtoll: convert a string to a 64 bits int.
  *****************************************************************************/
 #if !defined( HAVE_STRTOLL )
@@ -318,16 +297,6 @@ int64_t vlc_strtoll( const char *nptr, char **endptr, int base )
 }
 #endif
 
-/*****************************************************************************
- * atoll: convert a string to a 64 bits int.
- *****************************************************************************/
-#if !defined( HAVE_ATOLL )
-int64_t vlc_atoll( const char *nptr )
-{
-    return strtoll( nptr, (char **)NULL, 10 );
-}
-#endif
-
 /**
  * Copy a string to a sized buffer. The result is always nul-terminated
  * (contrary to strncpy()).
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index ca14d71..bad95ee 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -371,8 +371,6 @@ __var_TriggerCallback
 __var_Type
 vlc_alphasort
 vlc_asprintf
-vlc_atof
-vlc_atoll
 vlc_b64_decode
 vlc_b64_decode_binary
 vlc_b64_decode_binary_to_buffer




More information about the vlc-devel mailing list