diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-09-26 10:56:49 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-01-11 15:15:53 +0100 |
commit | ecd4490dd06cccb15bc1a547d15bdbfbd853929c (patch) | |
tree | 56475547c7c1878e6c781de36de189bc1844420a | |
parent | eb998e33ef8f097206b2ef0debd564db2aedbd24 (diff) | |
download | ffmpeg-ecd4490dd06cccb15bc1a547d15bdbfbd853929c.tar.gz |
avutil/utils: Remove racy check from avutil_version()
avutil_version() currently performs several checks before
just returning the version. There is a static int that aims
to ensure that these tests are run only once. The reason is that
there used to be a slightly expensive check, but it has been removed
in 92e3a6fdac73f7e1d69d69717219a7538877d7a0. Today running only
once is unnecessary and can be counterproductive: GCC 10 optimizes
all the actual checks away, but the checks_done variable and the code
setting it has been kept. Given that this check is inherently racy
(it uses non-atomic variables), it is best to just remove it.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit ff800903747325f15056444c11053279e391d60b)
-rw-r--r-- | libavutil/utils.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/libavutil/utils.c b/libavutil/utils.c index c1cd452eee..ea9b5097b8 100644 --- a/libavutil/utils.c +++ b/libavutil/utils.c @@ -37,10 +37,6 @@ const char *av_version_info(void) unsigned avutil_version(void) { - static int checks_done; - if (checks_done) - return LIBAVUTIL_VERSION_INT; - av_assert0(AV_SAMPLE_FMT_DBLP == 9); av_assert0(AVMEDIA_TYPE_ATTACHMENT == 4); av_assert0(AV_PICTURE_TYPE_BI == 7); @@ -58,7 +54,6 @@ unsigned avutil_version(void) av_log(NULL, AV_LOG_ERROR, "Libavutil has been linked to a broken llrint()\n"); } - checks_done = 1; return LIBAVUTIL_VERSION_INT; } |