dav/main.c

changeset 747
efbd59642577
parent 744
f0d7178043c1
child 775
e5909dff0dbf
--- a/dav/main.c	Sun Apr 16 14:12:24 2023 +0200
+++ b/dav/main.c	Fri Apr 21 21:25:32 2023 +0200
@@ -38,8 +38,11 @@
 #ifndef _WIN32
 #include <sys/wait.h>
 #endif
-#include <ucx/string.h>
-#include <ucx/utils.h>
+#include <cx/string.h>
+#include <cx/utils.h>
+#include <cx/printf.h>
+#include <cx/hash_map.h>
+#include <cx/linked_list.h>
 #include <dirent.h>
 
 #include <libidav/utils.h>
@@ -160,7 +163,7 @@
         } else if(!strcasecmp(cmd, "get")) {
             ret = cmd_get(args, FALSE);
         } else if(!strcasecmp(cmd, "cat")) {
-            ucx_map_cstr_put(args->options, "output", "-");
+            cxMapPut(args->options, cx_hash_key_str("output"), "-");
             ret = cmd_get(args, FALSE);
         } else if(!strcasecmp(cmd, "edit")) {
             ret = cmd_edit(args);
@@ -274,14 +277,14 @@
 };
 
 char* find_usage_str(const char *cmd) {
-    scstr_t c = scstr(cmd);
+    cxstring c = cx_str(cmd);
     for(int i=0;;i++) {
         char *str = cmdusageinfo[i];
         if(!str) {
             break;
         }
-        scstr_t u = scstr(str);
-        if(sstrprefix(u, c)) {
+        cxstring u = cx_str(str);
+        if(cx_strprefix(u, c)) {
             return str;
         }
     }
@@ -591,7 +594,7 @@
         return -1;
     }
     if(export) {
-        ucx_map_cstr_put(a->options, "recursive", "");
+        cxMapPut(a->options, cx_hash_key_str("recursive"), "");
     }
     
     char *url = a->argv[0];
@@ -694,7 +697,8 @@
     }
     
     // get list of resources
-    UcxList *reslist = NULL;
+    CxList *reslist = cxLinkedListCreateSimple(CX_STORE_POINTERS);
+    reslist->simple_destructor = (cx_destructor_func)free_getres;
     uint64_t totalsize = 0;
     uint64_t rescount = 0;
     
@@ -705,10 +709,11 @@
     char *structure = cmd_getoption(a, "structure");
     
     // iterate over resource tree
-    UcxList *stack = ucx_list_prepend(NULL, getres);
-    while(stack) {
-        GetResource *g = stack->data;
-        stack = ucx_list_remove(stack, stack);
+    CxList *stack = cxLinkedListCreateSimple(CX_STORE_POINTERS);
+    cxListInsert(stack, 0, getres);
+    while(stack->size > 0) {
+        GetResource *g = cxListAt(stack, 0);
+        cxListRemove(stack, 0);
 
         if(g->res->iscollection) {
             DavResource *child = g->res->children;
@@ -720,7 +725,7 @@
                 newres->path = pathlen > 0 ?
                     util_concat_path(g->path, child->name) : strdup(child->name);
 
-                stack = ucx_list_prepend(stack, newres);
+                cxListInsert(stack, 0, newres);
                 
                 child = child->next;
             }
@@ -737,9 +742,10 @@
         if(strlen(g->path) == 0) {
             free_getres(g);
         } else {
-            reslist = ucx_list_append(reslist, g);
+            cxListAdd(reslist, g);
         }
     }
+    cxListDestroy(stack);
     
     // download resources
     pdata.total = totalsize;
@@ -758,9 +764,8 @@
     } else {
         get = get_resource;
     }
