Skip to content

Commit 128c0e3

Browse files
committed
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.
1 parent c1c8c80 commit 128c0e3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

htslib/kstring.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ extern "C" {
130130
HTSLIB_EXPORT
131131
int kgetline(kstring_t *s, kgets_func *fgets, void *fp);
132132

133-
typedef ssize_t kgets_func2(char *, int, void *);
133+
// This matches the signature of hgetln(), apart from the last pointer
134+
typedef ssize_t kgets_func2(char *, size_t, void *);
134135
HTSLIB_EXPORT
135136
int kgetline2(kstring_t *s, kgets_func2 *fgets, void *fp);
136137

0 commit comments

Comments
 (0)