From ab84c2a8ed7289394a790b799b595599f1c423bb Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Mon, 14 Apr 2014 23:18:25 -0400 Subject: small performance bump. don't strlen a file when we know it's len from strnstrip --- kmer_utils.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'kmer_utils.c') diff --git a/kmer_utils.c b/kmer_utils.c index 436c316..5d3b8a5 100644 --- a/kmer_utils.c +++ b/kmer_utils.c @@ -275,7 +275,6 @@ array_type * get_kmer_counts_from_file(array_type *counts, FILE *fh, const unsig while ((read = getdelim(&line, &len, '>', fh)) != -1) { size_t k; char *seq; - size_t seq_length; // find our first \n, this should be the end of the header seq = strchr(line, '\n'); @@ -286,8 +285,7 @@ array_type * get_kmer_counts_from_file(array_type *counts, FILE *fh, const unsig seq = seq + 1; // strip out all other newlines to handle multiline sequences - strnstrip(seq, '\n', strlen(seq)); - seq_length = strlen(seq); + const size_t seq_length = strnstrip(seq, '\n', strlen(seq)); // relace A, C, G and T with 0, 1, 2, 3 respectively // everything else is 5 -- cgit v1.2.3