libidav/davqlexec.c

branch
dav-2
changeset 891
4d58cbcc9efa
parent 886
da79af4baec8
--- a/libidav/davqlexec.c	Sun Dec 07 20:16:59 2025 +0100
+++ b/libidav/davqlexec.c	Fri Dec 19 17:53:18 2025 +0100
@@ -179,7 +179,7 @@
 
 cxmutstr dav_format_string(const CxAllocator *a, cxstring fstr, DavQLArgList *ap, davqlerror_t *error) {
     CxBuffer buf;
-    cxBufferInit(&buf, NULL, 128, a, CX_BUFFER_AUTO_EXTEND);
+    cxBufferInit(&buf, a, NULL, 128, CX_BUFFER_AUTO_EXTEND);
     
     int placeholder = 0;
     for(int i=0;i<fstr.length;i++) {
@@ -285,11 +285,11 @@
     
     CxIterator i = cxListIterator(fields);
     cx_foreach(DavQLField*, field, i) {
-        if(!cx_strcmp(field->name, CX_STR("*"))) {
+        if(!cx_strcmp(field->name, cx_str("*"))) {
             cxMapFree(properties);
             *isallprop = 1;
             return create_allprop_propfind_request();
-        } else if(!cx_strcmp(field->name, CX_STR("-"))) {
+        } else if(!cx_strcmp(field->name, cx_str("-"))) {
             cxMapFree(properties);
             return create_propfind_request(sn, NULL, "propfind", 0);
         } else {
@@ -302,7 +302,7 @@
     }
     
     CxMapIterator mi = cxMapIteratorValues(properties);
-    CxList *list = cxLinkedListCreateSimple(CX_STORE_POINTERS);
+    CxList *list = cxLinkedListCreate(NULL, CX_STORE_POINTERS);
     cx_foreach(DavProperty*, value, mi) {
         cxListAdd(list, value);
     }
@@ -483,11 +483,11 @@
     cxMempoolRegister(mp, rqbuf, (cx_destructor_func)cxBufferFree);
     
     // compile field list
-    CxList *cfieldlist = cxLinkedListCreate(mp->allocator, NULL, CX_STORE_POINTERS);
+    CxList *cfieldlist = cxLinkedListCreate(mp->allocator, CX_STORE_POINTERS);
     if(st->fields) {
         CxIterator i = cxListIterator(st->fields);
         cx_foreach(DavQLField*, field, i) {
-            if(cx_strcmp(field->name, CX_STR("*")) && cx_strcmp(field->name, CX_STR("-"))) {
+            if(cx_strcmp(field->name, cx_str("*")) && cx_strcmp(field->name, cx_str("-"))) {
                 // compile field expression
                 CxBuffer *code = dav_compile_expr(
                         sn->context,
@@ -543,7 +543,7 @@
     // compile order criterion
     CxList *ordercr = NULL;
     if(st->orderby) {
-        ordercr = cxLinkedListCreate(mp->allocator, NULL, sizeof(DavOrderCriterion));
+        ordercr = cxLinkedListCreate(mp->allocator, sizeof(DavOrderCriterion));
         CxIterator i = cxListIterator(st->orderby);
         cx_foreach(DavQLOrderCriterion*, oc, i) {
             DavQLExpression *column = oc->column;
@@ -601,7 +601,7 @@
     
     DavResource *selroot = dav_resource_new(sn, path.ptr);
     
-    CxList *stack = cxLinkedListCreateSimple(sizeof(DavQLRes));
+    CxList *stack = cxLinkedListCreate(NULL, sizeof(DavQLRes));
     // initialize the stack with the requested resource
     DavQLRes res;
     res.resource = selroot;
@@ -609,7 +609,7 @@
     cxListInsert(stack, 0, &res);
     
     // reuseable response buffer
-    CxBuffer *rpbuf = cxBufferCreate(NULL, 4096, mp->allocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
+    CxBuffer *rpbuf = cxBufferCreate(mp->allocator, NULL, 4096, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
     if(!rpbuf) {
         // TODO: cleanup
         cxMempoolFree(mp);
@@ -750,21 +750,21 @@
 }
 
 int dav_identifier2resprop(cxstring src, davqlresprop_t *prop) {
-    if(!cx_strcmp(src, CX_STR("name"))) {
+    if(!cx_strcmp(src, cx_str("name"))) {
         *prop = DAVQL_RES_NAME;
-    } else if(!cx_strcmp(src, CX_STR("path"))) {
+    } else if(!cx_strcmp(src, cx_str("path"))) {
         *prop = DAVQL_RES_PATH;
-    } else if(!cx_strcmp(src, CX_STR("href"))) {
+    } else if(!cx_strcmp(src, cx_str("href"))) {
         *prop = DAVQL_RES_HREF;
-    } else if(!cx_strcmp(src, CX_STR("contentlength"))) {
+    } else if(!cx_strcmp(src, cx_str("contentlength"))) {
         *prop = DAVQL_RES_CONTENTLENGTH;
-    } else if(!cx_strcmp(src, CX_STR("contenttype"))) {
+    } else if(!cx_strcmp(src, cx_str("contenttype"))) {
         *prop = DAVQL_RES_CONTENTTYPE;
-    } else if(!cx_strcmp(src, CX_STR("creationdate"))) {
+    } else if(!cx_strcmp(src, cx_str("creationdate"))) {
         *prop = DAVQL_RES_CREATIONDATE;
-    } else if(!cx_strcmp(src, CX_STR("lastmodified"))) {
+    } else if(!cx_strcmp(src, cx_str("lastmodified"))) {
         *prop = DAVQL_RES_LASTMODIFIED;
-    } else if(!cx_strcmp(src, CX_STR("iscollection"))) {
+    } else if(!cx_strcmp(src, cx_str("iscollection"))) {
         *prop = DAVQL_RES_ISCOLLECTION;
     } else {
         return 0;
@@ -835,10 +835,10 @@
                     return -1;
                 }
             } else if(!dav_identifier2resprop(src, &cmd.data.resprop)) {
-                if(!cx_strcmp(src, CX_STR("true"))) {
+                if(!cx_strcmp(src, cx_str("true"))) {
                     cmd.type = DAVQL_CMD_INT;
                     cmd.data.integer = 1;
-                } else if(!cx_strcmp(src, CX_STR("false"))) {
+                } else if(!cx_strcmp(src, cx_str("false"))) {
                     cmd.type = DAVQL_CMD_INT;
                     cmd.data.integer = 0;
                 } else {
@@ -1032,7 +1032,7 @@
 }
 
 CxBuffer* dav_compile_expr(DavContext *ctx, const CxAllocator *a, DavQLExpression *lexpr, DavQLArgList  *ap) {
-    CxBuffer *bcode = cxBufferCreate(NULL, 512, a, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
+    CxBuffer *bcode = cxBufferCreate(a, NULL, 512, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
     if(!bcode) {
         return NULL;
     }

mercurial