Skip to content

Commit 51dc7a1

Browse files
committed
Use the UMF base allocator in UThash
1 parent d67bc85 commit 51dc7a1

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/uthash/uthash.h

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
Copyright (C) 2024 Intel Corporation
23
Copyright (c) 2003-2022, Troy D. Hanson https://troydhanson.github.io/uthash/
34
All rights reserved.
45
@@ -21,6 +22,12 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2122
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2223
*/
2324

25+
/*
26+
Modifications by Intel:
27+
- define uthash_malloc unconditional as a umf_ba_global_alloc
28+
- define uthash_free unconditional as a umf_ba_global_free
29+
*/
30+
2431
#ifndef UTHASH_H
2532
#define UTHASH_H
2633

@@ -30,6 +37,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3037
#include <stdlib.h> /* exit */
3138
#include <string.h> /* memcmp, memset, strlen */
3239

40+
#include "base_alloc_global.h"
41+
3342
#if defined(HASH_DEFINE_OWN_STDINT) && HASH_DEFINE_OWN_STDINT
3443
/* This codepath is provided for backward compatibility, but I plan to remove it. */
3544
#warning \
@@ -76,12 +85,9 @@ typedef unsigned char uint8_t;
7685
} while (0)
7786
#endif
7887

79-
#ifndef uthash_malloc
80-
#define uthash_malloc(sz) malloc(sz) /* malloc fcn */
81-
#endif
82-
#ifndef uthash_free
83-
#define uthash_free(ptr, sz) free(ptr) /* free fcn */
84-
#endif
88+
#define uthash_malloc(sz) umf_ba_global_alloc(sz) /* malloc fcn */
89+
#define uthash_free(ptr, sz) umf_ba_global_free(ptr) /* free fcn */
90+
8591
#ifndef uthash_bzero
8692
#define uthash_bzero(a, n) memset(a, '\0', n)
8793
#endif

0 commit comments

Comments
 (0)