avutil/utils: Remove racy check from avutil_version()
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Sun, 26 Sep 2021 08:56:49 +0000 (10:56 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Tue, 11 Jan 2022 14:15:53 +0000 (15:15 +0100)
commitecd4490dd06cccb15bc1a547d15bdbfbd853929c
tree56475547c7c1878e6c781de36de189bc1844420a
parenteb998e33ef8f097206b2ef0debd564db2aedbd24
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)
libavutil/utils.c