about summary refs log tree commit diff stats
path: root/src/custommem.c
diff options
context:
space:
mode:
authorJim Huang <jserv.tw@gmail.com>2024-11-07 04:56:34 +0800
committerGitHub <noreply@github.com>2024-11-06 21:56:34 +0100
commit394e81af452f64439fb8d8ab7254ce19f71d4390 (patch)
treefd5968a4ee6c3887ba74aaa631d7f75a48ce9e25 /src/custommem.c
parent6af8d70cc1620bf8e7927ade2e42e4cea41384be (diff)
downloadbox64-394e81af452f64439fb8d8ab7254ce19f71d4390.tar.gz
box64-394e81af452f64439fb8d8ab7254ce19f71d4390.zip
[RBTREE] Unify naming and prevent unintended symbol exposure (#2005)
Red-black tree operations now consistently use the 'rbtree_' prefix, and
internal functions remain unexposed. Tested on RV64GC, resulting in a
498-byte reduction in the .text section size.
Diffstat (limited to 'src/custommem.c')
-rw-r--r--src/custommem.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/custommem.c b/src/custommem.c
index be9f39ed..3f067148 100644
--- a/src/custommem.c
+++ b/src/custommem.c
@@ -60,13 +60,13 @@ static pthread_mutex_t     mutex_prot;
 static pthread_mutex_t     mutex_blocks;
 #endif
 //#define TRACE_MEMSTAT
-rbtree* memprot = NULL;
+rbtree_t* memprot = NULL;
 int have48bits = 0;
 static int inited = 0;
 
-rbtree*  mapallmem = NULL;
-static rbtree*  mmapmem = NULL;
-static rbtree*  blockstree = NULL;
+rbtree_t*  mapallmem = NULL;
+static rbtree_t*  mmapmem = NULL;
+static rbtree_t*  blockstree = NULL;
 
 typedef struct blocklist_s {
     void*               block;
@@ -1937,12 +1937,12 @@ void init_custommem_helper(box64context_t* ctx)
     if(inited) // already initialized
         return;
     inited = 1;
-    blockstree = init_rbtree("blockstree");
+    blockstree = rbtree_init("blockstree");
     // if there is some blocks already
     if(n_blocks)
         for(int i=0; i<n_blocks; ++i)
             rb_set(blockstree, (uintptr_t)p_blocks[i].block, (uintptr_t)p_blocks[i].block+p_blocks[i].size, i);
-    memprot = init_rbtree("memprot");
+    memprot = rbtree_init("memprot");
     sigfillset(&critical_prot);
     init_mutexes();
 #ifdef DYNAREC
@@ -1967,9 +1967,9 @@ void init_custommem_helper(box64context_t* ctx)
 #endif
     pthread_atfork(NULL, NULL, atfork_child_custommem);
     // init mapallmem list
-    mapallmem = init_rbtree("mapallmem");
+    mapallmem = rbtree_init("mapallmem");
     // init mmapmem list
-    mmapmem = init_rbtree("mapmem");
+    mmapmem = rbtree_init("mapmem");
     // Load current MMap
     loadProtectionFromMap();
     reserveHighMem();
@@ -2056,13 +2056,13 @@ void fini_custommem_helper(box64context_t *ctx)
     kh_destroy(lockaddress, lockaddress);
     lockaddress = NULL;
 #endif
-    delete_rbtree(memprot);
+    rbtree_delete(memprot);
     memprot = NULL;
-    delete_rbtree(mmapmem);
+    rbtree_delete(mmapmem);
     mmapmem = NULL;
-    delete_rbtree(mapallmem);
+    rbtree_delete(mapallmem);
     mapallmem = NULL;
-    delete_rbtree(blockstree);
+    rbtree_delete(blockstree);
     blockstree = NULL;
 
     for(int i=0; i<n_blocks; ++i)