diff options
author | František Dvořák <valtri@users.sourceforge.net> | 2004-09-20 19:30:02 +0000 |
---|---|---|
committer | František Dvořák <valtri@users.sourceforge.net> | 2004-09-20 19:30:02 +0000 |
commit | 7204b84beb0f5cfb166e8d56402371d05bece83b (patch) | |
tree | 16b76662489bd637b04e06e5ee6ca1ea98186dec /lib/strtok_r.c | |
parent | 747ab57ec201661d72adfdf0ce538d728c0013c5 (diff) | |
download | xine-lib-7204b84beb0f5cfb166e8d56402371d05bece83b.tar.gz xine-lib-7204b84beb0f5cfb166e8d56402371d05bece83b.tar.bz2 |
Build system improvements:
- use replacement functions (macro AC_REPLACE_FUNCS and variable LTLIBOBJS),
each function is in a file placed into lib/ directory,
it was not necessary, but it looks nice, IMHO
- headers cleanups (this was needed):
- prototypes of replacement funtions and macros are placed
into separate os_internal.h (and included by config.h)
- drop include inttypes.h from public xine.h, replaced by custom
os_type.h, idea origins from Ogg/Vorbis public headers
- disable generating inttypes.h: generated replacement isn't enough for
xine-lib but nobody complained (and for M$VC we have special version)
- better including headers for win32, let dvdnav use its mutex wrapper
- updated M$VC port
Result:
- xine is compiled nicely by MinGW, CygWin and paritaly M$VC
- frontends in M$VC port don't require additional helping headers
- moved some platform specific things from xine-utils and win32/contrib
to lib/
Finally I can start with real coding. :-)
CVS patchset: 6982
CVS date: 2004/09/20 19:30:02
Diffstat (limited to 'lib/strtok_r.c')
-rw-r--r-- | lib/strtok_r.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/strtok_r.c b/lib/strtok_r.c new file mode 100644 index 000000000..733290422 --- /dev/null +++ b/lib/strtok_r.c @@ -0,0 +1,43 @@ +/* + * written for xine project, 2004 + * + * public domain replacement function for strtok_r() + * + */ + +#include "config.h" + +#include <stddef.h> +#include <string.h> + +char *_xine_private_strtok_r(char *s, const char *delim, char **ptrptr) { + char *next; + size_t toklen, cutlen; + + /* first or next call */ + if (s) *ptrptr = s; + else s = *ptrptr; + + /* end of searching */ + if (!s || s == '\0') return NULL; + + /* cut the initial garbage */ + cutlen = strspn(s, delim); + s = s + cutlen; + + /* pointer before next token */ + if ((toklen = strcspn(s, delim)) == 0) { + *ptrptr = NULL; + return NULL; + } + next = s + toklen; + + /* cut current token */ + *next = '\0'; + + /* prepare next call */ + *ptrptr = next + 1; + + /* return the token */ + return s; +} |