Remove duplicate definition of align_{malloc,free} (#631)

Also use it instead of duplicating the code.

Fixes #326

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
This commit is contained in:
Kévin Petit
2020-02-28 12:22:38 +00:00
committed by GitHub
parent b95ef1ad04
commit b93c1df933
5 changed files with 72 additions and 99 deletions

View File

@@ -1234,13 +1234,7 @@ char * generate_random_image_data( image_descriptor *imageInfo, BufferOwningPtr<
}
#else
P.reset( NULL ); // Free already allocated memory first, then try to allocate new block.
#if defined (_WIN32) && defined(_MSC_VER)
char *data = (char *)_aligned_malloc(allocSize, get_pixel_size(imageInfo->format));
#elif defined(__MINGW32__)
char *data = (char *)__mingw_aligned_malloc(allocSize, get_pixel_size(imageInfo->format));
#else
char *data = (char *)memalign(get_pixel_size(imageInfo->format), allocSize);
#endif
char *data = (char *)align_malloc(allocSize, get_pixel_size(imageInfo->format));
P.reset(data,NULL,0,allocSize, true);
#endif
@@ -3163,14 +3157,7 @@ char *create_random_image_data( ExplicitType dataType, image_descriptor *imageIn
P.reset(data);
}
#else
#if defined (_WIN32) && defined(_MSC_VER)
char *data = (char *)_aligned_malloc(allocSize, get_pixel_size(imageInfo->format));
#elif defined(__MINGW32__)
char *data = (char *)__mingw_aligned_malloc(allocSize, get_pixel_size(imageInfo->format));
#else
char *data = (char *)memalign(get_pixel_size(imageInfo->format), allocSize);
#endif
char *data = (char *)align_malloc(allocSize, get_pixel_size(imageInfo->format));
P.reset(data,NULL,0,allocSize,true);
#endif