Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions test/common/provider_null.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
#include <assert.h>
#include <stdlib.h>

#include "provider_null.h"
#include <umf/memory_provider_ops.h>

#include "provider_null.h"
#include "utils_common.h"

static umf_result_t nullInitialize(const void *params, void **pool) {
(void)params;
*pool = NULL;
Expand All @@ -22,9 +24,18 @@ static umf_result_t nullFinalize(void *pool) {
static umf_result_t nullAlloc(void *provider, size_t size, size_t alignment,
void **ptr) {
(void)provider;
(void)size;
(void)alignment;
*ptr = NULL;

if (ptr == NULL) {
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
}

if (size == 0) {
*ptr = NULL;
return UMF_RESULT_SUCCESS;
}

*ptr = (void *)ALIGN_UP_SAFE(0xDEADBEAF, alignment); // any not-NULL value

return UMF_RESULT_SUCCESS;
}

Expand Down