]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Replace conditional call to functable.force_init with macro FUNCTABLE_INIT
authorVladislav Shchapov <vladislav@shchapov.ru>
Tue, 5 Mar 2024 13:14:21 +0000 (18:14 +0500)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Wed, 6 Mar 2024 22:32:15 +0000 (23:32 +0100)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
deflate.c
functable.h
inflate.c

index cf77eb94d418f21207154d980d475e60482c9b9a..229bad6a257b3e14cdd189943836aadab31cb174 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -190,10 +190,8 @@ int32_t ZNG_CONDEXPORT PREFIX(deflateInit2)(PREFIX3(stream) *strm, int32_t level
     deflate_state *s;
     int wrap = 1;
 
-#ifndef DISABLE_RUNTIME_CPU_DETECTION
-    /* Force initialization functable, because deflate captures function pointers from functable. */
-    functable.force_init();
-#endif
+    /* Initialize functable */
+    FUNCTABLE_INIT;
 
     if (strm == NULL)
         return Z_STREAM_ERROR;
index 81a386cd656d13cb52591bd1890e648ee911acfa..173a030c660d52c10d0a927a3fce238e91205ee8 100644 (file)
@@ -17,6 +17,7 @@
  * Instead we use native_ macro indicating the best available variant of arch-specific
  * functions for the current platform.
  */
+#  define FUNCTABLE_INIT ((void)0)
 #  define FUNCTABLE_CALL(name) native_ ## name
 #  define FUNCTABLE_FPTR(name) &native_ ## name
 
@@ -45,6 +46,7 @@ Z_INTERNAL extern struct functable_s functable;
 
 /* Explicitly indicate functions are conditionally dispatched.
  */
+#  define FUNCTABLE_INIT functable.force_init()
 #  define FUNCTABLE_CALL(name) functable.name
 #  define FUNCTABLE_FPTR(name) functable.name
 
index 9acfbc0591d5f2ab0fdb9e347536186f869d2718..868d5334401e252ab3b9e51453503dfaf3c58057 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -139,10 +139,8 @@ int32_t ZNG_CONDEXPORT PREFIX(inflateInit2)(PREFIX3(stream) *strm, int32_t windo
     int32_t ret;
     struct inflate_state *state;
 
-#ifndef DISABLE_RUNTIME_CPU_DETECTION
-    /* Initialize functable earlier. */
-    functable.force_init();
-#endif
+    /* Initialize functable */
+    FUNCTABLE_INIT;
 
     if (strm == NULL)
         return Z_STREAM_ERROR;