src/server/ucx/string.h

changeset 36
450d2d5f4735
parent 28
f387669912e8
child 51
b28cf69f42e8
--- a/src/server/ucx/string.h	Sat Aug 18 11:39:34 2012 +0200
+++ b/src/server/ucx/string.h	Sat Oct 06 13:00:07 2012 +0200
@@ -8,8 +8,12 @@
 #ifndef _SSTRING_H
 #define	_SSTRING_H
 
+#include <stddef.h>
+
 #include "mempool.h"
+#include "../util/pool.h"
 
+/* use macros for literals only */
 #define S(s) { s, sizeof(s)-1 }
 #define ST(s) sstrn(s, sizeof(s)-1)
 
@@ -66,16 +70,34 @@
 /*
  *
  */
-sstr_t sstrsubsl (sstr_t s, size_t start, size_t end);
+sstr_t sstrsubsl (sstr_t s, size_t start, size_t length);
 
+/*
+ * splits s into n parts
+ *
+ * s    the string to split
+ * d    the delimiter string
+ * n    the maximum size of the resulting list
+ *      a size of 0 indicates an unbounded list size
+ *      the actual size of the list will be stored here
+ *
+ *      Hint: use this value to avoid dynamic reallocation of the result list
+ *
+ * Returns a list of the split strings
+ * NOTE: this list needs to be freed manually after usage
+ *
+ * Returns NULL on error
+ */
+sstr_t* sstrsplit(sstr_t s, sstr_t d, size_t *n);
 
 int sstrcmp(sstr_t s1, sstr_t s2);
 
-sstr_t sstrdub(sstr_t s);
 sstr_t sstrdup(sstr_t s);
 
+// webserver extension
 sstr_t sstrtrim(sstr_t string);
-sstr_t sstrdup_mp(UcxMempool *mp, sstr_t s);
+sstr_t sstrdup_mp(UcxMempool *pool, sstr_t s);
+sstr_t sstrdup_pool(pool_handle_t *pool, sstr_t s);
 
 #ifdef	__cplusplus
 }

mercurial