libidav/davqlparser.c

branch
dav-2
changeset 891
4d58cbcc9efa
parent 886
da79af4baec8
--- a/libidav/davqlparser.c	Sun Dec 07 20:16:59 2025 +0100
+++ b/libidav/davqlparser.c	Fri Dec 19 17:53:18 2025 +0100
@@ -169,7 +169,7 @@
 
 static void dav_debug_ql_expr_print(DavQLExpression *expr) {
     if (dav_debug_ql_expr_selected(expr)) {
-        cxstring empty = CX_STR("(empty)");
+        cxstring empty = cx_str("(empty)");
         printf(
             "Text: %.*s\nType: %s\nOperator: %s\n",
             sfmtarg(expr->srctext),
@@ -422,7 +422,7 @@
     
     // we try to achieve two things: get as many information as possible
     // and recover the concrete source string (and not the token strings)
-    cxstring emptystring = CX_STR("");
+    cxstring emptystring = cx_str("");
     cxstring prev = token->prev ? (token->prev->prev ?
         token_sstr(token->prev->prev) : token_sstr(token->prev))
         : emptystring;
@@ -457,10 +457,10 @@
 static const char *special_token_symbols = ",()+-*/&|^~=!<>";
 
 static _Bool iskeyword(DavQLToken *token) {
-    cxstring keywords[] ={CX_STR("select"), CX_STR("set"), CX_STR("from"), CX_STR("at"), CX_STR("as"),
-        CX_STR("where"), CX_STR("anywhere"), CX_STR("like"), CX_STR("unlike"), CX_STR("and"),
-        CX_STR("or"), CX_STR("not"), CX_STR("xor"), CX_STR("with"), CX_STR("infinity"),
-        CX_STR("order"), CX_STR("by"), CX_STR("asc"), CX_STR("desc")
+    cxstring keywords[] ={cx_str("select"), cx_str("set"), cx_str("from"), cx_str("at"), cx_str("as"),
+        cx_str("where"), cx_str("anywhere"), cx_str("like"), cx_str("unlike"), cx_str("and"),
+        cx_str("or"), cx_str("not"), cx_str("xor"), cx_str("with"), cx_str("infinity"),
+        cx_str("order"), cx_str("by"), cx_str("asc"), cx_str("desc")
     };
     for (int i = 0 ; i < sizeof(keywords)/sizeof(cxstring) ; i++) {
         if (!cx_strcasecmp(token->value, keywords[i])) {
@@ -471,8 +471,8 @@
 }
 
 static _Bool islongoperator(DavQLToken *token) {
-    cxstring operators[] = {CX_STR("and"), CX_STR("or"), CX_STR("not"), CX_STR("xor"),
-        CX_STR("like"), CX_STR("unlike")
+    cxstring operators[] = {cx_str("and"), cx_str("or"), cx_str("not"), cx_str("xor"),
+        cx_str("like"), cx_str("unlike")
     };
     for (int i = 0 ; i < sizeof(operators)/sizeof(cxstring) ; i++) {
         if (!cx_strcasecmp(token->value, operators[i])) {
@@ -484,7 +484,7 @@
 
 static int dav_stmt_add_field(DavQLStatement *stmt, DavQLField *field) {
     if(!stmt->fields) {
-        stmt->fields = cxLinkedListCreateSimple(CX_STORE_POINTERS);
+        stmt->fields = cxLinkedListCreate(NULL, CX_STORE_POINTERS);
         if(!stmt->fields) {
             stmt->errorcode = DAVQL_ERROR_OUT_OF_MEMORY;
             return 1;
@@ -645,7 +645,7 @@
     
     alloc_token();
     token->tokenclass = DAVQL_TOKEN_END;
-    token->value = CX_STR("");
+    token->value = cx_str("");
     
     cx_linked_list_add((void**)&tokens_begin, (void**)&tokens_end, offsetof(DavQLToken, prev), offsetof(DavQLToken, next), token);
     return tokens_begin;
@@ -745,7 +745,7 @@
 
 static void fmt_args_add(DavQLStatement *stmt, void *data) {
     if(!stmt->args) {
-        stmt->args = cxLinkedListCreateSimple(CX_STORE_POINTERS);
+        stmt->args = cxLinkedListCreate(NULL, CX_STORE_POINTERS);
     }
     cxListAdd(stmt->args, data);
 }
@@ -1508,7 +1508,7 @@
     DavQLOrderCriterion crit;
     
     if(!stmt->orderby) {
-        stmt->orderby = cxLinkedListCreateSimple(sizeof(DavQLOrderCriterion));
+        stmt->orderby = cxLinkedListCreate(NULL, sizeof(DavQLOrderCriterion));
         if(!stmt->orderby) {
             return 0;
         }
@@ -1837,7 +1837,7 @@
 
 void dav_free_statement(DavQLStatement *stmt) {
     if(stmt->fields) {
-        cxDefineDestructor(stmt->fields, dav_free_field);
+        cxSetDestructor(stmt->fields, dav_free_field);
         cxListFree(stmt->fields);
     }
     
@@ -1849,7 +1849,7 @@
     }
     
     if(stmt->orderby) {
-        cxDefineDestructor(stmt->orderby, dav_free_order_criterion);
+        cxSetDestructor(stmt->orderby, dav_free_order_criterion);
         cxListFree(stmt->orderby);
     }
     if(stmt->args) {

mercurial