src/server/util/util.c

changeset 91
fac51f87def0
parent 81
d25825f37967
child 96
0185b13bf41f
--- a/src/server/util/util.c	Wed Jul 31 13:02:06 2013 +0200
+++ b/src/server/util/util.c	Sun Sep 08 23:27:07 2013 +0200
@@ -53,6 +53,8 @@
 
 #include "../daemon/netsite.h"
 #include "../public/nsapi.h"
+#include <ucx/string.h>
+#include <ucx/mempool.h>
 
 #include "util.h"
 
@@ -484,9 +486,9 @@
         return newstr;
     }
     if(s.length == 1) {
-        newstr = sstrncat(3, newstr, parent, s, child);
+        newstr = sstrncat(newstr, 3, parent, s, child);
     } else {
-        newstr = sstrncat(2, newstr, parent, child);
+        newstr = sstrncat(newstr, 2, parent, child);
     }
     newstr.ptr[newstr.length] = '\0';
     
@@ -568,3 +570,17 @@
 
     return pb;
 }
+
+// TODO: remove
+sstr_t sstrdup_mp(UcxMempool *pool, sstr_t s) {
+    sstr_t newstring;
+    newstring.ptr = (char*)ucx_mempool_malloc(pool, s.length + 1);
+    if (newstring.ptr != NULL) {
+        newstring.length = s.length;
+        newstring.ptr[newstring.length] = 0;
+
+        memcpy(newstring.ptr, s.ptr, s.length);
+    }
+
+    return newstring;
+}

mercurial