notmuch/util/zlib-extra.h
David Bremner ad9c2e91a0 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.
2020-04-28 10:35:44 -03:00

39 lines
805 B
C

#ifndef _ZLIB_EXTRA_H
#define _ZLIB_EXTRA_H
#include "util.h"
#include <zlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Like getline, but read from a gzFile. Allocation is with talloc.
* Returns:
*
* UTIL_SUCCESS, UTIL_OUT_OF_MEMORY, UTIL_ERRNO, UTIL_GZERROR
* Consult util.h for description
*
* UTIL_EOF End of file encountered before
* any characters read
*/
util_status_t
gz_getline (void *ctx, char **lineptr, ssize_t *bytes_read, gzFile stream);
/* return a suitable error string based on the return status
* from gz_readline
*/
const char *
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 */
const char *
gzerror_str(gzFile file);
#ifdef __cplusplus
}
#endif
#endif