]> git.sesse.net Git - ffmpeg/commitdiff
lavu: use address-of operator checking clock_gettime
authorMarvin Scholz <epirat07@gmail.com>
Tue, 8 Dec 2020 22:18:25 +0000 (23:18 +0100)
committerJames Almer <jamrial@gmail.com>
Mon, 28 Dec 2020 04:12:26 +0000 (01:12 -0300)
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.

libavutil/time.c

index afa6658aa621a7bd48706b46849dd5538dbe3dcb..740afc4785088b91b8de2e78d55baf813f1d4981 100644 (file)
@@ -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;