diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2013-10-29 16:14:21 -0400 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2013-10-29 16:14:21 -0400 |
commit | 8897d37c2b825016abe29688537d8fc5bf3daf11 (patch) | |
tree | a8e7dda77bfbe2494c1e4e30e831be842229abf5 /src/c/quikr.c | |
parent | 92998412716a7ae7559a6b5a0a04cfab2b10a83e (diff) |
update types and check malloc
Diffstat (limited to 'src/c/quikr.c')
-rw-r--r-- | src/c/quikr.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/c/quikr.c b/src/c/quikr.c index 0570acc..1e9d8e0 100644 --- a/src/c/quikr.c +++ b/src/c/quikr.c @@ -23,15 +23,15 @@ int main(int argc, char **argv) { char *sensing_matrix_filename = NULL; char *output_filename = NULL; - long x = 0; - long y = 0; + unsigned long long x = 0; + unsigned long long y = 0; - int verbose = 0; + unsigned long long width = 0; - int lambda = 10000; - int kmer = 6; + unsigned int kmer = 6; + unsigned long long lambda = 10000; - long width = 0; + int verbose = 0; while (1) { static struct option long_options[] = { @@ -105,8 +105,8 @@ int main(int argc, char **argv) { } if(verbose) { - printf("kmer: %d\n", kmer); - printf("lambda: %d\n", lambda); + printf("kmer: %u\n", kmer); + printf("lambda: %llu\n", lambda); printf("fasta: %s\n", input_fasta_filename); printf("sensing matrix: %s\n", sensing_matrix_filename); printf("output: %s\n", output_filename); @@ -132,8 +132,12 @@ int main(int argc, char **argv) { // load counts matrix unsigned long long *integer_counts = get_kmer_counts_from_file(input_fasta_filename, kmer); - double *count_matrix = malloc(sizeof(double) * width); + if(count_matrix == NULL) { + fprintf(stderr, "Could not allocate memory:\n"); + exit(EXIT_FAILURE); + } + count_matrix[0] = 0; for(x = 1; x < width ; x++) |