aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-04-14 23:18:25 -0400
committerCalvin Morrison <mutantturkey@gmail.com>2014-04-14 23:18:25 -0400
commitab84c2a8ed7289394a790b799b595599f1c423bb (patch)
treecf9e35359bf711a6098387f98946804e7a80fd0c
parentdd158ef94da81bd1456b8f00f5be67e5f56d23bd (diff)
small performance bump. don't strlen a file when we know it's len from strnstrip
-rw-r--r--kmer_utils.c4
1 files changed, 1 insertions, 3 deletions
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