Browse Source

Add namespace import to Utilities and Logger

Kajetan Johannes Hammerle 11 months ago
parent
commit
c225f7278d
6 changed files with 152 additions and 109 deletions
  1. 18 0
      include/core/Logger.h
  2. 26 1
      include/core/Utility.h
  3. 8 8
      performance/Main.c
  4. 49 49
      src/Utility.c
  5. 4 4
      test/modules/SpinLockTests.c
  6. 47 47
      test/modules/UtilityTests.c

+ 18 - 0
include/core/Logger.h

@@ -56,4 +56,22 @@ check_format(6, 7) void coreLog(CoreLogLevel l, const char* file, int line,
 #define CORE_LOG_DEBUG(...)
 #endif
 
+#ifdef IMPORT_CORE
+#define TERMINAL_RED CORE_TERMINAL_RED
+#define TERMINAL_YELLOW CORE_TERMINAL_YELLOW
+#define TERMINAL_GRAY CORE_TERMINAL_GRAY
+#define TERMINAL_GREEN CORE_TERMINAL_GREEN
+#define TERMINAL_RESET CORE_TERMINAL_RESET
+#define LOG_ERROR CORE_LOG_ERROR
+#define LOG_WARNING CORE_LOG_WARNING
+#define LOG_INFO CORE_LOG_INFO
+#define LOG_DEBUG CORE_LOG_DEBUG
+#define logLevel coreLogLevel
+#define getShortFileName coreGetShortFileName
+#define LOG_ERROR CORE_LOG_ERROR
+#define LOG_WARNING CORE_LOG_WARNING
+#define LOG_INFO CORE_LOG_INFO
+#define LOG_DEBUG CORE_LOG_DEBUG
+#endif
+
 #endif

+ 26 - 1
include/core/Utility.h

@@ -48,6 +48,31 @@ void coreFree(void* p);
 #endif
 
 bool coreSleepNanos(i64 nanos);
-i64 coreNanos(void);
+i64 coreGetNanos(void);
+
+#ifdef IMPORT_CORE
+#define popCount corePopCount
+#define interpolate coreInterpolate
+#define PI CORE_PI
+#define radianToDegree coreRadianToDegree
+#define degreeToRadian coreDegreeToRadian
+#define maxSize coreMaxSize
+#define minSize coreMinSize
+#define toString coreToString
+#define toStringSize coreToStringSize
+#define toStringInt coreToStringInt
+#define stringAdd coreStringAdd
+#define ExitHandler CoreExitHandler
+#define setExitHandler coreSetExitHandler
+#define EXIT CORE_EXIT
+#define OutOfMemoryHandler CoreOutOfMemoryHandler
+#define setOutOfMemoryHandler coreSetOutOfMemoryHandler
+#define printMemoryReport corePrintMemoryReport
+#define cAllocate coreAllocate
+#define cReallocate coreReallocate
+#define cFree coreFree
+#define sleepNanos coreSleepNanos
+#define getNanos coreGetNanos
+#endif
 
 #endif

+ 8 - 8
performance/Main.c

@@ -5,7 +5,7 @@
 #include "core/Utility.h"
 
 static i64 testSearch(const CoreHashMap* m) {
-    i64 nanos = coreNanos();
+    i64 nanos = coreGetNanos();
     volatile int sum = 0;
     for(int i = 0; i < 10000; i++) {
         for(int k = -5000; k < 5000; k++) {
@@ -15,11 +15,11 @@ static i64 testSearch(const CoreHashMap* m) {
             }
         }
     }
-    return coreNanos() - nanos;
+    return coreGetNanos() - nanos;
 }
 
 static i64 testEmptySearch(const CoreHashMap* m) {
-    i64 nanos = coreNanos();
+    i64 nanos = coreGetNanos();
     volatile int sum = 0;
     for(int i = 0; i < 100'000'000; i++) {
         const int* s = coreHashMapSearchC(m, int, -i, int);
@@ -27,26 +27,26 @@ static i64 testEmptySearch(const CoreHashMap* m) {
             sum = sum + *s;
         }
     }
-    return coreNanos() - nanos;
+    return coreGetNanos() - nanos;
 }
 
 static void fillOrder(CoreHashMap* m) {
-    i64 nanos = coreNanos();
+    i64 nanos = coreGetNanos();
     for(int i = 0; i < 10000; i++) {
         coreHashMapPut(m, int, i, int, i* i);
     }
-    printf("Fill Order: %ldns\n", coreNanos() - nanos);
+    printf("Fill Order: %ldns\n", coreGetNanos() - nanos);
 }
 
 static void fillChaos(CoreHashMap* m) {
-    i64 nanos = coreNanos();
+    i64 nanos = coreGetNanos();
     CoreRandom random;
     coreInitRandom(&random, 0);
     for(int i = 0; i < 10000; i++) {
         int r = coreRandomI32(&random, 0, 10000);
         coreHashMapPut(m, int, r, int, r* r);
     }
-    printf("Fill Chaos: %ldns\n", coreNanos() - nanos);
+    printf("Fill Chaos: %ldns\n", coreGetNanos() - nanos);
 }
 
 static i64 average(CoreHashMap* m, i64 (*f)(const CoreHashMap* m), int n) {

+ 49 - 49
src/Utility.c

@@ -10,15 +10,15 @@
 #include "ErrorSimulator.h"
 #include "core/Logger.h"
 
-extern inline size_t coreMaxSize(size_t a, size_t b);
-extern inline size_t coreMinSize(size_t a, size_t b);
+extern inline size_t maxSize(size_t a, size_t b);
+extern inline size_t minSize(size_t a, size_t b);
 
-static CoreExitHandler exitHandler = nullptr;
+static ExitHandler exitHandler = nullptr;
 static void* exitData = nullptr;
-static CoreOutOfMemoryHandler outOfMemoryHandler = nullptr;
+static OutOfMemoryHandler outOfMemoryHandler = nullptr;
 static void* outOfMemoryData = nullptr;
 
-size_t corePopCount(u64 u) {
+size_t popCount(u64 u) {
     static const u64 map[16] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
     size_t sum = 0;
     for(size_t i = 0; i < sizeof(u64) * 8; i += 4) {
@@ -27,7 +27,7 @@ size_t corePopCount(u64 u) {
     return sum;
 }
 
-size_t coreToString(char* buffer, size_t n, const char* format, ...) {
+size_t toString(char* buffer, size_t n, const char* format, ...) {
     va_list args;
     va_start(args, format);
     int w = vsnprintf(buffer, n, format, args);
@@ -35,15 +35,15 @@ size_t coreToString(char* buffer, size_t n, const char* format, ...) {
     return w < 0 ? 0 : (size_t)w;
 }
 
-size_t coreToStringSize(const void* p, char* buffer, size_t n) {
-    return coreToString(buffer, n, "%zu", *(const size_t*)p);
+size_t toStringSize(const void* p, char* buffer, size_t n) {
+    return toString(buffer, n, "%zu", *(const size_t*)p);
 }
 
-size_t coreToStringInt(const void* p, char* buffer, size_t n) {
-    return coreToString(buffer, n, "%d", *(const int*)p);
+size_t toStringInt(const void* p, char* buffer, size_t n) {
+    return toString(buffer, n, "%d", *(const int*)p);
 }
 
-void coreStringAdd(size_t* w, char** buffer, size_t* n, size_t shift) {
+void stringAdd(size_t* w, char** buffer, size_t* n, size_t shift) {
     *w += shift;
     if(*n > shift) {
         *buffer += shift;
@@ -55,7 +55,7 @@ void coreStringAdd(size_t* w, char** buffer, size_t* n, size_t shift) {
 
 [[noreturn]] void coreExitWithHandler(const char* file, int line, int value) {
     if(value != 0) {
-        file = coreGetShortFileName(file);
+        file = getShortFileName(file);
         CORE_LOG_ERROR("Exit from %s:%d with value %d", file, line, value);
     }
     if(exitHandler != nullptr) {
@@ -64,12 +64,12 @@ void coreStringAdd(size_t* w, char** buffer, size_t* n, size_t shift) {
     exit(value);
 }
 
-void coreSetExitHandler(CoreExitHandler eh, void* data) {
+void setExitHandler(ExitHandler eh, void* data) {
     exitHandler = eh;
     exitData = data;
 }
 
-void coreSetOutOfMemoryHandler(CoreOutOfMemoryHandler h, void* data) {
+void setOutOfMemoryHandler(OutOfMemoryHandler h, void* data) {
     outOfMemoryHandler = h;
     outOfMemoryData = data;
 }
@@ -82,7 +82,7 @@ static void* exitOnNull(void* p, size_t n) {
     return p;
 }
 
-static void* coreRealAllocate(size_t n) {
+static void* RealAllocate(size_t n) {
     void* p = malloc(n);
     while(p == nullptr && outOfMemoryHandler != nullptr) {
         outOfMemoryHandler(outOfMemoryData);
@@ -91,7 +91,7 @@ static void* coreRealAllocate(size_t n) {
     return exitOnNull(p, n);
 }
 
-static void* coreRealReallocate(void* oldP, size_t n) {
+static void* RealReallocate(void* oldP, size_t n) {
     if(n <= 0) {
         free(oldP);
         return nullptr;
@@ -106,7 +106,7 @@ static void* coreRealReallocate(void* oldP, size_t n) {
     return exitOnNull(p, n);
 }
 
-static void coreRealFree(void* p) {
+static void RealFree(void* p) {
     free(p);
 }
 
@@ -114,26 +114,26 @@ static void coreRealFree(void* p) {
 static const u8 CANARY[16] = {0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF,
                               0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF};
 
-struct CoreMemoryInfo;
-typedef struct CoreMemoryInfo CoreMemoryInfo;
-struct CoreMemoryInfo {
-    CoreMemoryInfo* next;
-    CoreMemoryInfo* previous;
+struct MemoryInfo;
+typedef struct MemoryInfo MemoryInfo;
+struct MemoryInfo {
+    MemoryInfo* next;
+    MemoryInfo* previous;
     size_t size;
     int line;
     char buffer[64 - 2 * sizeof(void*) - sizeof(size_t) - sizeof(int)];
     char canary[sizeof(CANARY)];
 };
-static_assert(sizeof(CoreMemoryInfo) == 80, "memory info has invalid size");
-static CoreMemoryInfo* headMemoryInfo = nullptr;
+static_assert(sizeof(MemoryInfo) == 80, "memory info has invalid size");
+static MemoryInfo* headMemoryInfo = nullptr;
 
-static void addMemoryInfo(CoreMemoryInfo* info, const char* file, int line,
+static void addMemoryInfo(MemoryInfo* info, const char* file, int line,
                           size_t n) {
     info->next = nullptr;
     info->previous = nullptr;
     info->size = n;
     info->line = line;
-    strncpy(info->buffer, coreGetShortFileName(file), sizeof(info->buffer));
+    strncpy(info->buffer, getShortFileName(file), sizeof(info->buffer));
     memcpy(info->canary, CANARY, sizeof(CANARY));
     memcpy((char*)info + n - sizeof(CANARY), CANARY, sizeof(CANARY));
     if(headMemoryInfo == nullptr) {
@@ -145,7 +145,7 @@ static void addMemoryInfo(CoreMemoryInfo* info, const char* file, int line,
     }
 }
 
-static void removeMemoryInfo(CoreMemoryInfo* info) {
+static void removeMemoryInfo(MemoryInfo* info) {
     if(info->previous == nullptr) {
         if(info->next == nullptr) {
             headMemoryInfo = nullptr;
@@ -164,27 +164,27 @@ static void removeMemoryInfo(CoreMemoryInfo* info) {
 }
 
 void* coreDebugAllocate(const char* file, int line, size_t n) {
-    n += sizeof(CoreMemoryInfo) + sizeof(CANARY);
-    void* p = coreRealAllocate(n + sizeof(CANARY));
+    n += sizeof(MemoryInfo) + sizeof(CANARY);
+    void* p = RealAllocate(n + sizeof(CANARY));
     addMemoryInfo(p, file, line, n);
-    return (char*)p + sizeof(CoreMemoryInfo);
+    return (char*)p + sizeof(MemoryInfo);
 }
 
 void* coreDebugReallocate(const char* file, int line, void* p, size_t n) {
     if(n > 0) {
-        n += sizeof(CoreMemoryInfo) + sizeof(CANARY);
+        n += sizeof(MemoryInfo) + sizeof(CANARY);
     }
     void* rp = (void*)p;
     if(rp != nullptr) {
-        rp = (char*)rp - sizeof(CoreMemoryInfo);
+        rp = (char*)rp - sizeof(MemoryInfo);
         removeMemoryInfo(rp);
     }
-    void* np = coreRealReallocate(rp, n);
+    void* np = RealReallocate(rp, n);
     if(np == nullptr) {
         return nullptr;
     }
     addMemoryInfo(np, file, line, n);
-    return (char*)np + sizeof(CoreMemoryInfo);
+    return (char*)np + sizeof(MemoryInfo);
 }
 
 static bool checkCanary(void* p) {
@@ -195,51 +195,51 @@ void coreFreeDebug(const char* file, int line, void* p) {
     if(p == nullptr) {
         return;
     }
-    void* w = (char*)p - sizeof(CoreMemoryInfo);
-    CoreMemoryInfo* rp = w;
+    void* w = (char*)p - sizeof(MemoryInfo);
+    MemoryInfo* rp = w;
     if(checkCanary(rp->canary)) {
-        file = coreGetShortFileName(file);
+        file = getShortFileName(file);
         CORE_LOG_ERROR("Free at %s:%d violated pre canary", file, line);
         CORE_EXIT(1);
     } else if(checkCanary((char*)rp + rp->size - sizeof(CANARY))) {
-        file = coreGetShortFileName(file);
+        file = getShortFileName(file);
         CORE_LOG_ERROR("Free at %s:%d violated post canary", file, line);
         CORE_EXIT(1);
     }
     removeMemoryInfo(rp);
-    coreRealFree(rp);
+    RealFree(rp);
 }
 
-void corePrintMemoryReport() {
-    for(CoreMemoryInfo* i = headMemoryInfo; i != nullptr; i = i->next) {
+void printMemoryReport() {
+    for(MemoryInfo* i = headMemoryInfo; i != nullptr; i = i->next) {
         CORE_LOG_ERROR("%s:%d was not freed", i->buffer, i->line);
     }
 }
 
 #else
 
-void* coreAllocate(size_t n) {
-    return coreRealAllocate(n);
+void* Allocate(size_t n) {
+    return RealAllocate(n);
 }
 
-void* coreReallocate(void* p, size_t n) {
-    return coreRealReallocate(p, n);
+void* Reallocate(void* p, size_t n) {
+    return RealReallocate(p, n);
 }
 
-void coreFree(void* p) {
-    coreRealFree(p);
+void Free(void* p) {
+    RealFree(p);
 }
 
 #endif
 
-bool coreSleepNanos(i64 nanos) {
+bool sleepNanos(i64 nanos) {
     struct timespec t;
     t.tv_nsec = nanos % 1'000'000'000;
     t.tv_sec = nanos / 1'000'000'000;
     return thrd_sleep(&t, nullptr) != 0;
 }
 
-i64 coreNanos(void) {
+i64 getNanos(void) {
     struct timespec ts;
     if(timespec_get(&ts, TIME_UTC) == 0 || CORE_TIME_GET_FAIL) {
         return -1;

+ 4 - 4
test/modules/SpinLockTests.c

@@ -21,7 +21,7 @@ static int incrementMutexCounter(void* p) {
 }
 
 static void testMutex() {
-    i64 n = -coreNanos();
+    i64 n = -coreGetNanos();
 
     MutexCounter mc = {.counter = 0};
     mtx_init(&mc.m, mtx_plain);
@@ -32,7 +32,7 @@ static void testMutex() {
     thrd_join(t[1], nullptr);
     CORE_TEST_INT(20000, mc.counter);
 
-    n += coreNanos();
+    n += coreGetNanos();
     printf("%ldns Mutex\n", n);
 }
 
@@ -52,7 +52,7 @@ static int incrementSpinLockCounter(void* p) {
 }
 
 static void testSpinLock() {
-    i64 n = -coreNanos();
+    i64 n = -coreGetNanos();
 
     SpinLockCounter sc = {.counter = 0};
     coreInitSpinLock(&sc.s);
@@ -63,7 +63,7 @@ static void testSpinLock() {
     thrd_join(t[1], nullptr);
     CORE_TEST_INT(20000, sc.counter);
 
-    n += coreNanos();
+    n += coreGetNanos();
     printf("%ldns SpinLock\n", n);
 }
 

+ 47 - 47
test/modules/UtilityTests.c

@@ -5,68 +5,68 @@
 static const float eps = 0.0001f;
 
 static void testPopCount() {
-    CORE_TEST_U64(4, corePopCount(0xF));
-    CORE_TEST_U64(0, corePopCount(0x0));
-    CORE_TEST_U64(2, corePopCount(0x6));
-    CORE_TEST_U64(7, corePopCount(0x7F));
-    CORE_TEST_U64(3, corePopCount(0x2A));
-    CORE_TEST_U64(32, corePopCount(0xFFFFFFFF));
-    CORE_TEST_U64(64, corePopCount(0xFFFFFFFFFFFFFFFF));
-    CORE_TEST_U64(44, corePopCount(0xFFFF0FFFFFFF));
+    CORE_TEST_U64(4, popCount(0xF));
+    CORE_TEST_U64(0, popCount(0x0));
+    CORE_TEST_U64(2, popCount(0x6));
+    CORE_TEST_U64(7, popCount(0x7F));
+    CORE_TEST_U64(3, popCount(0x2A));
+    CORE_TEST_U64(32, popCount(0xFFFFFFFF));
+    CORE_TEST_U64(64, popCount(0xFFFFFFFFFFFFFFFF));
+    CORE_TEST_U64(44, popCount(0xFFFF0FFFFFFF));
 }
 
 static void testZeroRellocate() {
-    void* buffer = coreReallocate(nullptr, 16);
+    void* buffer = cReallocate(nullptr, 16);
     CORE_TEST_NOT_NULL(buffer);
-    buffer = coreReallocate(buffer, 0);
+    buffer = cReallocate(buffer, 0);
     CORE_TEST_NULL(buffer);
 }
 
 static void testMemoryInfoList() {
-    void* a = coreAllocate(8);
-    void* b = coreAllocate(8);
-    void* c = coreAllocate(8);
-    void* d = coreAllocate(8);
-    coreFree(b); // remove middle element
-    coreFree(a); // remove first
-    coreFree(d); // remove last
-    coreFree(c); // remove single
-    coreFree(nullptr);
+    void* a = cAllocate(8);
+    void* b = cAllocate(8);
+    void* c = cAllocate(8);
+    void* d = cAllocate(8);
+    cFree(b); // remove middle element
+    cFree(a); // remove first
+    cFree(d); // remove last
+    cFree(c); // remove single
+    cFree(nullptr);
 }
 
 static void testInterpolate() {
-    CORE_TEST_FLOAT(7.5f, coreInterpolate(5.0f, 10.0f, 0.5f), eps);
-    CORE_TEST_FLOAT(-2.0, coreInterpolate(-10.0f, 10.0f, 0.4f), eps);
-    CORE_TEST_FLOAT(10.0f, coreInterpolate(-3.0f, 10.0f, 1.0f), eps);
-    CORE_TEST_FLOAT(7.0f, coreInterpolate(7.0f, 10.0f, 0.0f), eps);
-    CORE_TEST_FLOAT(6.0f, coreInterpolate(0.0f, 10.0f, 0.6f), eps);
+    CORE_TEST_FLOAT(7.5f, interpolate(5.0f, 10.0f, 0.5f), eps);
+    CORE_TEST_FLOAT(-2.0, interpolate(-10.0f, 10.0f, 0.4f), eps);
+    CORE_TEST_FLOAT(10.0f, interpolate(-3.0f, 10.0f, 1.0f), eps);
+    CORE_TEST_FLOAT(7.0f, interpolate(7.0f, 10.0f, 0.0f), eps);
+    CORE_TEST_FLOAT(6.0f, interpolate(0.0f, 10.0f, 0.6f), eps);
 }
 
 static void testRadianToDegree() {
-    CORE_TEST_FLOAT(45.0f, coreRadianToDegree(CORE_PI * 0.25f), eps);
-    CORE_TEST_FLOAT(90.0f, coreRadianToDegree(CORE_PI * 0.5f), eps);
-    CORE_TEST_FLOAT(180.0f, coreRadianToDegree(CORE_PI), eps);
-    CORE_TEST_FLOAT(360.0f, coreRadianToDegree(CORE_PI * 2.0f), eps);
+    CORE_TEST_FLOAT(45.0f, radianToDegree(CORE_PI * 0.25f), eps);
+    CORE_TEST_FLOAT(90.0f, radianToDegree(CORE_PI * 0.5f), eps);
+    CORE_TEST_FLOAT(180.0f, radianToDegree(CORE_PI), eps);
+    CORE_TEST_FLOAT(360.0f, radianToDegree(CORE_PI * 2.0f), eps);
 }
 
 static void testDegreeToRadian() {
-    CORE_TEST_FLOAT(CORE_PI * 0.25f, coreDegreeToRadian(45.0f), eps);
-    CORE_TEST_FLOAT(CORE_PI * 0.5f, coreDegreeToRadian(90.0f), eps);
-    CORE_TEST_FLOAT(CORE_PI, coreDegreeToRadian(180.0f), eps);
-    CORE_TEST_FLOAT(CORE_PI * 2.0f, coreDegreeToRadian(360.0f), eps);
+    CORE_TEST_FLOAT(CORE_PI * 0.25f, degreeToRadian(45.0f), eps);
+    CORE_TEST_FLOAT(CORE_PI * 0.5f, degreeToRadian(90.0f), eps);
+    CORE_TEST_FLOAT(CORE_PI, degreeToRadian(180.0f), eps);
+    CORE_TEST_FLOAT(CORE_PI * 2.0f, degreeToRadian(360.0f), eps);
 }
 
 static void testSleep(i64 nanos) {
-    i64 time = -coreNanos();
-    CORE_TEST_FALSE(coreSleepNanos(nanos));
-    time += coreNanos();
+    i64 time = -getNanos();
+    CORE_TEST_FALSE(sleepNanos(nanos));
+    time += getNanos();
     CORE_TEST_TRUE(time >= nanos && time <= (nanos * 13) / 10);
 }
 
 static void testFail() {
 #ifdef ERROR_SIMULATOR
     coreFailTimeGet = true;
-    CORE_TEST_I64(-1, coreNanos());
+    CORE_TEST_I64(-1, getNanos());
     coreFailTimeGet = false;
 #endif
 }
@@ -84,22 +84,22 @@ void coreTestUtility(bool light) {
 }
 
 static void outOfMemory(void*) {
-    coreSetOutOfMemoryHandler(nullptr, nullptr);
+    setOutOfMemoryHandler(nullptr, nullptr);
 }
 
 void coreTestInvalidAllocate(void) {
-    coreSetOutOfMemoryHandler(outOfMemory, nullptr);
-    coreAllocate(0xFFFFFFFFFFF);
+    setOutOfMemoryHandler(outOfMemory, nullptr);
+    cAllocate(0xFFFFFFFFFFF);
     CORE_TEST_TRUE(false);
     coreFinalizeTests();
     CORE_EXIT(0);
 }
 
 void coreTestInvalidReallocate(void) {
-    coreSetOutOfMemoryHandler(outOfMemory, nullptr);
-    void* p = coreAllocate(0xFF);
-    corePrintMemoryReport();
-    coreReallocate(p, 0xFFFFFFFFFFF);
+    setOutOfMemoryHandler(outOfMemory, nullptr);
+    void* p = cAllocate(0xFF);
+    printMemoryReport();
+    cReallocate(p, 0xFFFFFFFFFFF);
     CORE_TEST_TRUE(false);
     coreFinalizeTests();
     CORE_EXIT(0);
@@ -107,9 +107,9 @@ void coreTestInvalidReallocate(void) {
 
 [[noreturn]] void coreTestPreCanary(void) {
 #ifdef CORE_CHECK_MEMORY
-    char* p = coreAllocate(16);
+    char* p = cAllocate(16);
     p[-1] = 0;
-    coreFree(p);
+    cFree(p);
     CORE_TEST_TRUE(false);
 #endif
     coreFinalizeTests();
@@ -118,9 +118,9 @@ void coreTestInvalidReallocate(void) {
 
 [[noreturn]] void coreTestPostCanary(void) {
 #ifdef CORE_CHECK_MEMORY
-    char* p = coreAllocate(16);
+    char* p = cAllocate(16);
     p[17] = 0;
-    coreFree(p);
+    cFree(p);
     CORE_TEST_TRUE(false);
 #endif
     coreFinalizeTests();