Debian Codegraph @

tests/CppUTest/AllocationInCFile.c

raw symbols SCIP
1 #include "AllocationInCFile.h"
2 #include "CppUTest/MemoryLeakDetectorMallocMacros.h"
3 #include "CppUTest/StandardCLibrary.h"
4
5 /* This file is for simulating overloads of malloc */
6
7 char* mallocAllocation()
8 {
9 return (char*) malloc(10UL);
10 }
11
12 char* strdupAllocation()
13 {
14 #ifdef CPPUTEST_USE_STRDUP_MACROS
15 return strdup("0123456789");
16 #else
17 return NULL;
18 #endif
19 }
20
21
22 char* strndupAllocation()
23 {
24 #ifdef CPPUTEST_USE_STRDUP_MACROS
25 return strndup("0123456789", 10);
26 #else
27 return NULL;
28 #endif
29 }
30
31 void freeAllocation(void* memory)
32 {
33 free(memory);
34 }
35
36 #undef free
37
38 void freeAllocationWithoutMacro(void* memory)
39 {
40 free(memory);
41 }
42