diff mbox series

[FFmpeg-devel,12/15] fftools/cmdutils: Use av_strstart instead of strncmp

Message ID 20210224115341.794293-12-andreas.rheinhardt@gmail.com
State Accepted
Commit bd85c63d1d7e9d5e60cbde5c1dcd8d3911e67de3
Headers show
Series [FFmpeg-devel,01/15] avformat/movenc: Remove always true check | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 24, 2021, 11:53 a.m. UTC
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 | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 4eb68d2201..fe253d10a4 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -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++;
     }