[vlc-devel] commit: Inline strsep ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Dec 21 14:56:18 CET 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Dec 21 15:56:05 2008 +0200| [76ed9882aa2cd2d11ad8e0f272302d44899b4b4d] | committer: Rémi Denis-Courmont
Inline strsep
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=76ed9882aa2cd2d11ad8e0f272302d44899b4b4d
---
include/vlc_common.h | 1 -
include/vlc_fixups.h | 18 +++++++++++++++++-
src/extras/libc.c | 22 ----------------------
3 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 7060cb5..4959045 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -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( char *, vlc_strcasestr, ( const char *s1, const char *s2 ) LIBVLC_USED );
-char *vlc_strsep( char **, const char * );
#if defined(WIN32) || defined(UNDER_CE)
/* win32, cl and icl support */
diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index 9992cd5..e4ef44b 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -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
diff --git a/src/extras/libc.c b/src/extras/libc.c
index eca162a..ad67e13 100644
--- a/src/extras/libc.c
+++ b/src/extras/libc.c
@@ -208,28 +208,6 @@ extern size_t vlc_strlcpy (char *tgt, const char *src, size_t bufsize)
#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
* when called with an empty argument or just '\'
More information about the vlc-devel
mailing list