UYS  0.1
Useful Yet Simple (C libraries collection)
 All Data Structures Files Functions Typedefs Macros Pages
uys_alloc.c
1 #include <stdint.h>
2 #include <stdlib.h>
3 
4 #include "uys_alloc.h"
5 
6 
7 int UYS_MAKE_MALLOC_FAIL = 0;
8 void* uys_malloc_test_fn(size_t size) {
9  if (UYS_MAKE_MALLOC_FAIL)
10  return NULL;
11  return malloc(size);
12 }
13 
14 void uys_set_malloc_to_fail(int status) {
15  UYS_MAKE_MALLOC_FAIL = status;
16 }