Port to new spec M_MEMORY_FULL

This commit is contained in:
Patrick Pelissier committed 2025-05-07 21:02:23 +02:00
1 parent 450d2c9000
commit 1e196fe22a
21 files changed
+88 -87

No files matched your search

+5 -5
View File
@@ -260,7 +260,7 @@ typedef int32_t m_tr33_index_t;
} \
/* Realloc the array */ \
if (M_UNLIKELY_NOMEM (alloc >= INT32_MAX)) { \
M_MEMORY_FULL(sizeof (struct M_F(name, _node_s)) * alloc); \
M_MEMORY_FULL(struct M_F(name, _node_s), alloc); \
return; \
} \
/* Allocate one more term in the array so that tab[-1] exists. \
@@ -270,7 +270,7 @@ typedef int32_t m_tr33_index_t;
struct M_F(name,_node_s)*ptr = tree->tab == NULL ? NULL : tree->tab-1;\
ptr = M_CALL_REALLOC(oplist, struct M_F(name, _node_s), ptr, tree->capacity+1, alloc+1); \
if (M_UNLIKELY_NOMEM (ptr == NULL) ) { \
M_MEMORY_FULL(sizeof (struct M_F(name, _node_s)) * alloc); \
M_MEMORY_FULL(struct M_F(name, _node_s), alloc); \
return; \
} \
/* Skip the first term to keep it as empty & unused */ \
@@ -314,7 +314,7 @@ typedef int32_t m_tr33_index_t;
/* Take into account if realloc is allowed */ \
alloc += tree->allow_realloc; \
if (M_UNLIKELY_NOMEM (alloc >= INT32_MAX)) { \
M_MEMORY_FULL(sizeof (struct M_F(name, _node_s)) * alloc); \
M_MEMORY_FULL(struct M_F(name, _node_s), alloc); \
return M_TR33_NO_NODE; \
} \
/* Allocate one more term in the array so that tab[-1] exists. \
@@ -324,7 +324,7 @@ typedef int32_t m_tr33_index_t;
struct M_F(name,_node_s)*ptr = tree->tab == NULL ? NULL : tree->tab-1; \
ptr = M_CALL_REALLOC(oplist, struct M_F(name, _node_s), ptr, tree->capacity+1, alloc+1); \
if (M_UNLIKELY_NOMEM (ptr == NULL) ) { \
M_MEMORY_FULL(sizeof (struct M_F(name, _node_s)) * alloc); \
M_MEMORY_FULL(struct M_F(name, _node_s), alloc); \
return M_TR33_NO_NODE; \
} \
/* Skip the first term to keep it as empty & unused */ \
@@ -1136,7 +1136,7 @@ typedef int32_t m_tr33_index_t;
struct M_F(name, _node_s) *ptr = \
M_CALL_REALLOC(oplist, struct M_F(name, _node_s), NULL, 0, alloc+1); \
if (M_UNLIKELY_NOMEM (ptr == NULL) ) { \
M_MEMORY_FULL(sizeof(struct M_F(name, _node_s)) * alloc); \
M_MEMORY_FULL(struct M_F(name, _node_s), alloc); \
return; \
} \
tree->tab = ++ptr; \