[FFmpeg-trac] #7486(avutil:new): definition conflict of gmtime in time_internal.h
FFmpeg
trac at avcodec.org
Thu Oct 11 16:47:14 EEST 2018
#7486: definition conflict of gmtime in time_internal.h
-------------------------------------+-------------------------------------
Reporter: cortexembed | Owner:
Type: defect | Status: new
Priority: minor | Component: avutil
Version: git-master | Resolution:
Keywords: | Blocked By:
time_internal.h gmtime | Reproduced by developer: 0
Blocking: |
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by cortexembed):
I also stronly recommend to move function bodies from
libavutil/time._internal.h into libavutil/time.c
Here is a possbile patch:
diff --git a/libavutil/time.c b/libavutil/time.c
index afa6658aa6..cd3a0fe1f0 100644
--- a/libavutil/time.c
+++ b/libavutil/time.c
@@ -96,3 +96,28 @@ int av_usleep(unsigned usec)
return AVERROR(ENOSYS);
#endif
}
+
+#if !HAVE_GMTIME_R && !defined(gmtime_r)
+inline struct tm *gmtime_r(const time_t* clock, struct tm *result)
+{
+ struct tm *ptr = gmtime(clock);
+ if (!ptr)
+ return NULL;
+ *result = *ptr;
+ return result;
+}
+#endif
+
+
+#if !HAVE_LOCALTIME_R && !defined(localtime_r)
+inline struct tm *localtime_r(const time_t* clock, struct tm *result)
+{
+ struct tm *ptr = localtime(clock);
+ if (!ptr)
+ return NULL;
+ *result = *ptr;
+ return result;
+}
+#endif
diff --git a/libavutil/time_internal.h b/libavutil/time_internal.h
index 612a75a041..2dfc9c08dc 100644
--- a/libavutil/time_internal.h
+++ b/libavutil/time_internal.h
@@ -23,25 +23,11 @@
#include "config.h"
#if !HAVE_GMTIME_R && !defined(gmtime_r)
-static inline struct tm *gmtime_r(const time_t* clock, struct tm *result)
-{
- struct tm *ptr = gmtime(clock);
- if (!ptr)
- return NULL;
- *result = *ptr;
- return result;
-}
+struct tm *gmtime_r(const time_t* clock, struct tm *result);
#endif
#if !HAVE_LOCALTIME_R && !defined(localtime_r)
-static inline struct tm *localtime_r(const time_t* clock, struct tm
*result)
-{
- struct tm *ptr = localtime(clock);
- if (!ptr)
- return NULL;
- *result = *ptr;
- return result;
-}
+struct tm *localtime_r(const time_t* clock, struct tm *result);
#endif
#endif /* AVUTIL_TIME_INTERNAL_H */
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7486#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list