-    UCX_FOREACH(elm, reslist) {
-        GetResource *getres = elm->data;
-        
+    CxIterator i = cxListIterator(reslist);
+    cx_foreach(GetResource *, getres, i) {
         ret = get(repo, getres, a, tout);
         if(ret) {
             break;
@@ -774,8 +779,7 @@
         }
     }
     
-    ucx_list_free_content(reslist, free_getres);
-    ucx_list_free(reslist);
+    cxListDestroy(reslist);
     free(path);
     
     if(pdata.out && !pdata.isstdout) {
@@ -1135,7 +1139,7 @@
     }
     
     if(import) {
-        ucx_map_cstr_put(a->options, "resursive", "");
+        cxMapPut(a->options, cx_hash_key_str("resursive"), "");
     }
     
     char *url = a->argv[0];
@@ -1158,7 +1162,7 @@
     if(a->argc > 2) {
         printfile = TRUE;
         ignoredirerr = TRUE;
-    } else if(ucx_map_cstr_get(a->options, "recursive")) {
+    } else if(cmd_getoption(a, "recursive")) {
         printfile = TRUE;
     }
     
@@ -1289,7 +1293,7 @@
             fprintf(stderr, "cannot open input file\n");
             return -1;
         }
-        char *filename = util_resource_name(file);
+        const char *filename = util_resource_name(file);
         //path = util_concat_path(path, filename);
         ret = put_file(repo, a, sn, path, filename, finfo, file, in, s.st_size);
         //free(path);
@@ -1379,8 +1383,8 @@
         Repository *repo,
         CmdArgs *a,
         DavSession *sn,
-        char *path,
-        char *name,
+        const char *path,
+        const char *name,
         uint32_t finfo,
         const char *fpath,
         FILE *in,
@@ -1695,11 +1699,10 @@
     char **date_str = (char**)data;
     
     //printf("header: %.*s\n", s*n, header);
-    sstr_t h = sstrn(header, s*n);
-    if(sstrprefix(h, S("Date:"))) {
-        sstr_t v = sstrsubs(h, 5);
-        v = sstrdup(sstrtrim(v));
-        *date_str = v.ptr;
+    cxstring h = cx_strn(header, s*n);
+    if(cx_strprefix(h, CX_STR("Date:"))) {
+        cxstring v = cx_strsubs(h, 5);
+        *date_str = cx_strdup(cx_strtrim(v)).ptr;
     }
     return s*n;
 }
@@ -1926,7 +1929,7 @@
     char *path = NULL;
     Repository *repo = url2repo(url, &path);
     DavSession *sn = connect_to_repo(ctx, repo, path, request_auth, a);
