]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Remove unneeded and confusing alwaysinline
authorDaniel Axtens <dja@axtens.net>
Fri, 1 May 2015 05:30:05 +0000 (15:30 +1000)
committerDaniel Axtens <dja@axtens.net>
Fri, 1 May 2015 05:41:44 +0000 (15:41 +1000)
alwaysinline expands to __attribute__((always_inline)).

This does not force gcc to inline the function. Instead, it allows gcc to
inline the function when complied without optimisations. (Normally, inline
functions are only inlined when compiled with optimisations.)[0]

alwaysinline was only used for bulk_insert_str, and it seems to be using it
in an attempt to force the function to be inlined. That won't work.
Furthermore, bulk_insert_str wasn't even declared inline, causing warnings.

Remove alwaysinline and replace with inline.
Remove the #defines, as they're no longer used.

[0] https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Function-Attributes.html

Signed-off-by: Daniel Axtens <dja@axtens.net>
deflate.c
zutil.h

index 09d486c43f70d9003e7162dbce0c75c74c11d1d5..323b8d281f8dc8dd59f05eac2391a1a6044df7d2 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -213,7 +213,7 @@ local inline Pos insert_string(deflate_state *z_const s, z_const Pos str)
 
 
 #ifndef NOT_TWEAK_COMPILER
-alwaysinline local void 
+local inline void
 bulk_insert_str(deflate_state *s, Pos startpos, uInt count) {
     uInt idx;
     for (idx = 0; idx < count; idx++) {
diff --git a/zutil.h b/zutil.h
index d0cab49739778037fb1615e1a3381b08a29bec95..5feddb24e3a4b3206166b9b96028a0d5717b5072 100644 (file)
--- a/zutil.h
+++ b/zutil.h
@@ -96,12 +96,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
    But it provides __inline instead, so use that. */
 #if defined(_MSC_VER) && !defined(inline)
 #  define inline __inline
-#endif
-
-#if defined(_MSC_VER)
-#  define alwaysinline __forceinline
-#else
-#  define alwaysinline __attribute__ ((always_inline))
 #endif
 
         /* common defaults */