Commit 76ed9882 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Inline strsep

parent e00d4656
...@@ -740,7 +740,6 @@ VLC_EXPORT( size_t, vlc_strlcpy, ( char *, const char *, size_t ) ); ...@@ -740,7 +740,6 @@ VLC_EXPORT( size_t, vlc_strlcpy, ( char *, const char *, size_t ) );
VLC_EXPORT( long long, vlc_strtoll, ( const char *nptr, char **endptr, int base ) LIBVLC_USED ); VLC_EXPORT( long long, vlc_strtoll, ( const char *nptr, char **endptr, int base ) LIBVLC_USED );
VLC_EXPORT( char *, vlc_strcasestr, ( const char *s1, const char *s2 ) LIBVLC_USED ); VLC_EXPORT( char *, vlc_strcasestr, ( const char *s1, const char *s2 ) LIBVLC_USED );
char *vlc_strsep( char **, const char * );
#if defined(WIN32) || defined(UNDER_CE) #if defined(WIN32) || defined(UNDER_CE)
/* win32, cl and icl support */ /* win32, cl and icl support */
......
...@@ -151,7 +151,23 @@ static inline char *strndup (const char *str, size_t max) ...@@ -151,7 +151,23 @@ static inline char *strndup (const char *str, size_t max)
#endif #endif
#ifndef HAVE_STRSEP #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 #endif
#ifndef HAVE_ATOLL #ifndef HAVE_ATOLL
......
...@@ -208,28 +208,6 @@ extern size_t vlc_strlcpy (char *tgt, const char *src, size_t bufsize) ...@@ -208,28 +208,6 @@ extern size_t vlc_strlcpy (char *tgt, const char *src, size_t bufsize)
#endif #endif
} }
/**
* Extract a token from string.
* It is a replacement for strsep if not present.
*/
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;
}
/***************************************************************************** /*****************************************************************************
* vlc_*dir_wrapper: wrapper under Windows to return the list of drive letters * vlc_*dir_wrapper: wrapper under Windows to return the list of drive letters
* when called with an empty argument or just '\' * when called with an empty argument or just '\'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment