diff options
author | orbitz <orbitz@gmail.com> | 2013-12-29 12:36:37 +0100 |
---|---|---|
committer | orbitz <orbitz@gmail.com> | 2013-12-29 12:36:37 +0100 |
commit | c2dfccab8aa22f308dc572b18658036e9db01107 (patch) | |
tree | 9f9a89cbfe2f526d461dad629da5fe76aea10361 /kmer_utils.c | |
parent | da0825a749c0879a6aff8731a7d6c716e68d89e8 (diff) |
Refactor to pull opening the file out of the count function
Diffstat (limited to 'kmer_utils.c')
-rw-r--r-- | kmer_utils.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/kmer_utils.c b/kmer_utils.c index e818a27..9e4bdd8 100644 --- a/kmer_utils.c +++ b/kmer_utils.c @@ -107,7 +107,7 @@ char *strnstrip(const char *s, char *dest, int c, unsigned long long len) { return dest; } -unsigned long long * get_kmer_counts_from_file(const char *fn, const unsigned int kmer) { +unsigned long long * get_kmer_counts_from_file(FILE *fh, const unsigned int kmer) { char *line = NULL; size_t len = 0; ssize_t read; @@ -115,12 +115,6 @@ unsigned long long * get_kmer_counts_from_file(const char *fn, const unsigned in long long i = 0; long long position = 0; - FILE * const fh = fopen(fn, "r"); - if(fh == NULL) { - fprintf(stderr, "Error opening %s - %s\n", fn, strerror(errno)); - exit(EXIT_FAILURE); - } - // width is 4^kmer // there's a sneaky bitshift to avoid pow dependency const unsigned long width = pow_four(kmer); |