From 128c0e3fdaf0f9fabe934e8c6468a8213bacffe8 Mon Sep 17 00:00:00 2001 From: Rob Davies Date: Fri, 6 Dec 2019 12:42:41 +0000 Subject: [PATCH] Change signature of kgets_func2() to be more like hgetln() In particular the second parameter should be size_t, not int. The incorrect version worked when using hgetln(), mainly because the ABI passes arguments in registers. This ensures it will work because the types match instead of due to a happy accident. Hat-tip to John Marshall for spotting this. --- htslib/kstring.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htslib/kstring.h b/htslib/kstring.h index d93b61998..02da3ed72 100644 --- a/htslib/kstring.h +++ b/htslib/kstring.h @@ -130,7 +130,8 @@ extern "C" { HTSLIB_EXPORT int kgetline(kstring_t *s, kgets_func *fgets, void *fp); - typedef ssize_t kgets_func2(char *, int, void *); + // This matches the signature of hgetln(), apart from the last pointer + typedef ssize_t kgets_func2(char *, size_t, void *); HTSLIB_EXPORT int kgetline2(kstring_t *s, kgets_func2 *fgets, void *fp);