diff options
author | Eric Wong <normalperson@yhbt.net> | 2006-07-29 18:55:00 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2006-07-29 18:55:00 +0000 |
commit | f08342c11fb7f31b168902b4d89d8e543e03125a (patch) | |
tree | e56ebfd5f0b4376d10e4f02dba17f3dfef82b999 /src/buffer2array.h | |
parent | f05166a6a0f39e6c6f8ce9675d7f6f6f58300577 (diff) | |
download | mpd-f08342c11fb7f31b168902b4d89d8e543e03125a.tar.gz mpd-f08342c11fb7f31b168902b4d89d8e543e03125a.tar.xz mpd-f08342c11fb7f31b168902b4d89d8e543e03125a.zip |
replace buffer2array() with cstrtok() from mpd-ke
This modifies the string in place, and does not allocate any memory from
the heap. This is considerably smaller than the function it replaces,
and will be instrumental in getting the commands/conf malloc reductions
done.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4481 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/buffer2array.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/buffer2array.h b/src/buffer2array.h index fa6882fd9..cecd3b6d3 100644 --- a/src/buffer2array.h +++ b/src/buffer2array.h @@ -21,8 +21,12 @@ #include "../config.h" -int buffer2array(char *buffer, char ***array); - -void freeArgArray(char **array, int argArrayLength); +/* tokenizes up to max elements in buffer (a null-terminated string) and + * stores the result in array (which must be capable of holding up to + * max elements). Tokenization is based on C string quoting rules. + * The arguments buffer and array are modified. + * Returns the number of elements tokenized. + */ +int cstrtok(char *buffer, char *array[], const int max); #endif |