Skip to content

Commit

Permalink
Merge pull request #744 from jdemel/remove-fprintf-from-volk-malloc
Browse files Browse the repository at this point in the history
fprintf: Remove fprintf statements from volk_malloc
  • Loading branch information
jdemel committed Jan 29, 2024
2 parents 3b710d1 + 2482ea5 commit f751a54
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions lib/volk_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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;
}

Expand Down

0 comments on commit f751a54

Please sign in to comment.