From 2482ea5bd96ae53a584c8c440df7760a8b7c21ff Mon Sep 17 00:00:00 2001 From: Johannes Demel Date: Fri, 12 Jan 2024 21:48:31 +0100 Subject: [PATCH] fprintf: Remove fprintf statements from volk_malloc As per issue description, this may fail and is communicated the C way via a `NULL` pointer. As with similar routines, a user must check the return value. We shouldn't clutter stderr. Signed-off-by: Johannes Demel --- lib/volk_malloc.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/volk_malloc.c b/lib/volk_malloc.c index 8840fc3f..61ad162d 100644 --- a/lib/volk_malloc.c +++ b/lib/volk_malloc.c @@ -38,7 +38,6 @@ void* volk_malloc(size_t size, size_t alignment) { if ((size == 0) || (alignment == 0)) { - fprintf(stderr, "VOLK: Error allocating memory: either size or alignment is 0\n"); return NULL; } // Tweak size to satisfy ASAN (the GCC address sanitizer). @@ -59,21 +58,12 @@ void* volk_malloc(size_t size, size_t alignment) int err = posix_memalign(&ptr, alignment, size); if (err != 0) { ptr = NULL; - fprintf(stderr, - "VOLK: Error allocating memory " - "(posix_memalign: error %d: %s)\n", - err, - strerror(err)); } #elif defined(_MSC_VER) || defined(__MINGW32__) void* ptr = _aligned_malloc(size, alignment); #else void* ptr = aligned_alloc(alignment, size); #endif - if (ptr == NULL) { - fprintf(stderr, - "VOLK: Error allocating memory (aligned_alloc/_aligned_malloc)\n"); - } return ptr; }