]> git.sesse.net Git - vlc/blobdiff - src/extras/libc.c
Removes trailing spaces. Removes tabs.
[vlc] / src / extras / libc.c
index 2e347d1aa6fd0d0e828387f6ffe79dd9328f178f..4be2dd27f5e3cf9e957af8548aae58b5bded9537 100644 (file)
@@ -27,8 +27,6 @@
  *****************************************************************************/
 #include <vlc/vlc.h>
 
-#include <string.h>                                              /* strdup() */
-#include <stdlib.h>
 #include <ctype.h>
 
 
@@ -112,6 +110,17 @@ char *vlc_strndup( const char *string, size_t n )
 }
 #endif
 
+/*****************************************************************************
+ * strnlen:
+ *****************************************************************************/
+#if !defined( HAVE_STRNLEN )
+size_t vlc_strnlen( const char *psz, size_t n )
+{
+    const char *psz_end = memchr( psz, 0, n );
+    return psz_end ? (size_t)( psz_end - psz ) : n;
+}
+#endif
+
 /*****************************************************************************
  * strcasecmp: compare two strings ignoring case
  *****************************************************************************/
@@ -169,7 +178,7 @@ char * vlc_strcasestr( const char *psz_big, const char *psz_little )
 
     if( !psz_big || !psz_little || !*psz_little ) return p_pos;
  
-    while( *p_pos ) 
+    while( *p_pos )
     {
         if( toupper( *p_pos ) == toupper( *psz_little ) )
         {
@@ -591,7 +600,7 @@ int vlc_scandir( const char *name, struct dirent ***namelist,
 }
 #endif
 
-#if defined (WIN32) || !defined (HAVE_SHARED_LIBVLC)
+#ifdef WIN32
 /*****************************************************************************
  * dgettext: gettext for plugins.
  *****************************************************************************/
@@ -923,6 +932,7 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char *const *ppsz_argv,
                   const char *p_in, size_t i_in,
                   char **pp_data, size_t *pi_data )
 {
+    (void)i_argc; // <-- hmph
 #ifdef HAVE_FORK
 # define BUFSIZE 1024
     int fds[2], i_status;