src/server/daemon/acldata.c

changeset 385
a1f4cb076d2f
parent 255
b5d15a4a19f5
child 415
d938228c382e
--- a/src/server/daemon/acldata.c	Tue Aug 13 22:14:32 2019 +0200
+++ b/src/server/daemon/acldata.c	Sat Sep 24 16:26:10 2022 +0200
@@ -32,39 +32,20 @@
 
 #include "acldata.h"
 
-ACLData* acl_data_new() {
-    ACLData *dat = malloc(sizeof(ACLData));
-    dat->ref = 1;
+ACLData* acl_data_new(UcxAllocator *a) {
+    ACLData *dat = almalloc(a, sizeof(ACLData));
+    if(!dat) {
+        return NULL;
+    }
     
-    dat->namedACLs = ucx_map_new(16);
+    dat->namedACLs = ucx_map_new_a(a, 16);
+    if(!dat->namedACLs) {
+        return NULL;
+    }
     
     return dat;
 }
 
-void acl_data_ref(ACLData *acldata) {
-    if(acldata) {
-        ws_atomic_inc32(&acldata->ref);
-    }
-}
-
-void acl_data_unref(ACLData *acldata) {
-    uint32_t ref = ws_atomic_dec32(&acldata->ref);
-    if(ref == 0) {
-        UcxMapIterator i = ucx_map_iterator(acldata->namedACLs);
-        WSAcl *acl;
-        UCX_MAP_FOREACH(key, acl, i) {
-            free(acl->ace);
-            free(acl->ece);
-            if(acl->acl.authprompt) {
-                free(acl->acl.authprompt);
-            }
-            free(acl);
-        }
-        ucx_map_free(acldata->namedACLs);
-        free(acldata);
-    }
-}
-
 ACLList* acl_get(ACLData *acldata, char *name) {
     ACLList *acl = ucx_map_cstr_get(acldata->namedACLs, name);
     return acl;

mercurial