Commit 661d6327 authored by vitor's avatar vitor

Make parse_link_name() return a pointer to the name read

Commited in SoC by Vitor Sessak on 2008-05-24 12:57:20


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@13343 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent e37e6cd5
...@@ -94,14 +94,15 @@ static char *consume_string(const char **buf) ...@@ -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 * @arg name a pointer (that need to be free'd after use) to the name between
* parenthesis * 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; const char *start = *buf;
char *name;
(*buf)++; (*buf)++;
*name = consume_string(buf); name = consume_string(buf);
if(!*name[0]) { if(!name[0]) {
av_log(log_ctx, AV_LOG_ERROR, av_log(log_ctx, AV_LOG_ERROR,
"Bad (empty?) label found in the following: \"%s\".\n", start); "Bad (empty?) label found in the following: \"%s\".\n", start);
goto fail; goto fail;
...@@ -111,8 +112,10 @@ static void parse_link_name(const char **buf, char **name, AVClass *log_ctx) ...@@ -111,8 +112,10 @@ static void parse_link_name(const char **buf, char **name, AVClass *log_ctx)
av_log(log_ctx, AV_LOG_ERROR, av_log(log_ctx, AV_LOG_ERROR,
"Mismatched '[' found in the following: \"%s\".\n", start); "Mismatched '[' found in the following: \"%s\".\n", start);
fail: fail:
av_freep(name); av_freep(&name);
} }
return name;
} }
static AVFilterContext *create_filter(AVFilterGraph *ctx, int index, static AVFilterContext *create_filter(AVFilterGraph *ctx, int index,
...@@ -255,12 +258,10 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs, ...@@ -255,12 +258,10 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs,
int pad = 0; int pad = 0;
while(**buf == '[') { while(**buf == '[') {
char *name; char *name = parse_link_name(buf, log_ctx);
AVFilterInOut *link_to_add; AVFilterInOut *link_to_add;
AVFilterInOut *match; AVFilterInOut *match;
parse_link_name(buf, &name, log_ctx);
if(!name) if(!name)
return -1; return -1;
...@@ -301,14 +302,12 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, ...@@ -301,14 +302,12 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs,
int pad = 0; int pad = 0;
while(**buf == '[') { while(**buf == '[') {
char *name; char *name = parse_link_name(buf, log_ctx);
AVFilterInOut *match; AVFilterInOut *match;
AVFilterInOut *input = *currInputs; AVFilterInOut *input = *currInputs;
*currInputs = (*currInputs)->next; *currInputs = (*currInputs)->next;
parse_link_name(buf, &name, log_ctx);
if(!name) if(!name)
return -1; return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment