[FFmpeg-devel] [PATCH v3 1/2] avformat/utils: simplify the code and remove av_strncasecmp
Michael Niedermayer
michael at niedermayer.cc
Tue Dec 3 10:43:53 EET 2019
On Mon, Dec 02, 2019 at 12:51:05PM +0800, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
> libavformat/utils.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 8196442dd1..03a3705200 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -4854,11 +4854,10 @@ int ff_mkdir_p(const char *path)
> return -1;
> }
>
> - if (!av_strncasecmp(temp, "/", 1) || !av_strncasecmp(temp, "\\", 1)) {
> + if (*temp == '/' || *temp == '\\')
> pos++;
> - } else if (!av_strncasecmp(temp, "./", 2) || !av_strncasecmp(temp, ".\\", 2)) {
> + else if (*temp == '.' && (*(temp+1) == '/' || *(temp+1) == '\\'))
is this really simpler ? (compared to strncmp() for example) ?
it looks more obfuscated
also not sure about the {} removial
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191203/7c6acd30/attachment.sig>
More information about the ffmpeg-devel
mailing list