diff -r 1f40ca07ae1b -r 839fefbdedc7 libidav/davqlparser.c --- a/libidav/davqlparser.c Sat Apr 20 13:01:58 2024 +0200 +++ b/libidav/davqlparser.c Thu May 23 22:35:45 2024 +0200 @@ -105,9 +105,9 @@ static void dav_debug_ql_stmt_print(DavQLStatement *stmt) { // Basic information - size_t fieldcount = stmt->fields ? stmt->fields->size : 0; + size_t fieldcount = stmt->fields ? cxListSize(stmt->fields) : 0; int specialfield = 0; - if (stmt->fields && stmt->fields->size > 0) { + if (fieldcount > 0) { DavQLField* firstfield = (DavQLField*)cxListAt(stmt->fields, 0); if (firstfield->expr->type == DAVQL_IDENTIFIER) { switch (firstfield->expr->srctext.ptr[0]) { @@ -146,7 +146,7 @@ cx_foreach(DavQLOrderCriterion*, critdata, i) { printf("%.*s %s%s", (int)critdata->column->srctext.length, critdata->column->srctext.ptr, critdata->descending ? "desc" : "asc", - i.index+1 < stmt->orderby->size ? ", " : "\n"); + i.index+1 < cxListSize(stmt->orderby) ? ", " : "\n"); } } else { printf("nothing\n"); @@ -296,7 +296,7 @@ case DQLD_CMD_F: examineclause = DQLD_CMD_F; examineelem = stmt->fields; - if (stmt->fields && stmt->fields->size > 0) { + if (stmt->fields && cxListSize(stmt->fields) > 0) { DavQLField* field = cxListAt(stmt->fields, 0); examineexpr = field->expr; dav_debug_ql_field_print(field); @@ -312,7 +312,7 @@ case DQLD_CMD_O: examineclause = DQLD_CMD_O; examineelem = stmt->orderby; - examineexpr = stmt->orderby && stmt->orderby->size > 0 ? + examineexpr = stmt->orderby && cxListSize(stmt->orderby) > 0 ? ((DavQLOrderCriterion*)cxListAt(stmt->orderby, 0))->column : NULL; dav_debug_ql_expr_print(examineexpr); break; @@ -1092,11 +1092,11 @@ DavQLField localfield; consumed = dav_parse_named_field(stmt, token, &localfield); if (!stmt->errorcode && consumed) { - DavQLField *field; - dqlsec_malloc(stmt, field, DavQLField); - memcpy(field, &localfield, sizeof(DavQLField)); - if(dav_stmt_add_field(stmt, field)) { - free(field); + DavQLField *add_field; + dqlsec_malloc(stmt, add_field, DavQLField); + memcpy(add_field, &localfield, sizeof(DavQLField)); + if(dav_stmt_add_field(stmt, add_field)) { + free(add_field); return 0; } } @@ -1838,7 +1838,7 @@ void dav_free_statement(DavQLStatement *stmt) { if(stmt->fields) { - stmt->fields->simple_destructor = (cx_destructor_func)dav_free_field; + cxDefineDestructor(stmt->fields, dav_free_field); cxListDestroy(stmt->fields); } @@ -1850,7 +1850,7 @@ } if(stmt->orderby) { - stmt->orderby->simple_destructor = (cx_destructor_func)dav_free_order_criterion; + cxDefineDestructor(stmt->orderby, dav_free_order_criterion); cxListDestroy(stmt->orderby); } if(stmt->args) {