Skip to content

Commit

Permalink
Change signature of kgets_func2() to be more like hgetln()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
daviesrob committed Dec 6, 2019
1 parent c1c8c80 commit 128c0e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion htslib/kstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 128c0e3

Please sign in to comment.