]> git.sesse.net Git - ffmpeg/commitdiff
fftools/cmdutils: Use av_strstart instead of strncmp
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 24 Feb 2021 06:41:27 +0000 (07:41 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 28 Feb 2021 16:14:21 +0000 (17:14 +0100)
It makes the intent clearer and avoids searching for a delimiter
in advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
fftools/cmdutils.c

index 4eb68d22014c30bb58e641ef7d5209d353b1ffa5..fe253d10a4f2349f67a88629e8dd9bb235d134c7 100644 (file)
@@ -215,11 +215,9 @@ void show_help_children(const AVClass *class, int flags)
 
 static const OptionDef *find_option(const OptionDef *po, const char *name)
 {
-    const char *p = strchr(name, ':');
-    int len = p ? p - name : strlen(name);
-
     while (po->name) {
-        if (!strncmp(name, po->name, len) && strlen(po->name) == len)
+        const char *end;
+        if (av_strstart(name, po->name, &end) && (!*end || *end == ':'))
             break;
         po++;
     }