From: Vladislav Shchapov Date: Tue, 5 Mar 2024 13:14:21 +0000 (+0500) Subject: Replace conditional call to functable.force_init with macro FUNCTABLE_INIT X-Git-Tag: 2.2.0~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af8169a724bd607e4e8c7de2a705ab17206217d6;p=thirdparty%2Fzlib-ng.git Replace conditional call to functable.force_init with macro FUNCTABLE_INIT Signed-off-by: Vladislav Shchapov --- diff --git a/deflate.c b/deflate.c index cf77eb94..229bad6a 100644 --- 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; diff --git a/functable.h b/functable.h index 81a386cd..173a030c 100644 --- a/functable.h +++ b/functable.h @@ -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 diff --git a/inflate.c b/inflate.c index 9acfbc05..868d5334 100644 --- 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;