diff options
author | wm4 <wm4@nowhere> | 2013-01-13 16:13:13 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-01-13 17:32:39 +0100 |
commit | 20c9dfa61692d9ed741a91177d3fa185d73c02dd (patch) | |
tree | 8931b8f4036bbcc4941c8d372546b08dbd75e53b /core/command.c | |
parent | cbdee50f29e2d1c44453f7b5ed5d67296f7a16dc (diff) | |
download | mpv-20c9dfa61692d9ed741a91177d3fa185d73c02dd.tar.bz2 mpv-20c9dfa61692d9ed741a91177d3fa185d73c02dd.tar.xz |
Replace strsep() uses
This function sucks and apparently is not very portable (at least on
mingw, the configure check fails). Also remove the emulation of that
function from osdep/strsep*, and remove the configure check.
Diffstat (limited to 'core/command.c')
-rw-r--r-- | core/command.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/command.c b/core/command.c index 1e4ccd88bc..bad1543224 100644 --- a/core/command.c +++ b/core/command.c @@ -51,7 +51,6 @@ #include "audio/filter/af.h" #include "video/decode/dec_video.h" #include "audio/decode/dec_audio.h" -#include "osdep/strsep.h" #include "sub/spudec.h" #include "core/path.h" #include "sub/ass_mp.h" @@ -2266,16 +2265,19 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) if (!sh_audio) break; char *af_args = strdup(cmd->args[0].v.s); - char *af_commands = af_args; - char *af_command; + bstr af_commands = bstr0(af_args); struct af_instance *af; - while ((af_command = strsep(&af_commands, ",")) != NULL) { + while (af_commands.len) { + bstr af_command; + bstr_split_tok(af_commands, ",", &af_command, &af_commands); + char *af_command0 = bstrdup0(NULL, af_command); if (cmd->id == MP_CMD_AF_DEL) { - af = af_get(mpctx->mixer.afilter, af_command); + af = af_get(mpctx->mixer.afilter, af_command0); if (af != NULL) af_remove(mpctx->mixer.afilter, af); } else - af_add(mpctx->mixer.afilter, af_command); + af_add(mpctx->mixer.afilter, af_command0); + talloc_free(af_command0); } reinit_audio_chain(mpctx); free(af_args); |