History

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

Vitor Sessak committed 18 years ago

Commit bd80b341 parent f5cbde21 file · +9 −10Browse files

Showing the changes to libavfilter/graphparser.c (1 of 1 file). Show all

Unified · Split

libavfilter/graphparser.c+9−10
@@ -94,14 +94,15 @@ static char *consume_string(const char **buf) · 93 unmodified lines
9494 * @arg name a pointer (that need to be free'd after use) to the name between
9595 * parenthesis
9696 */
97−static void parse_link_name(const char **buf, char **name, AVClass *log_ctx)
97+static char *parse_link_name(const char **buf, AVClass *log_ctx)
9898 {
9999 const char *start = *buf;
100+ char *name;
100101 (*buf)++;
101102
102− *name = consume_string(buf);
103+ name = consume_string(buf);
103104
104− if(!*name[0]) {
105+ if(!name[0]) {
105106 av_log(log_ctx, AV_LOG_ERROR,
106107 "Bad (empty?) label found in the following: \"%s\".\n", start);
107108 goto fail;
@@ -111,8 +112,10 @@ static void parse_link_name(const char **buf, char **name, AVClass *log_ctx) · 3 unmodified lines
111112 av_log(log_ctx, AV_LOG_ERROR,
112113 "Mismatched '[' found in the following: \"%s\".\n", start);
113114 fail:
114− av_freep(name);
115+ av_freep(&name);
115116 }
117+
118+ return name;
116119 }
117120
118121 static AVFilterContext *create_filter(AVFilterGraph *ctx, int index,
@@ -255,12 +258,10 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs, · 136 unmodified lines
255258 int pad = 0;
256259
257260 while(**buf == '[') {
258− char *name;
261+ char *name = parse_link_name(buf, log_ctx);
259262 AVFilterInOut *link_to_add;
260263 AVFilterInOut *match;
261264
262− parse_link_name(buf, &name, log_ctx);
263−
264265 if(!name)
265266 return -1;
266267
@@ -301,14 +302,12 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, · 34 unmodified lines
301302 int pad = 0;
302303
303304 while(**buf == '[') {
304− char *name;
305+ char *name = parse_link_name(buf, log_ctx);
305306 AVFilterInOut *match;
306307
307308 AVFilterInOut *input = *currInputs;
308309 *currInputs = (*currInputs)->next;
309310
310− parse_link_name(buf, &name, log_ctx);
311−
312311 if(!name)
313312 return -1;
314313

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t