[FFmpeg-cvslog] avfilter/formats: Remove pointless checks

Andreas Rheinhardt git at videolan.org
Fri Sep 11 16:23:45 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Fri Sep 11 01:29:38 2020 +0200| [0963be71ec262138563eb69ff6812af735db194f] | committer: Andreas Rheinhardt

avfilter/formats: Remove pointless checks

ff_formats_ref() takes a pointer to an AVFilterFormats and a pointer to
a pointer to an AVFilterFormats as arguments and adds the latter as an
owner to the list pointed to by the former; the latter is hereby always
the address of a list contained in an AVFilterFormatsConfig and can
therefore not be NULL. So remove the check for whether it is NULL; also
do the same for ff_channel_layouts_ref().

Also do the same for the unref functions where argument is never NULL
because it is always the address of an existing lvalue.

Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0963be71ec262138563eb69ff6812af735db194f
---

 libavfilter/formats.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index c54aff688f..713173e707 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -446,7 +446,7 @@ AVFilterChannelLayouts *ff_all_channel_counts(void)
 #define FORMATS_REF(f, ref, unref_fn)                                           \
     void *tmp;                                                                  \
                                                                                 \
-    if (!f || !ref)                                                             \
+    if (!f)                                                                     \
         return AVERROR(ENOMEM);                                                 \
                                                                                 \
     tmp = av_realloc_array(f->refs, sizeof(*f->refs), f->refcount + 1);         \
@@ -483,7 +483,7 @@ do {                                        \
 do {                                                               \
     int idx = -1;                                                  \
                                                                    \
-    if (!ref || !*ref)                                             \
+    if (!*ref)                                                     \
         return;                                                    \
                                                                    \
     FIND_REF_INDEX(ref, idx);                                      \



More information about the ffmpeg-cvslog mailing list