Simplify extract_inout() as suggested by Michael
authorVitor Sessak <vitor1001@gmail.com>
Sat, 24 May 2008 20:40:44 +0000 (20:40 +0000)
committerVitor Sessak <vitor1001@gmail.com>
Sat, 24 May 2008 20:40:44 +0000 (20:40 +0000)
Commited in SoC by Vitor Sessak on 2008-04-23 18:01:31

Originally committed as revision 13324 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavfilter/graphparser.c

index 6a1904f3eca6bdb3d61e38b53e97e26a1f7a2ab2..5ad8522daa88b150786ffd78300e915d61635ccc 100644 (file)
@@ -179,26 +179,15 @@ static void free_inout(AVFilterInOut *head)
 static AVFilterInOut *extract_inout(const char *label, AVFilterInOut **links)
 {
     AVFilterInOut *ret;
-    AVFilterInOut *p;
-
-    if(!links || !*links)
-        return NULL;
 
-    if(!strcmp((*links)->name, label)) {
-        ret = *links;
-        *links = (*links)->next;
-        return ret;
-    }
-
-    /* First check if the label is not in the openLinks list */
-    for(p = *links; p->next && strcmp(p->next->name, label); p = p->next);
 
-    if(!p->next)
-        return NULL;
+    while(*links && strcmp((*links)->name, label))
+        links= &((*links)->next);
 
-    ret = p->next;
+    ret= *links;
 
-    p->next = p->next->next;
+    if(ret)
+        *links= ret->next;
 
     return ret;
 }