Properly mark condition for entering memory failure.

This commit is contained in:
Patrick Pelissier committed 2023-04-07 23:50:03 +02:00
1 parent 4f608ec266
commit fc34fa80b5
2 files changed
+6 -6

No files matched your search

+2 -2
View File
@@ -114,7 +114,7 @@
{ \
mem->free_list = NULL; \
mem->current_segment = M_MEMORY_ALLOC(M_C(name,_segment_ct)); \
if (mem->current_segment == NULL) { \
if (M_UNLIKELY_NOMEM(mem->current_segment == NULL)) { \
M_MEMORY_FULL(sizeof (M_C(name,_segment_ct))); \
return; \
} \
@@ -156,7 +156,7 @@
/* If segment is full, allocate a new one from the system */ \
if (M_UNLIKELY (count >= M_USE_MEMPOOL_MAX_PER_SEGMENT(type))) { \
M_C(name,_segment_ct) *new_segment = M_MEMORY_ALLOC (M_C(name,_segment_ct)); \
if (M_UNLIKELY (new_segment == NULL)) { \
if (M_UNLIKELY_NOMEM (new_segment == NULL)) { \
M_MEMORY_FULL(sizeof (M_C(name,_segment_ct))); \
return NULL; \
} \
+4 -4
View File
@@ -320,7 +320,7 @@ typedef enum {
/* If there is no root node, create a new node */ \
if (n == NULL) { \
n = M_C3(m_rbtr33_,name,_new)(); \
if (M_UNLIKELY (n == NULL)) { \
if (M_UNLIKELY_NOMEM (n == NULL)) { \
M_MEMORY_FULL(sizeof (node_t)); \
return; \
} \
@@ -361,7 +361,7 @@ typedef enum {
} \
/* Create new node to store the data */ \
n = M_C3(m_rbtr33_,name,_new)(); \
if (M_UNLIKELY (n == NULL) ) { \
if (M_UNLIKELY_NOMEM (n == NULL) ) { \
M_MEMORY_FULL (sizeof (node_t)); \
return; \
} \
@@ -692,7 +692,7 @@ typedef enum {
{ \
if (o == NULL) return NULL; \
node_t *n = M_C3(m_rbtr33_,name,_new)(); \
if (M_UNLIKELY (n == NULL) ) { \
if (M_UNLIKELY_NOMEM (n == NULL) ) { \
M_MEMORY_FULL (sizeof (node_t)); \
return NULL; \
} \
@@ -795,7 +795,7 @@ typedef enum {
\
M_IF_DEBUG( \
/* Compute the depth of a node */ \
static size_t \
static inline size_t \
M_C3(m_rbtr33_,name,_compute_depth)(const node_t *n) \
{ \
if (n == NULL) return 1; \