]> git.sesse.net Git - vlc/blobdiff - include/vlc_fixups.h
Inline strsep
[vlc] / include / vlc_fixups.h
index 9992cd5a5b66245380f2e6f9032de0d04a71b388..e4ef44be787859a277f02a1421478ca062a76c10 100644 (file)
@@ -151,7 +151,23 @@ static inline char *strndup (const char *str, size_t max)
 #endif
 
 #ifndef HAVE_STRSEP
-# define strsep vlc_strsep
+static inline char *vlc_strsep( char **ppsz_string, const char *psz_delimiters )
+{
+    char *psz_string = *ppsz_string;
+    if( !psz_string )
+        return NULL;
+
+    char *p = strpbrk( psz_string, psz_delimiters );
+    if( !p )
+    {
+        *ppsz_string = NULL;
+        return psz_string;
+    }
+    *p++ = '\0';
+
+    *ppsz_string = p;
+    return psz_string;
+}
 #endif
 
 #ifndef HAVE_ATOLL