diff options
| author | Gertjan van den Burg <burg@ese.eur.nl> | 2016-09-20 16:38:32 +0200 |
|---|---|---|
| committer | Gertjan van den Burg <burg@ese.eur.nl> | 2016-09-20 16:38:32 +0200 |
| commit | 3185b354ec9a478543b44fa90ece794a7717333b (patch) | |
| tree | 095047380240a6447265deaaa5a71cee01aa3008 /src/gensvm_memory.c | |
| parent | Rename print_matrix to reflect namespace (diff) | |
| download | gensvm-3185b354ec9a478543b44fa90ece794a7717333b.tar.gz gensvm-3185b354ec9a478543b44fa90ece794a7717333b.zip | |
Switch to using exit_failure and use of err for errors
Diffstat (limited to 'src/gensvm_memory.c')
| -rw-r--r-- | src/gensvm_memory.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gensvm_memory.c b/src/gensvm_memory.c index 63c8965..624a4a6 100644 --- a/src/gensvm_memory.c +++ b/src/gensvm_memory.c @@ -33,9 +33,11 @@ void *mycalloc(const char *file, int line, unsigned long size, void *ptr = calloc(size, typesize); if (!ptr) { - fprintf(stderr, "Couldn't allocate memory: %lu bytes (%s:%d)\n", - size, file, line); + // LCOV_EXCL_START + fprintf(stderr, "[GenSVM Error]: Couldn't allocate memory: " + "%lu bytes (%s:%d)\n", size, file, line); exit(EXIT_FAILURE); + // LCOV_EXCL_STOP } return ptr; } @@ -62,9 +64,11 @@ void *mymalloc(const char *file, int line, unsigned long size) { void *ptr = malloc(size); if (!ptr) { - fprintf(stderr, "Couldn't allocate memory: %lu bytes (%s:%d)\n", - size, file, line); + // LCOV_EXCL_START + fprintf(stderr, "[GenSVM Error]: Couldn't allocate memory: " + "%lu bytes (%s:%d)\n", size, file, line); exit(EXIT_FAILURE); + // LCOV_EXCL_STOP } return ptr; } @@ -92,9 +96,11 @@ void *myrealloc(const char *file, int line, unsigned long size, void *var) { void *ptr = realloc(var, size); if (!ptr) { - fprintf(stderr, "Couldn't reallocate memory: %lu bytes (%s:%d)\n", - size, file, line); + // LCOV_EXCL_START + fprintf(stderr, "[GenSVM Error]: Couldn't reallocate memory: " + "%lu bytes (%s:%d)\n", size, file, line); exit(EXIT_FAILURE); + // LCOV_EXCL_STOP } return ptr; } |
