[FFmpeg-cvslog] lavu: use address-of operator checking clock_gettime

Marvin Scholz git at videolan.org
Mon Dec 28 06:13:21 EET 2020


ffmpeg | branch: master | Marvin Scholz <epirat07 at gmail.com> | Tue Dec  8 23:18:25 2020 +0100| [d67c6c7f6f57f0ccdc26fcf1f046ca3fa2e93e59] | committer: James Almer

lavu: use address-of operator checking clock_gettime

When targeting a recent enough macOS/iOS version that has clock_gettime
it won't be a weak symbol, in which case clang warns for this check
as it's always true:

  warning: address of function 'clock_gettime' will always
  evaluate to 'true'

This warning is silenced by using the address-of operator to make
the intent explicit.

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

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

diff --git a/libavutil/time.c b/libavutil/time.c
index afa6658aa6..740afc4785 100644
--- a/libavutil/time.c
+++ b/libavutil/time.c
@@ -57,7 +57,7 @@ int64_t av_gettime_relative(void)
 {
 #if HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC)
 #ifdef __APPLE__
-    if (clock_gettime)
+    if (&clock_gettime)
 #endif
     {
         struct timespec ts;
@@ -72,7 +72,7 @@ int av_gettime_relative_is_monotonic(void)
 {
 #if HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC)
 #ifdef __APPLE__
-    if (!clock_gettime)
+    if (!&clock_gettime)
         return 0;
 #endif
     return 1;



More information about the ffmpeg-cvslog mailing list