summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2020-04-27 09:24:22 -0300
committerDavid Bremner <david@tethera.net>2020-04-28 10:35:44 -0300
commitad9c2e91a012920bebfe70bc472d44678abc3259 (patch)
treefe61c4e6b18594cbe4d9734dc31d0d21545b325f /util
parent11ac932a4503872c19987b843d58513c4b9ef76f (diff)
util/zlib-extra: de-inline gzerror_str
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.
Diffstat (limited to 'util')
-rw-r--r--util/zlib-extra.c7
-rw-r--r--util/zlib-extra.h4
2 files changed, 9 insertions, 2 deletions
diff --git a/util/zlib-extra.c b/util/zlib-extra.c
index 2d2d2414..3a75e504 100644
--- a/util/zlib-extra.c
+++ b/util/zlib-extra.c
@@ -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);
+}
diff --git a/util/zlib-extra.h b/util/zlib-extra.h
index 296dc914..e9925c98 100644
--- a/util/zlib-extra.h
+++ b/util/zlib-extra.h
@@ -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
}