-    ucx_mempool_reg_destr(sn->mp, path, free);
+    util_regdestr(sn->mp, path, free);
     
     if(set_session_config(sn, a)) {
         return -1;
@@ -1935,7 +1938,7 @@
     time_t timeout = 0;
     char *timeoutstr = cmd_getoption(a, "timeout");
     if(timeoutstr) {
-        if(!sstrcasecmp(sstr(timeoutstr), S("infinite"))) {
+        if(!cx_strcasecmp(cx_str(timeoutstr), CX_STR("infinite"))) {
             timeout = -1;
         } else {
             uint64_t i;
@@ -1970,20 +1973,21 @@
 }
 
 static char* read_line() {
-    UcxBuffer *buf = ucx_buffer_new(NULL, 128, UCX_BUFFER_AUTOEXTEND);
+    CxBuffer buf;
+    cxBufferInit(&buf, NULL, 128, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
     int c;
     while((c = getchar()) != EOF) {
         if(c == '\n') {
             break;
         }
-        ucx_buffer_putc(buf, c);
+        cxBufferPut(&buf, c);
     } 
     char *str = NULL;
-    sstr_t line = sstrtrim(sstrn(buf->space, buf->size));
+    cxstring line = cx_strtrim(cx_strn(buf.space, buf.size));
     if(line.length != 0) {
-        str = sstrdup(line).ptr;
+        str = cx_strdup(line).ptr;
     }
-    ucx_buffer_free(buf);
+    cxBufferDestroy(&buf);
     return str;
 }
 
@@ -1998,7 +2002,7 @@
     char *path = NULL;
     Repository *repo = url2repo(url, &path);
     DavSession *sn = connect_to_repo(ctx, repo, path, request_auth, a);
-    ucx_mempool_reg_destr(sn->mp, path, free);
+    util_regdestr(sn->mp, path, free);
     if(set_session_config(sn, a)) {
         return -1;
     }
@@ -2109,7 +2113,7 @@
 
             DavXmlNode *xval = dav_get_property_ns(res, p.ns, p.name);
             if(dav_xml_isstring(xval)) {
-                sstr_t value = sstr(dav_xml_getstring(xval));
+                cxstring value = cx_str(dav_xml_getstring(xval));
                 printf("  %s: %.*s\n", p.name, (int)value.length, value.ptr);
             } else {
                 // find some xml elements
@@ -2319,26 +2323,25 @@
 
 
 char* stdin2str() {
-    UcxBuffer *buf = ucx_buffer_new(NULL, 1024, UCX_BUFFER_AUTOEXTEND);
-    size_t size = ucx_stream_copy(stdin, buf, fread, ucx_buffer_write);
+    CxBuffer buf;
+    cxBufferInit(&buf, NULL, 1024, cxDefaultAllocator, 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) {
-        ucx_buffer_free(buf);
+        cxBufferDestroy(&buf);
         return NULL;
     } else {
-        ucx_buffer_putc(buf, '\0');
-        char *str = buf->space;
-        free(buf);
-        return str;
+        cxBufferPut(&buf, '\0');
+        return buf.space;
     }
 }
 
-static void xml2str_i(DavXmlNode *node, UcxBuffer *buf, int indent) {
+static void xml2str_i(DavXmlNode *node, CxBuffer *buf, int indent) {
     while(node) {
         if(node->type == DAV_XML_ELEMENT) {
             if(node->children) {
                 if(dav_xml_isstring(node->children)) {
-                    sstr_t s = sstrtrim(sstr(dav_xml_getstring(node->children)));
-                    ucx_bprintf(
+                    cxstring s = cx_strtrim(cx_str(dav_xml_getstring(node->children)));
+                    cx_bprintf(
                             buf,
                             "%*s<%s>%.*s</%s>\n",
                             indent,
@@ -2348,18 +2351,18 @@
                             s.ptr,
                             node->name);
                 } else {
-                    ucx_bprintf(buf, "%*s<%s>\n", indent, "", node->name);
+                    cx_bprintf(buf, "%*s<%s>\n", indent, "", node->name);
                     xml2str_i(node->children, buf, indent+2);
-                    ucx_bprintf(buf, "%*s</%s>\n", indent, "", node->name);
+                    cx_bprintf(buf, "%*s</%s>\n", indent, "", node->name);
                 }
             } else {
-                ucx_bprintf(buf, "%*s<%s />", indent, "", node->name);
-                ucx_buffer_putc(buf, '\n');
+                cx_bprintf(buf, "%*s<%s />", indent, "", node->name);
+                cxBufferPut(buf, '\n');
             }
         } else if(node->type == DAV_XML_TEXT) {
-            sstr_t val = sstrtrim(sstrn(node->content, node->contentlength));
+            cxstring val = cx_strtrim(cx_strn(node->content, node->contentlength));
             if(val.length > 0) {
-                ucx_bprintf(buf, "%*.*s", indent, (int)val.length, val.ptr);
+                cx_bprintf(buf, "%*.*s", indent, (int)val.length, val.ptr);
             }
         }
         
@@ -2368,30 +2371,28 @@
 }
 
 char* xml2str(DavXmlNode *node) {
-    char *str = malloc(256);
-    UcxBuffer *buf = ucx_buffer_new(str, 256, UCX_BUFFER_AUTOEXTEND);
-    xml2str_i(node, buf, 0);
-    ucx_buffer_putc(buf, 0);
-    char *space = buf->space;
-    ucx_buffer_free(buf);
-    return space;
+    CxBuffer buf;
+    cxBufferInit(&buf, NULL, 256, cxDefaultAllocator, CX_BUFFER_AUTO_EXTEND);
+    xml2str_i(node, &buf, 0);
+    cxBufferPut(&buf, 0);
+    return buf.space;
 }
 
 void printxmldoc(FILE *out, char *root, char *rootns, DavXmlNode *content) {
-    UcxMap *nsmap = ucx_map_new(16);
+    CxMap *nsmap = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 16);
+    nsmap->simple_destructor = free;
     
-    ucx_map_cstr_put(nsmap, rootns, "x0");
+    cxMapPut(nsmap, cx_hash_key_str(rootns), "x0");
     fprintf(out, "%s", "<?xml version=\"1.0\"?>\n");
     fprintf(out, "<x0:%s xmlns:x0=\"%s\">", root, rootns);
     
-    dav_print_node(out, (write_func)fwrite, nsmap, content);
+    dav_print_node(out, (cx_write_func)fwrite, nsmap, content);
     
     fprintf(out, "</x0:%s>\n", root);
     
     // cleanup namespace map
-    ucx_map_cstr_remove(nsmap, rootns);
-    ucx_map_free_content(nsmap, free);
-    ucx_map_free(nsmap);
+    cxMapRemove(nsmap, cx_hash_key_str(rootns));
+    cxMapDestroy(nsmap);
 }
 
 
@@ -2404,7 +2405,7 @@
         fprintf(stderr, "Abort\n");
         return -1;
     }
-    if(get_repository(sstr(name))) {
+    if(get_repository(cx_str(name))) {
         fprintf(stderr, "Repository %s already exists.\nAbort\n", name);
         return -1;
     }
@@ -2460,7 +2461,7 @@
     }
     
     for(int i = 0 ; i < args->argc ; i++) {
-        sstr_t reponame = sstr(args->argv[i]);
+        cxstring reponame = cx_str(args->argv[i]);
         Repository* repo = get_repository(reponame);
         if(repo) {
             if(remove_repository(repo)) {
@@ -2484,16 +2485,16 @@
         return -1;
     }
     
-    sstr_t reponame = sstr(args->argv[0]);
+    cxstring reponame = cx_str(args->argv[0]);
     Repository* repo = get_repository(reponame);
     if(repo) {
-        sstr_t url = sstr(repo->url);
+        cxstring url = cx_str(repo->url);
         if(repo->user && !cmd_getoption(args, "plain")) {
             int hostindex = 0;
-            if(sstrprefix(url, S("https://"))) {
+            if(cx_strprefix(url, CX_STR("https://"))) {
                 printf("https://");
                 hostindex = 8;
-            } else if(sstrprefix(url, S("http://"))) {
+            } else if(cx_strprefix(url, CX_STR("http://"))) {
                 printf("http://");
                 hostindex = 7;
             }
@@ -2616,9 +2617,10 @@
     
     // optionally, get one or more locations
     char *location = NULL;
-    UcxList *locations = NULL;
+    CxList *locations = cxLinkedListCreateSimple(CX_STORE_POINTERS);
+    locations->simple_destructor = free;
     while((location = assistant_getoptcfg("Location"))) {
-        locations = ucx_list_append(locations, location);
+        cxListAdd(locations, location);
     }
     
     int ret = 1;
@@ -2635,8 +2637,7 @@
     if(user) free(user);
     if(password) free(password);
     
-    ucx_list_free_content(locations, free);
-    ucx_list_free(locations);
+    cxListDestroy(locations);
     
     return ret;
 }
@@ -2649,7 +2650,7 @@
  * called before the secret store is decrypted
  */
 static int cmd_ss_list_users_bc(CmdArgs *Args, PwdStore *secrets, int *ret) {
-    if(secrets->index->count == 0) {
+    if(secrets->index->size == 0) {
         return 1; // abort, because the secret store is empty
     }
     // set ret to 1, because decrypt could fail and this should be an error
@@ -2663,24 +2664,28 @@
 static int cmd_ss_list_users(CmdArgs *args, PwdStore *secrets, int *ret) {
     *ret = 0;
     
-    UcxList *list = secrets->locations;
+    CxList *list = secrets->locations;
     for(int i=0;i<2;i++) {
-        UCX_FOREACH(elm, list) {
-            PwdIndexEntry *index = elm->data;
-            PwdEntry *e = ucx_map_cstr_get(secrets->ids, index->id);
-            if(e) {
-                printf("Id: %s\n", e->id);
-                printf("User: %s\n", e->user);
-                UCX_FOREACH(loc, index->locations) {
-                    char *location = loc->data;
-                    printf("Location: %s\n", location);
+        if(list) {
+            CxIterator i = cxListIterator(list);
+            cx_foreach(PwdIndexEntry*, index, i) {
+                PwdEntry *e = cxMapGet(secrets->ids, cx_hash_key_str(index->id));
+                if(e) {
+                    printf("Id: %s\n", e->id);
+                    printf("User: %s\n", e->user);
+                    if(index->locations) {
+                        CxIterator loc_iter = cxListIterator(index->locations);
+                        cx_foreach(char *, location, loc_iter) {
+                            printf("Location: %s\n", location);
+                        }
+                        printf("\n");
+                    }
+                } else {
+                    // broken index
+                    fprintf(stderr,
+                            "Warning: id '%s' not in secret store.\n",
+                            index->id);
                 }
-                printf("\n");
-            } else {
-                // broken index
-                fprintf(stderr,
-                        "Warning: id '%s' not in secret store.\n",
-                        index->id);
             }
         }
         list = secrets->noloc;
@@ -2729,28 +2734,32 @@
         return;
     }
     
-    PwdIndexEntry *index = ucx_map_cstr_get(secrets->index, id);
+    PwdIndexEntry *index = cxMapGet(secrets->index, cx_hash_key_str(id));
     if(!index) {
         return;
     }
     
     printf("Id: %s\n", entry->id);
     printf("User: %s\n", entry->user);
-    UCX_FOREACH(elm, index->locations) {
-        printf("Location: %s\n", (char*)elm->data);
+    if(index->locations) {
+        CxIterator loc_iter = cxListIterator(index->locations);
+        cx_foreach(char *, location, loc_iter) {
+            printf("Location: %s\n", location);
+        }
     }
 }
 
 static void secrets_remove_location(PwdIndexEntry *index) {
-    if(!index->locations) {
+    if(!index->locations || index->locations->size == 0) {
         printf("no locations\n");
         return;
     }
     
     printf("0: abort\n");
     int i = 1;
-    UCX_FOREACH(elm, index->locations) {
-        printf("%d: %s\n", i, (char*)elm->data);
+    CxIterator loc_iter = cxListIterator(index->locations);
+    cx_foreach(char *, location, loc_iter) {
+        printf("%d: %s\n", i, location);
         i++;
     }
     
@@ -2764,10 +2773,10 @@
         if(ln == 0) {
             return;
         } else {
-            UcxList *elm = ucx_list_get(index->locations, ln - 1);
-            if(elm) {
-                free(elm->data);
-                index->locations = ucx_list_remove(index->locations, elm);
+            char *location = cxListAt(index->locations, ln - 1);
+            if(location) {
+                free(location);
+                cxListRemove(index->locations, ln - 1);
             }
         }
     } else {
@@ -2783,7 +2792,7 @@
         return 1;
     }
     PwdEntry *entry = pwdstore_get(secrets, id);
-    PwdIndexEntry *index = ucx_map_cstr_get(secrets->index, id);
+    PwdIndexEntry *index = cxMapGet(secrets->index, cx_hash_key_str(id));
     if(!entry || !index) {
         fprintf(stderr, "Credentials with this id doesn't exist.\n");
         return 1;
@@ -2837,7 +2846,7 @@
                     // add location
                     char *location = assistant_getoptcfg("Location");
                     if(location) {
-                        index->locations = ucx_list_append(index->locations, location);
+                        cxListAdd(index->locations, location);
                     }
                     break;
                 }
@@ -2848,11 +2857,12 @@
                 }
                 case 4: {
                     // list locations
-                    if(!index->locations) {
+                    if(!index->locations || index->locations->size == 0) {
                         printf("no locations\n");
                     } else {
-                        UCX_FOREACH(elm, index->locations) {
-                            printf("Location: %s\n", (char*)elm->data);
+                        CxIterator i = cxListIterator(index->locations);
+                        cx_foreach(char *, location, i) {
+                            printf("Location: %s\n", location);
                         }
                     }
                     break;
@@ -2910,12 +2920,13 @@
 
 static char** read_args_from_stdin(int *argc) {
     // read stdin into buffer
-    UcxBuffer *in = ucx_buffer_new(NULL, 1024, UCX_BUFFER_AUTOEXTEND);
-    ucx_stream_copy(stdin, in, (read_func)fread, (write_func)ucx_buffer_write);
+    CxBuffer *in = cxBufferCreate(NULL, 1024, cxDefaultAllocator, 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
     ssize_t count = 0;
-    sstr_t *lines = scstrsplit(scstrn(in->space, in->pos), SC("\n"), &count);
+    cxmutstr *lines; 
+    count = cx_strsplit_ma(cxDefaultAllocator, cx_mutstrn(in->space, in->pos), CX_STR("\n"), INT_MAX, &lines);
     
     char **args = NULL;
     if(count > 0) {
@@ -2931,7 +2942,7 @@
     }
     
     // cleanup
-    ucx_buffer_free(in);
+    cxBufferFree(in);
     
     return args;
 }
@@ -2997,9 +3008,9 @@
 
 int shell_completion(char *cmd, CmdArgs *args, int index) { 
     if(index == 1) {
-        sstr_t prefix = { NULL, 0 };
+        cxstring prefix = { NULL, 0 };
         if(cmd) {
-            prefix = sstr(cmd);
+            prefix = cx_str(cmd);
         }
         for(int i=0;;i++) {
             char *str = cmdusageinfo[i];
@@ -3015,7 +3026,7 @@
                 }
             }
             if(prefix.ptr) {
-                if(!sstrprefix(sstrn(str, maxlen), prefix)) {
+                if(!cx_strprefix(cx_strn(str, maxlen), prefix)) {
                     continue;
                 }
             }
@@ -3053,7 +3064,7 @@
 }
 
 int url_completion(CmdArgs *args, char *u) {   
-    sstr_t url;
+    cxstring url;
     url.ptr = u;
     url.length = u ? strlen(u) : 0;
     
@@ -3082,10 +3093,9 @@
         }
     }
     if(repocomp) {
-        UcxList *repos = get_repositories();
-        UCX_FOREACH(elm, repos) {
-            Repository *repo = elm->data;
-            if(sstrprefix(sstr(repo->name), url)) {
+        CxIterator i = get_repositories();
+        cx_foreach(Repository*, repo, i) {
+            if(cx_strprefix(cx_str(repo->name), url)) {
                 if(quote == '\0') {
                     printf("%s/\n", repo->name);
                 } else {
@@ -3096,7 +3106,7 @@
         }
     } else {
         // url completion
-        ucx_map_cstr_put(args->options, "noinput", "");
+        cxMapPut(args->options, cx_hash_key_str("noinput"), "");
         
         char *path = NULL;
         Repository *repo = url2repo_s(url, &path);
@@ -3110,21 +3120,21 @@
         
         size_t plen = strlen(path);
         
-        sstr_t filter;
+        cxstring filter;
         char *lspath = NULL;
         if(path[plen-1] == '/') {
             lspath = strdup(path);
-            filter = S("");
+            filter = CX_STR("");
         } else {
             lspath = util_parent_path(path);
-            filter = sstr(util_resource_name(path));
+            filter = cx_str(util_resource_name(path));
         }
         
         DavResource *ls = dav_query(sn, "select - from %s order by name", lspath);
         DavResource *elm = ls ? ls->children : NULL;
         while(elm) {
-            sstr_t name = sstr(elm->name); 
-            if(sstrprefix(name, filter)) {
+            cxstring name = cx_str(elm->name); 
+            if(cx_strprefix(name, filter)) {
                 int space = 0;
                 for(int i=0;i<name.length;i++) {
                     if(name.ptr[i] == ' ') {
@@ -3133,8 +3143,8 @@
                     }
                 }
                 
-                UcxBuffer *out = ucx_buffer_new(NULL, 512, UCX_BUFFER_AUTOEXTEND);
-                ucx_buffer_puts(out, repo->name);
+                CxBuffer *out = cxBufferCreate(NULL, 512, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
+                cxBufferPutString(out, repo->name);
                 if(space) {
                     size_t l = strlen(elm->path);
                     for(int i=0;i<l;i++) {
@@ -3142,16 +3152,16 @@
                         char nextc = elm->path[i];
                         if(quote == '\0' && NULL != strchr(
                                 "!\"#$&'()*,;<>?[\\]^`{|}~ ", nextc)) {
-                            ucx_buffer_putc(out, '\\');
+                            cxBufferPut(out, '\\');
                         }
-                        ucx_buffer_putc(out, nextc);
+                        cxBufferPut(out, nextc);
                     }
                 } else {
-                    ucx_buffer_puts(out, elm->path);
+                    cxBufferPutString(out, elm->path);
                 }
                 if(elm->iscollection) {
                     if(out->space[out->pos-1] != '/') {
-                        ucx_buffer_putc(out, '/');
+                        cxBufferPut(out, '/');
                     }
                 }
                 if (quote == '\0') {
@@ -3161,7 +3171,7 @@
                             quote, (int)out->pos, out->space, quote);
                 }
                 
-                ucx_buffer_free(out);
+                cxBufferFree(out);
             }
             elm = elm->next;
         }

mercurial