avutil/avutil_version: Run checks just once
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 16 Apr 2013 13:22:56 +0000 (15:22 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 16 Apr 2013 15:04:16 +0000 (17:04 +0200)
This ensures that applications that call avutil_version() often
would not run the checls every time

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/utils.c

index 8f83c02..c157aa8 100644 (file)
 
 unsigned avutil_version(void)
 {
+    static int checks_done;
+    if (checks_done)
+        return LIBAVUTIL_VERSION_INT;
+
     av_assert0(AV_PIX_FMT_VDA_VLD == 81); //check if the pix fmt enum has not had anything inserted or removed by mistake
     av_assert0(AV_SAMPLE_FMT_DBLP == 9);
     av_assert0(AVMEDIA_TYPE_ATTACHMENT == 4);
@@ -42,7 +46,7 @@ unsigned avutil_version(void)
     }
 
     ff_check_pixfmt_descriptors();
-
+    checks_done = 1;
     return LIBAVUTIL_VERSION_INT;
 }