Skip to content

Include <unistd.h> and <errno.h> directly where needed#1145

Merged
daviesrob merged 1 commit intosamtools:developfrom
jmarshall:sysheaders
Oct 5, 2020
Merged

Include <unistd.h> and <errno.h> directly where needed#1145
daviesrob merged 1 commit intosamtools:developfrom
jmarshall:sysheaders

Conversation

@jmarshall
Copy link
Copy Markdown
Member

Similarly to PR #1143, sam.c also needs <unistd.h> explicitly for environments in which it doesn't get it via <zlib.h> or similar.

Both htslib/sam.h and test/test-vcf-api.c use errno but get it only semi-accidentally via htslib/kstring.h. Include <errno.h> explicitly, and similarly <string.h> for strerror().

Various test/*.c programs that use getopt() need include only <unistd.h> rather than <getopt.h>, which is needed only for getopt_long().

All uncovered by building in an environment with dummy <zlib.h> and <getopt.h> headers that don't #include any other headers or define anything extraneous, and temporarily commenting out #include <errno.h> and other errno usage in htslib/*.h.

Similarly to the previous commit, sam.c needs <unistd.h> explicitly
for environments in which it doesn't get it via <zlib.h> or similar.

Both htslib/sam.h and test/test-vcf-api.c use errno but get it only
semi-accidentally via htslib/kstring.h. Include <errno.h> explicitly,
and similarly <string.h> for strerror().

Various test/*.c programs that use getopt() need include only <unistd.h>
rather than <getopt.h>, which is needed only for getopt_long().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants