src/server/util/strreplace.h

changeset 634
9728d3a2ac97
parent 632
1defab20b477
--- a/src/server/util/strreplace.h	Sat Nov 22 14:27:01 2025 +0100
+++ b/src/server/util/strreplace.h	Sat Nov 22 16:44:42 2025 +0100
@@ -29,6 +29,8 @@
 #ifndef STRINGREPLACE_H
 #define STRINGREPLACE_H
 
+#include "../public/nsapi.h"
+
 #include <cx/string.h>
 #include <cx/buffer.h>
 
@@ -65,7 +67,7 @@
      * STRING_SEGMENT_NUM_PLACEHOLDER: null
      * STRING_SEGMENT_VAR_PLACEHOLDER: variable name
      */
-    cxstring str;
+    cxmutstr str;
     
     /*
      * Segment type
@@ -99,9 +101,8 @@
  * 
  * a: The allocator to use for building the compiled template
  * tpl: Semplate string
- * delim: Delimiter chars for variable names
  */
-StringTemplate string_template_compile(const CxAllocator *a, cxstring tpl, char *delim);
+StringTemplate* string_template_compile(const CxAllocator *a, cxstring tpl);
 
 /*
  * Builds a string using the provided template and writes it to the stream.
@@ -113,14 +114,18 @@
  * userdata: The userdata pointer passed to the strtpl_var_func callback
  * stream: The stream object to which the resulting string should be written
  * writef: Stream write function
+ * 
+ * returns the number of written bytes or -1 on error
  */
-int string_template_write_to(StringTemplate *tpl, const CxAllocator *a, strtpl_var_func varfunc, void *userdata, void *stream, cx_write_func writef);
+ssize_t string_template_write_to(StringTemplate *tpl, const CxAllocator *a, strtpl_var_func varfunc, void *userdata, void *stream, cx_write_func writef);
 
 /*
  * Builds a string, using the provided template and allocator
  */
 cxmutstr string_template_build_string(StringTemplate *tpl, const CxAllocator *a, strtpl_var_func varfunc, void *userdata);
 
+void string_template_free(StringTemplate *tpl);
+
 #ifdef __cplusplus
 }
 #endif

mercurial