From 20c9dfa61692d9ed741a91177d3fa185d73c02dd Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 13 Jan 2013 16:13:13 +0100 Subject: 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. --- core/command.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'core/command.c') 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); -- cgit v1.2.3