[FFmpeg-devel] lavu/time.c: Fix check for clock_gettime

Submitted by Marvin Scholz on May 22, 2019, 10:38 a.m.

Details

Message ID 20190522103806.12935-1-epirat07@gmail.com
State New
Headers show

Commit Message

Marvin Scholz May 22, 2019, 10:38 a.m.
According to the documentation [1] when checking for a symbol it
should be explicitly checked against NULL and the function pointer
dereferenced.

[1] https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html#//apple_ref/doc/uid/20002378-106633
---
 libavutil/time.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavutil/time.c b/libavutil/time.c
index afa6658aa6..42a7c1792f 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 != NULL)
 #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 == NULL)
         return 0;
 #endif
     return 1;