From 0c3bfb9b48a34982ea18c889f2c79b711b1c6363 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sun, 4 Oct 2015 22:31:12 +0200 Subject: [PATCH] Remove coverage need for malloc failure functions --- cmdline/support.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmdline/support.c b/cmdline/support.c index 95e1933e..34428c6d 100644 --- a/cmdline/support.c +++ b/cmdline/support.c @@ -597,6 +597,9 @@ int fmtime(int f, int64_t mtime_sec, int mtime_nsec) /****************************************************************************/ /* memory */ +/** + * Total amount of memory allocated. + */ static size_t mcounter; size_t malloc_counter(void) @@ -604,6 +607,7 @@ size_t malloc_counter(void) return mcounter; } +/* LCOV_EXCL_START */ static ssize_t malloc_print(int f, const char* str) { ssize_t len = 0; @@ -611,7 +615,9 @@ static ssize_t malloc_print(int f, const char* str) ++len; return write(f, str, len); } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ static ssize_t malloc_printn(int f, size_t value) { char buf[32]; @@ -628,11 +634,12 @@ static ssize_t malloc_printn(int f, size_t value) return write(f, buf + i, sizeof(buf) - i); } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ void malloc_fail(size_t size) { /* don't use printf to avoid any possible extra allocation */ - /* LCOV_EXCL_START */ int f = 2; /* stderr */ malloc_print(f, "Failed for Low Memory!\n"); @@ -646,8 +653,8 @@ void malloc_fail(size_t size) malloc_print(f, "You are currently using a 32 bits executable.\n"); malloc_print(f, "If you have more than 4GB of memory, please upgrade to a 64 bits one.\n"); } - /* LCOV_EXCL_STOP */ } +/* LCOV_EXCL_STOP */ void* malloc_nofail(size_t size) {