diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-02-24 07:43:37 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-02-28 17:14:21 +0100 |
commit | ea5bf12a9a7e05c34b55ff3bcc9ecddb39431800 (patch) | |
tree | d54bf3ea49522e3ea3c33a77bdb20368852504fc | |
parent | bd85c63d1d7e9d5e60cbde5c1dcd8d3911e67de3 (diff) | |
download | ffmpeg-ea5bf12a9a7e05c34b55ff3bcc9ecddb39431800.tar.gz |
avformat/avio: Use av_strstart instead of strncmp
It makes the intent clearer and avoids calculating the length
in advance.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r-- | libavformat/avio.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c index fbe07e44bc..8011482e76 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -114,11 +114,10 @@ static int url_alloc_for_protocol(URLContext **puc, const URLProtocol *up, goto fail; } if (up->priv_data_class) { - int proto_len= strlen(up->name); - char *start = strchr(uc->filename, ','); + char *start; *(const AVClass **)uc->priv_data = up->priv_data_class; av_opt_set_defaults(uc->priv_data); - if(!strncmp(up->name, uc->filename, proto_len) && uc->filename + proto_len == start){ + if (av_strstart(uc->filename, up->name, (const char**)&start) && *start == ',') { int ret= 0; char *p= start; char sep= *++p; |