Fixing compile issues
This commit is contained in:
4
core.h
4
core.h
@@ -15,14 +15,14 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include "defer.hpp"
|
#include "defer.hpp"
|
||||||
#define TABLE_ASSERT IO_Assert
|
#define TABLE_ASSERT IO_Assert
|
||||||
#define TABLE_ALLOCATOR_TYPE M_Allocator
|
#define TABLE_Allocator M_Allocator
|
||||||
#define TABLE_ALLOCATE(allocator, size) M_Alloc(allocator, size)
|
#define TABLE_ALLOCATE(allocator, size) M_Alloc(allocator, size)
|
||||||
#define TABLE_DEALLOCATE(allocator, p) M_Dealloc(allocator, p)
|
#define TABLE_DEALLOCATE(allocator, p) M_Dealloc(allocator, p)
|
||||||
#define TABLE_SET_DEFAULT_ALLOCATOR \
|
#define TABLE_SET_DEFAULT_ALLOCATOR \
|
||||||
if (!allocator.p) allocator = M_GetSystemAllocator();
|
if (!allocator.p) allocator = M_GetSystemAllocator();
|
||||||
#include "table.hpp"
|
#include "table.hpp"
|
||||||
#define ARRAY_ASSERT IO_Assert
|
#define ARRAY_ASSERT IO_Assert
|
||||||
#define ARRAY_ALLOCATOR_TYPE M_Allocator
|
#define ARRAY_Allocator M_Allocator
|
||||||
#define ARRAY_REALLOCATE(allocator, p, size, old_size) M_ReallocNonZeroed(allocator, p, size, old_size)
|
#define ARRAY_REALLOCATE(allocator, p, size, old_size) M_ReallocNonZeroed(allocator, p, size, old_size)
|
||||||
#define ARRAY_DEALLOCATE(allocator, p) M_Dealloc(allocator, p)
|
#define ARRAY_DEALLOCATE(allocator, p) M_Dealloc(allocator, p)
|
||||||
#define ARRAY_SET_DEFAULT_ALLOCATOR \
|
#define ARRAY_SET_DEFAULT_ALLOCATOR \
|
||||||
|
|||||||
11
table.hpp
11
table.hpp
@@ -11,9 +11,6 @@
|
|||||||
|
|
||||||
Hash 0 is reserved for empty hash table entry
|
Hash 0 is reserved for empty hash table entry
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define TABLE_ALLOCATOR_TYPE Allocator
|
|
||||||
|
|
||||||
#ifndef TABLE_PRIVATE_FUNCTION
|
#ifndef TABLE_PRIVATE_FUNCTION
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
#define TABLE_PRIVATE_FUNCTION __attribute__((unused)) static
|
#define TABLE_PRIVATE_FUNCTION __attribute__((unused)) static
|
||||||
@@ -22,6 +19,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TABLE_Allocator
|
||||||
|
#define TABLE_Allocator void *
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef TABLE_ALLOCATE
|
#ifndef TABLE_ALLOCATE
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#define TABLE_ALLOCATE(allocator, size) malloc(size)
|
#define TABLE_ALLOCATE(allocator, size) malloc(size)
|
||||||
@@ -74,9 +75,7 @@ struct Table {
|
|||||||
Value value;
|
Value value;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef TABLE_ALLOCATOR_TYPE
|
TABLE_Allocator allocator;
|
||||||
TABLE_ALLOCATOR_TYPE allocator;
|
|
||||||
#endif
|
|
||||||
size_t len, cap;
|
size_t len, cap;
|
||||||
Entry *values;
|
Entry *values;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user