diff options
Diffstat (limited to 'test/test_allocator.h')
| -rw-r--r-- | test/test_allocator.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/test_allocator.h b/test/test_allocator.h index 0e58454edbd6..09e5791b81d9 100644 --- a/test/test_allocator.h +++ b/test/test_allocator.h @@ -7,9 +7,13 @@ // Harness for mocking `malloc` and `realloc` typedef enum call_expectation { + // Call malloc and return a pointer MALLOC, + // Pretend call malloc, but return NULL (fail) MALLOC_FAIL, + // Call realloc and return a pointer REALLOC, + // Pretend call realloc, but return NULL (fail) REALLOC_FAIL } call_expectation; @@ -17,9 +21,9 @@ void set_mock_malloc(int calls, ...); void finalize_mock_malloc(void); -void *instrumented_malloc(size_t size); +void* instrumented_malloc(size_t size); -void *instrumented_realloc(void *ptr, size_t size); +void* instrumented_realloc(void* ptr, size_t size); #define WITH_MOCK_MALLOC(block, malloc_calls, ...) \ do { \ |
