Browse Source

Remove leftovers of not imported access

Kajetan Johannes Hammerle 11 tháng trước cách đây
mục cha
commit
20f5ec4231

+ 1 - 0
include/core/Logger.h

@@ -62,6 +62,7 @@ check_format(6, 7) void coreLog(CoreLogLevel l, const char* file, int line,
 #define TERMINAL_GRAY CORE_TERMINAL_GRAY
 #define TERMINAL_GREEN CORE_TERMINAL_GREEN
 #define TERMINAL_RESET CORE_TERMINAL_RESET
+#define LogLevel CoreLogLevel
 #define LOG_ERROR CORE_LOG_ERROR
 #define LOG_WARNING CORE_LOG_WARNING
 #define LOG_INFO CORE_LOG_INFO

+ 8 - 8
src/BitArray.c

@@ -45,16 +45,16 @@ static size_t getArrayLength(size_t length, size_t bits) {
     return roundUpDivide(length * bits, U64_BITS);
 }
 
-void initBitArray(CoreBitArray* a, size_t length, size_t bits) {
-    *a = (CoreBitArray){0};
+void initBitArray(BitArray* a, size_t length, size_t bits) {
+    *a = (BitArray){0};
     if(length > 0 && bits > 0) {
         setBitLength(a, length, bits);
     }
 }
 
 void destroyBitArray(BitArray* a) {
-    coreFree(a->data);
-    *a = (CoreBitArray){0};
+    cFree(a->data);
+    *a = (BitArray){0};
 }
 
 void setBits(BitArray* a, size_t index, u64 value) {
@@ -83,7 +83,7 @@ i64 selectBits(const BitArray* a, size_t index) {
     u64 found = 0;
     size_t end = getArrayLength(a->length, a->bits);
     for(size_t i = 0; i < end; i++) {
-        u64 ones = corePopCount(a->data[i]);
+        u64 ones = popCount(a->data[i]);
         found += ones;
         if(found >= index) {
             found -= ones;
@@ -108,17 +108,17 @@ void setBitLength(BitArray* a, size_t newLength, size_t newBits) {
         newBits = 64;
     }
     size_t arrayLength = getArrayLength(newLength, newBits);
-    u64* newData = coreAllocate(sizeof(u64) * arrayLength);
+    u64* newData = cAllocate(sizeof(u64) * arrayLength);
     memset(newData, 0, arrayLength * sizeof(u64));
 
-    size_t end = coreMinSize(a->length, newLength);
+    size_t end = minSize(a->length, newLength);
     for(size_t i = 0; i < end; i++) {
         writeBits(newData, i, newBits, getBits(a, i));
     }
     for(size_t i = end; i < newLength; i++) {
         writeBits(newData, i, newBits, 0);
     }
-    coreFree(a->data);
+    cFree(a->data);
     a->data = newData;
     a->length = newLength & 0xFFFFFFFFFFFFFF;
     a->bits = newBits & 0xFF;

+ 2 - 2
src/Buffer.c

@@ -11,8 +11,8 @@ void initBuffer(Buffer* b) {
 }
 
 void destroyBuffer(Buffer* b) {
-    coreFree(b->buffer);
-    coreInitBuffer(b);
+    cFree(b->buffer);
+    initBuffer(b);
 }
 
 void addSizedBufferData(Buffer* b, const void* data, size_t size) {

+ 6 - 6
src/Logger.c

@@ -3,9 +3,9 @@
 #include <stdarg.h>
 #include <stdio.h>
 
-CoreLogLevel coreLogLevel = CORE_LOG_DEBUG;
+LogLevel logLevel = LOG_DEBUG;
 
-const char* coreGetShortFileName(const char* s) {
+const char* getShortFileName(const char* s) {
     const char* r = s;
     while(*s != '\0') {
         if(*(s++) == '/') {
@@ -15,12 +15,12 @@ const char* coreGetShortFileName(const char* s) {
     return r;
 }
 
-void coreLog(CoreLogLevel l, const char* file, int line, const char* prefix,
+void coreLog(LogLevel l, const char* file, int line, const char* prefix,
              const char* tag, const char* format, ...) {
-    if(coreLogLevel < l) {
+    if(logLevel < l) {
         return;
     }
-    file = coreGetShortFileName(file);
+    file = getShortFileName(file);
     fputs(prefix, stdout);
     fputs(tag, stdout);
     printf("%s:%d | ", file, line);
@@ -30,5 +30,5 @@ void coreLog(CoreLogLevel l, const char* file, int line, const char* prefix,
     vprintf(format, args);
     va_end(args);
 
-    puts(CORE_TERMINAL_RESET);
+    puts(TERMINAL_RESET);
 }

+ 8 - 8
src/Utility.c

@@ -28,7 +28,7 @@ size_t popCount(u64 u) {
 [[noreturn]] void coreExitWithHandler(const char* file, int line, int value) {
     if(value != 0) {
         file = getShortFileName(file);
-        CORE_LOG_ERROR("Exit from %s:%d with value %d", file, line, value);
+        LOG_ERROR("Exit from %s:%d with value %d", file, line, value);
     }
     if(exitHandler != nullptr) {
         exitHandler(value, exitData);
@@ -48,8 +48,8 @@ void setOutOfMemoryHandler(OutOfMemoryHandler h, void* data) {
 
 static void* exitOnNull(void* p, size_t n) {
     if(p == nullptr) {
-        CORE_LOG_ERROR("Out of memory, requested '%zu' bytes", n);
-        CORE_EXIT(1);
+        LOG_ERROR("Out of memory, requested '%zu' bytes", n);
+        EXIT(1);
     }
     return p;
 }
@@ -171,12 +171,12 @@ void coreFreeDebug(const char* file, int line, void* p) {
     MemoryInfo* rp = w;
     if(checkCanary(rp->canary)) {
         file = getShortFileName(file);
-        CORE_LOG_ERROR("Free at %s:%d violated pre canary", file, line);
-        CORE_EXIT(1);
+        LOG_ERROR("Free at %s:%d violated pre canary", file, line);
+        EXIT(1);
     } else if(checkCanary((char*)rp + rp->size - sizeof(CANARY))) {
         file = getShortFileName(file);
-        CORE_LOG_ERROR("Free at %s:%d violated post canary", file, line);
-        CORE_EXIT(1);
+        LOG_ERROR("Free at %s:%d violated post canary", file, line);
+        EXIT(1);
     }
     removeMemoryInfo(rp);
     RealFree(rp);
@@ -184,7 +184,7 @@ void coreFreeDebug(const char* file, int line, void* p) {
 
 void printMemoryReport() {
     for(MemoryInfo* i = headMemoryInfo; i != nullptr; i = i->next) {
-        CORE_LOG_ERROR("%s:%d was not freed", i->buffer, i->line);
+        LOG_ERROR("%s:%d was not freed", i->buffer, i->line);
     }
 }
 

+ 8 - 8
test/Main.c

@@ -9,9 +9,9 @@
 
 static void onExit(int code, void* data) {
     unsigned int i = *(unsigned int*)(data);
-    CORE_LOG_WARNING("Hello from exit %d: %u", code, i);
-    coreFinalizeTests();
-    corePrintMemoryReport();
+    LOG_WARNING("Hello from exit %d: %u", code, i);
+    finalizeTests();
+    printMemoryReport();
 }
 
 int main(int argAmount, const char** args) {
@@ -54,12 +54,12 @@ int main(int argAmount, const char** args) {
     testVector();
     testView();
 
-    coreLogLevel = CORE_LOG_WARNING;
-    CORE_LOG_DEBUG("You won't see this!");
-    coreLogLevel = CORE_LOG_DEBUG;
+    logLevel = LOG_WARNING;
+    LOG_DEBUG("You won't see this!");
+    logLevel = LOG_DEBUG;
 
     unsigned int data = 123456789;
-    coreSetExitHandler(onExit, &data);
+    setExitHandler(onExit, &data);
 
-    CORE_EXIT(1);
+    EXIT(1);
 }

+ 7 - 7
test/modules/BoxTests.c

@@ -3,7 +3,7 @@
 #include "core/ToString.h"
 
 static void testInit() {
-    CoreBox box = BOX;
+    Box box = BOX;
     setBox(&box, &V(1.0f, 2.0f, 3.0f));
     char buffer[128];
     toString(&box, buffer, sizeof(buffer));
@@ -14,7 +14,7 @@ static void testInit() {
 }
 
 static void testOffset() {
-    CoreBox box = BOX;
+    Box box = BOX;
     setBox(&box, &V(1.0f, 2.0f, 3.0f));
     offsetBox(&box, &V(7.0f, -4.0f, 6.0f));
     char buffer[128];
@@ -23,11 +23,11 @@ static void testOffset() {
 }
 
 static void testCollidesWith() {
-    CoreBox boxA = BOX;
+    Box boxA = BOX;
     setBox(&boxA, &V(1.0f, 2.0f, 3.0f));
-    CoreBox boxB = BOX;
+    Box boxB = BOX;
     setBox(&boxB, &V(-1.0f, -2.0f, -3.0f));
-    CoreBox boxC = BOX;
+    Box boxC = BOX;
     setBox(&boxC, &V(2.0f, 2.0f, 2.0f));
     offsetBox(&boxC, &V(-1.0f, -1.0f, -1.0f));
 
@@ -40,7 +40,7 @@ static void testCollidesWith() {
 }
 
 static void testExpand() {
-    CoreBox box = BOX;
+    Box box = BOX;
     setBox(&box, &V(1.0f, 2.0f, 3.0f));
     expandBox(&box, &V(7.0f, -4.0f, 6.0f));
 
@@ -55,7 +55,7 @@ static void testExpand() {
 }
 
 static void testGrow() {
-    CoreBox box = BOX;
+    Box box = BOX;
     setBox(&box, &V(1.0f, 2.0f, 3.0f));
     growBox(&box, &V(4.0f, 2.0f, 6.0f));
     char buffer[128];

+ 2 - 4
test/modules/HashMapTests.c

@@ -152,8 +152,7 @@ static void testInvalidPut() {
     HashMap map = createIntMap();
 
     char buffer[128];
-    coreToStringHashMap(&map, buffer, sizeof(buffer), coreToStringInt,
-                        coreToStringInt);
+    toString(&map, buffer, sizeof(buffer), toStringInt, toStringInt);
     TEST_STRING("[]", buffer);
 
     putTypedHashMapPair(&map, int, 0, int, 3);
@@ -161,8 +160,7 @@ static void testInvalidPut() {
     if(TEST_NOT_NULL(v)) {
         TEST_INT(3, *v);
     }
-    coreToStringHashMap(&map, buffer, sizeof(buffer), coreToStringInt,
-                        coreToStringInt);
+    toString(&map, buffer, sizeof(buffer), toStringInt, toStringInt);
     TEST_STRING("[0 = 3]", buffer);
 
     clearHashMap(&map);

+ 2 - 8
test/modules/TestTests.c

@@ -13,13 +13,7 @@ void testTest() {
     TEST_NULL(&(int){0});
     TEST_NOT_NULL(nullptr);
     TEST_FLOAT(0.0f, 1.0f, 0.1f);
-
-    CoreVector2 a = {{0, 1}};
-    CoreVector2 b = {{2, 3}};
-    TEST_V2(&a, &b);
-
-    CoreIntVector2 ia = {{0, 1}};
-    CoreIntVector2 ib = {{2, 3}};
-    TEST_IV2(&ia, &ib);
+    TEST_V2(&V(0, 1), &V(2, 3));
+    TEST_IV2(&IV(0, 1), &IV(2, 3));
     finalizeTests();
 }

+ 1 - 1
test/modules/UtilityTests.c

@@ -71,7 +71,7 @@ typedef struct {
 static void testSwap() {
     SwapTest a = {3, 20};
     SwapTest b = {7, 30};
-    coreSwap(&a, &b);
+    swap(&a, &b);
     TEST_INT(7, a.i);
     TEST_INT(3, b.i);
     TEST_I64(30, a.d);