aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/graphparser.c
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2008-05-24 20:41:42 +0000
committerVitor Sessak <vitor1001@gmail.com>2008-05-24 20:41:42 +0000
commitbd80b349b3449ad1b5bed6b47fbb94aa25d76987 (patch)
treed9f8af1c88d0e5c4f9c00d03a4e22cd9a47bd72f /libavfilter/graphparser.c
parentf5cbde2ee174ca20d7fe17a48966a29119fc3231 (diff)
downloadffmpeg-bd80b349b3449ad1b5bed6b47fbb94aa25d76987.tar.gz
Make parse_link_name() return a pointer to the name read
Commited in SoC by Vitor Sessak on 2008-05-24 12:57:20 Originally committed as revision 13343 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter/graphparser.c')
-rw-r--r--libavfilter/graphparser.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
index 09be0dabae..9ce24f450f 100644
--- a/libavfilter/graphparser.c
+++ b/libavfilter/graphparser.c
@@ -94,14 +94,15 @@ static char *consume_string(const char **buf)
* @arg name a pointer (that need to be free'd after use) to the name between
* parenthesis
*/
-static void parse_link_name(const char **buf, char **name, AVClass *log_ctx)
+static char *parse_link_name(const char **buf, AVClass *log_ctx)
{
const char *start = *buf;
+ char *name;
(*buf)++;
- *name = consume_string(buf);
+ name = consume_string(buf);
- if(!*name[0]) {
+ if(!name[0]) {
av_log(log_ctx, AV_LOG_ERROR,
"Bad (empty?) label found in the following: \"%s\".\n", start);
goto fail;
@@ -111,8 +112,10 @@ static void parse_link_name(const char **buf, char **name, AVClass *log_ctx)
av_log(log_ctx, AV_LOG_ERROR,
"Mismatched '[' found in the following: \"%s\".\n", start);
fail:
- av_freep(name);
+ av_freep(&name);
}
+
+ return name;
}
static AVFilterContext *create_filter(AVFilterGraph *ctx, int index,
@@ -255,12 +258,10 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs,
int pad = 0;
while(**buf == '[') {
- char *name;
+ char *name = parse_link_name(buf, log_ctx);
AVFilterInOut *link_to_add;
AVFilterInOut *match;
- parse_link_name(buf, &name, log_ctx);
-
if(!name)
return -1;
@@ -301,14 +302,12 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs,
int pad = 0;
while(**buf == '[') {
- char *name;
+ char *name = parse_link_name(buf, log_ctx);
AVFilterInOut *match;
AVFilterInOut *input = *currInputs;
*currInputs = (*currInputs)->next;
- parse_link_name(buf, &name, log_ctx);
-
if(!name)
return -1;