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.
This commit is contained in:
David Bremner 2020-04-27 09:24:22 -03:00
parent 11ac932a45
commit ad9c2e91a0
2 changed files with 9 additions and 2 deletions

View file

@ -85,3 +85,10 @@ gz_error_string (util_status_t status, gzFile file)
else else
return util_error_string (status); return util_error_string (status);
} }
const char *
gzerror_str(gzFile file)
{
int dummy;
return gzerror (file, &dummy);
}

View 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 /* Call gzerror with a dummy errno argument, the docs don't promise to
* support the NULL case */ * support the NULL case */
inline const char * const char *
gzerror_str(gzFile file) { int dummy; return gzerror (file, &dummy); } gzerror_str(gzFile file);
#ifdef __cplusplus #ifdef __cplusplus
} }