]> git.cworth.org Git - notmuch/commitdiff
util/zlib-extra: de-inline gzerror_str
authorDavid Bremner <david@tethera.net>
Mon, 27 Apr 2020 12:24:22 +0000 (09:24 -0300)
committerDavid Bremner <david@tethera.net>
Tue, 28 Apr 2020 13:35:44 +0000 (10:35 -0300)
It turns out that putting inline functions in C header files is not a
good idea, and can cause linking problems if the compiler decides not
to inline them.  In principle this is solvable by using a "static
inline" declaration, but this potentially makes a copy in every
compilation unit. Since we don't actually care about the performance
of this function, just use a non-inline function.

util/zlib-extra.c
util/zlib-extra.h

index 2d2d24145ad1bb97d31c5ff6a3e6b117f8bb31ee..3a75e50434b92b4ca1dd7d2fffed14e26fde40b8 100644 (file)
@@ -85,3 +85,10 @@ gz_error_string (util_status_t status, gzFile file)
     else
        return util_error_string (status);
 }
+
+const char *
+gzerror_str(gzFile file)
+{
+    int dummy;
+    return gzerror (file, &dummy);
+}
index 296dc91441be04e0c32fbacd7938819750930c9b..e9925c985330073398c01b53dffcf0d6e6fc208d 100644 (file)
@@ -29,8 +29,8 @@ gz_error_string (util_status_t status, gzFile stream);
 
 /* Call gzerror with a dummy errno argument, the docs don't promise to
  * support the NULL case */
-inline const char *
-gzerror_str(gzFile file) { int dummy; return gzerror (file, &dummy); }
+const char *
+gzerror_str(gzFile file);
 
 #ifdef __cplusplus
 }