16
16
#include "../src/utils/utils_common.h"
17
17
#include "../src/utils/utils_concurrency.h"
18
18
#include "assert.h"
19
+ #include "base_alloc_global.h"
19
20
20
21
#include <errno.h>
21
22
#include <stdint.h>
@@ -51,7 +52,7 @@ struct ravl {
51
52
* ravl_new -- creates a new ravl tree instance
52
53
*/
53
54
struct ravl * ravl_new_sized (ravl_compare * compare , size_t data_size ) {
54
- struct ravl * r = malloc (sizeof (* r ));
55
+ struct ravl * r = umf_ba_global_alloc (sizeof (* r ));
55
56
if (r == NULL ) {
56
57
return NULL ;
57
58
}
@@ -87,7 +88,7 @@ static void ravl_foreach_node(struct ravl_node *n, ravl_cb cb, void *arg,
87
88
ravl_foreach_node (n -> slots [RAVL_RIGHT ], cb , arg , free_node );
88
89
89
90
if (free_node ) {
90
- free (n );
91
+ umf_ba_global_free (n );
91
92
}
92
93
}
93
94
@@ -104,7 +105,7 @@ void ravl_clear(struct ravl *ravl) {
104
105
*/
105
106
void ravl_delete_cb (struct ravl * ravl , ravl_cb cb , void * arg ) {
106
107
ravl_foreach_node (ravl -> root , cb , arg , 1 );
107
- free (ravl );
108
+ umf_ba_global_free (ravl );
108
109
}
109
110
110
111
/*
@@ -149,7 +150,7 @@ static void ravl_node_copy_constructor(void *data, size_t data_size,
149
150
*/
150
151
static struct ravl_node * ravl_new_node (struct ravl * ravl , ravl_constr constr ,
151
152
const void * arg ) {
152
- struct ravl_node * n = malloc (sizeof (* n ) + ravl -> data_size );
153
+ struct ravl_node * n = umf_ba_global_alloc (sizeof (* n ) + ravl -> data_size );
153
154
if (n == NULL ) {
154
155
return NULL ;
155
156
}
@@ -383,7 +384,7 @@ int ravl_emplace(struct ravl *ravl, ravl_constr constr, const void *arg) {
383
384
384
385
error_duplicate :
385
386
errno = EEXIST ;
386
- free (n );
387
+ umf_ba_global_free (n );
387
388
return -1 ;
388
389
}
389
390
@@ -516,7 +517,7 @@ void ravl_remove(struct ravl *ravl, struct ravl_node *n) {
516
517
}
517
518
518
519
* ravl_node_ref (ravl , n ) = r ;
519
- free (n );
520
+ umf_ba_global_free (n );
520
521
}
521
522
}
522
523
0 commit comments