dav/main.c

branch
dav-2
changeset 891
4d58cbcc9efa
parent 889
42cdbf9bbd49
--- a/dav/main.c	Sun Dec 07 20:16:59 2025 +0100
+++ b/dav/main.c	Fri Dec 19 17:53:18 2025 +0100
@@ -706,8 +706,8 @@
     }
     
     // get list of resources
-    CxList *reslist = cxLinkedListCreateSimple(CX_STORE_POINTERS);
-    cxDefineDestructor(reslist, free_getres);
+    CxList *reslist = cxLinkedListCreate(NULL, CX_STORE_POINTERS);
+    cxSetDestructor(reslist, free_getres);
     uint64_t totalsize = 0;
     uint64_t rescount = 0;
     
@@ -718,7 +718,7 @@
     char *structure = cmd_getoption(a, "structure");
     
     // iterate over resource tree
-    CxList *stack = cxLinkedListCreateSimple(CX_STORE_POINTERS);
+    CxList *stack = cxLinkedListCreate(NULL, CX_STORE_POINTERS);
     cxListInsert(stack, 0, getres);
     while(cxListSize(stack) > 0) {
         GetResource *g = cxListAt(stack, 0);
@@ -1721,7 +1721,7 @@
     
     //printf("header: %.*s\n", s*n, header);
     cxstring h = cx_strn(header, s*n);
-    if(cx_strprefix(h, CX_STR("Date:"))) {
+    if(cx_strprefix(h, cx_str("Date:"))) {
         cxstring v = cx_strsubs(h, 5);
         *date_str = cx_strdup(cx_strtrim(v)).ptr;
     }
@@ -1961,7 +1961,7 @@
     time_t timeout = 0;
     char *timeoutstr = cmd_getoption(a, "timeout");
     if(timeoutstr) {
-        if(!cx_strcasecmp(cx_str(timeoutstr), CX_STR("infinite"))) {
+        if(!cx_strcasecmp(cx_str(timeoutstr), cx_str("infinite"))) {
             timeout = -1;
         } else {
             uint64_t i;
@@ -1997,7 +1997,7 @@
 
 static char* read_line() {
     CxBuffer buf;
-    cxBufferInit(&buf, NULL, 128, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
+    cxBufferInit(&buf, cxDefaultAllocator, NULL, 128, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
     int c;
     while((c = getchar()) != EOF) {
         if(c == '\n') {
@@ -2345,7 +2345,7 @@
 
 char* stdin2str() {
     CxBuffer buf;
-    cxBufferInit(&buf, NULL, 1024, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
+    cxBufferInit(&buf, cxDefaultAllocator, NULL, 1024, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
     size_t size = cx_stream_copy(stdin, &buf, (cx_read_func)fread, (cx_write_func)cxBufferWrite);
     if(size == 0) {
         cxBufferDestroy(&buf);
@@ -2393,7 +2393,7 @@
 
 char* xml2str(DavXmlNode *node) {
     CxBuffer buf;
-    cxBufferInit(&buf, NULL, 256, cxDefaultAllocator, CX_BUFFER_AUTO_EXTEND);
+    cxBufferInit(&buf, cxDefaultAllocator, NULL, 256, CX_BUFFER_AUTO_EXTEND);
     xml2str_i(node, &buf, 0);
     cxBufferPut(&buf, 0);
     return buf.space;
@@ -2401,7 +2401,7 @@
 
 void printxmldoc(FILE *out, char *root, char *rootns, DavXmlNode *content) {
     CxMap *nsmap = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 16);
-    cxDefineDestructor(nsmap, free);
+    cxSetDestructor(nsmap, free);
     
     cxMapPut(nsmap, cx_hash_key_str(rootns), strdup("x0"));
     fprintf(out, "%s", "<?xml version=\"1.0\"?>\n");
@@ -2533,10 +2533,10 @@
         cxstring url = cx_strcast(repo->url.value);
         if(repo->user.value.ptr && !cmd_getoption(args, "plain")) {
             int hostindex = 0;
-            if(cx_strprefix(url, CX_STR("https://"))) {
+            if(cx_strprefix(url, cx_str("https://"))) {
                 printf("https://");
                 hostindex = 8;
-            } else if(cx_strprefix(url, CX_STR("http://"))) {
+            } else if(cx_strprefix(url, cx_str("http://"))) {
                 printf("http://");
                 hostindex = 7;
             }
@@ -2661,8 +2661,8 @@
     
     // optionally, get one or more locations
     char *location = NULL;
-    CxList *locations = cxLinkedListCreateSimple(CX_STORE_POINTERS);
-    cxDefineDestructor(locations, free);
+    CxList *locations = cxLinkedListCreate(NULL, CX_STORE_POINTERS);
+    cxSetDestructor(locations, free);
     while((location = assistant_getoptcfg("Location"))) {
         cxListAdd(locations, location);
     }
@@ -2968,13 +2968,13 @@
 
 static char** read_args_from_stdin(int *argc) {
     // read stdin into buffer
-    CxBuffer *in = cxBufferCreate(NULL, 1024, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
+    CxBuffer *in = cxBufferCreate(cxDefaultAllocator, NULL, 1024, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
     cx_stream_copy(stdin, in, (cx_read_func)fread, (cx_write_func)cxBufferWrite);
     
     // split input into lines
     size_t count = 0;
     cxmutstr *lines; 
-    count = cx_strsplit_ma(cxDefaultAllocator, cx_mutstrn(in->space, in->pos), CX_STR("\n"), INT_MAX, &lines);
+    count = cx_strsplit_ma(cxDefaultAllocator, cx_mutstrn(in->space, in->pos), cx_str("\n"), INT_MAX, &lines);
     
     char **args = NULL;
     if(count > 0) {
@@ -3172,7 +3172,7 @@
         char *lspath = NULL;
         if(path[plen-1] == '/') {
             lspath = strdup(path);
-            filter = CX_STR("");
+            filter = cx_str("");
         } else {
             lspath = util_parent_path(path);
             filter = cx_str(util_resource_name(path));
@@ -3191,7 +3191,7 @@
                     }
                 }
                 
-                CxBuffer *out = cxBufferCreate(NULL, 512, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
+                CxBuffer *out = cxBufferCreate(cxDefaultAllocator, NULL, 512, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
                 cxBufferWrite(repo->name.value.ptr, repo->name.value.length, 1, out);
                 if(space) {
                     size_t l = strlen(elm->path);

mercurial