diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2008-05-24 20:41:09 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2008-05-24 20:41:09 +0000 |
commit | 443c10ef2b524d39eda354546e74c83e3effe6e7 (patch) | |
tree | d2d05771466b3acd6345c874c01f381ebef8910d /libavfilter | |
parent | 7baa62108a0fbb71bfc6e13346845d5ea8ef0fb7 (diff) | |
download | ffmpeg-443c10ef2b524d39eda354546e74c83e3effe6e7.tar.gz |
Factor common code out of if
Commited in SoC by Vitor Sessak on 2008-04-23 18:41:07
Originally committed as revision 13331 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/graphparser.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index 390c79c0d2..cc1f7b05fc 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -276,6 +276,7 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs, while (**buf == '[') { char *name; + AVFilterInOut *link_to_add; AVFilterInOut *match; parse_link_name(buf, &name, log_ctx); @@ -289,25 +290,24 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs, if(match) { /* A label of a open link. Make it one of the inputs of the next filter */ - AVFilterInOut *currlinkn = match; if (match->type != LinkTypeOut) { av_log(log_ctx, AV_LOG_ERROR, "Label \"%s\" appears twice as input!\n", match->name); return -1; } - currlinkn->next = *currInputs; - *currInputs = currlinkn; + + link_to_add = match; } else { /* Not in the list, so add it as an input */ - AVFilterInOut *currlinkn = av_malloc(sizeof(AVFilterInOut)); - - currlinkn->name = name; - currlinkn->type = LinkTypeIn; - currlinkn->filter = NULL; - currlinkn->pad_idx = pad; - currlinkn->next = *currInputs; - *currInputs = currlinkn; + link_to_add = av_malloc(sizeof(AVFilterInOut)); + + link_to_add->name = name; + link_to_add->type = LinkTypeIn; + link_to_add->filter = NULL; + link_to_add->pad_idx = pad; } + link_to_add->next = *currInputs; + *currInputs = link_to_add; consume_whitespace(buf); pad++; } @@ -324,6 +324,9 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, char *name; AVFilterInOut *match; + AVFilterInOut *input = *currInputs; + *currInputs = (*currInputs)->next; + parse_link_name(buf, &name, log_ctx); if(!name) @@ -334,14 +337,12 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, if(match) { /* A label of a open link. Link it. */ - AVFilterInOut *input = *currInputs; if (match->type != LinkTypeIn) { av_log(log_ctx, AV_LOG_ERROR, "Label \"%s\" appears twice as output!\n", match->name); return -1; } - *currInputs = (*currInputs)->next; if(link_filter(input->filter, input->pad_idx, match->filter, match->pad_idx, log_ctx) < 0) return -1; @@ -349,8 +350,6 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, av_free(input); } else { /* Not in the list, so add the first input as a openLink */ - AVFilterInOut *input = *currInputs; - *currInputs = (*currInputs)->next; input->next = *openLinks; input->type = LinkTypeOut; input->name = name; |