diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-09-27 16:23:43 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-09-27 16:23:43 +0000 |
commit | 372e2884089e6a17be6d0028386ea2099dd86268 (patch) | |
tree | d65753e450b0613788dde3e5f23a116a157cd1c7 /libavfilter/parseutils.c | |
parent | 4a94cfea02f4c3da43d2f2ed25f14ee461a1a315 (diff) | |
download | ffmpeg-372e2884089e6a17be6d0028386ea2099dd86268.tar.gz |
Move av_get_token() from libavfilter to libavutil.
Originally committed as revision 25225 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter/parseutils.c')
-rw-r--r-- | libavfilter/parseutils.c | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/libavfilter/parseutils.c b/libavfilter/parseutils.c index 669ec9d298..b7b8d13b94 100644 --- a/libavfilter/parseutils.c +++ b/libavfilter/parseutils.c @@ -28,42 +28,6 @@ #include "libavutil/random_seed.h" #include "parseutils.h" -#define WHITESPACES " \n\t" - -char *av_get_token(const char **buf, const char *term) -{ - char *out = av_malloc(strlen(*buf) + 1); - char *ret= out, *end= out; - const char *p = *buf; - if (!out) return NULL; - p += strspn(p, WHITESPACES); - - while(*p && !strspn(p, term)) { - char c = *p++; - if(c == '\\' && *p){ - *out++ = *p++; - end= out; - }else if(c == '\''){ - while(*p && *p != '\'') - *out++ = *p++; - if(*p){ - p++; - end= out; - } - }else{ - *out++ = c; - } - } - - do{ - *out-- = 0; - }while(out >= end && strspn(out, WHITESPACES)); - - *buf = p; - - return ret; -} - typedef struct { const char *name; ///< a string representing the name of the color uint8_t rgb_color[3]; ///< RGB values for the color @@ -395,41 +359,6 @@ int main(void) { int i; - const char *strings[] = { - "''", - "", - ":", - "\\", - "'", - " '' :", - " '' '' :", - "foo '' :", - "'foo'", - "foo ", - "foo\\", - "foo': blah:blah", - "foo\\: blah:blah", - "foo\'", - "'foo : ' :blahblah", - "\\ :blah", - " foo", - " foo ", - " foo \\ ", - "foo ':blah", - " foo bar : blahblah", - "\\f\\o\\o", - "'foo : \\ \\ ' : blahblah", - "'\\fo\\o:': blahblah", - "\\'fo\\o\\:': foo ' :blahblah" - }; - - for (i=0; i < FF_ARRAY_ELEMS(strings); i++) { - const char *p= strings[i]; - printf("|%s|", p); - printf(" -> |%s|", av_get_token(&p, ":")); - printf(" + |%s|\n", p); - } - printf("\nTesting av_parse_color()\n"); { uint8_t rgba[4]; |