aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2013-09-13 14:09:38 -0400
committerCalvin Morrison <mutantturkey@gmail.com>2013-09-13 14:09:38 -0400
commit4ae5cfe9e627429ee4d27390da9eb07a410f8831 (patch)
treedf3820e629b8f05aa34e81d669bd94dbd7f9b404
parentdc659709ec94c9d414df8b04f62322f74e1e4a0d (diff)
don't use strlen(line) when we already have that in the read variable
-rw-r--r--kmer_frequency_per_sequence.c2
-rw-r--r--kmer_total_count.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/kmer_frequency_per_sequence.c b/kmer_frequency_per_sequence.c
index 5fff8ba..5191b86 100644
--- a/kmer_frequency_per_sequence.c
+++ b/kmer_frequency_per_sequence.c
@@ -37,7 +37,7 @@ int main(int argc, char **argv) {
if(counts == NULL)
exit(EXIT_FAILURE);
- for(i = 0; i < strlen(line) - kmer; i++) {
+ for(i = 0; i < read - kmer; i++) {
counts[convert_kmer_to_index(&line[i], kmer, width)]++;
}
diff --git a/kmer_total_count.c b/kmer_total_count.c
index 48e64b5..23ca512 100644
--- a/kmer_total_count.c
+++ b/kmer_total_count.c
@@ -41,11 +41,11 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
while ((read = getline(&line, &len, fh)) != -1) {
- if(line[0] != '>') {
- for(i = 0; i < strlen(line) - kmer; i++) {
+ if(line[0] != '>') {
+ for(i = 0; i < read - kmer; i++) {
counts[convert_kmer_to_index(&line[i],kmer, width)]++;
}
- }
+ }
}
for(i = 0; i < width; i++)