# HG changeset patch # User Olaf Wintermann # Date 1770142193 -3600 # Node ID a4e1ba59b733c925b589b48f2dadc5f4c7d35682 # Parent f00d03835dd917fc96b144a398e7a0f6a1c00445 use bool instead of WSBool in strreplace diff -r f00d03835dd9 -r a4e1ba59b733 src/server/daemon/rewrite.c --- a/src/server/daemon/rewrite.c Tue Jan 13 18:09:20 2026 +0100 +++ b/src/server/daemon/rewrite.c Tue Feb 03 19:09:53 2026 +0100 @@ -66,7 +66,7 @@ const CxAllocator *a, StringTemplateSegment *seg, RVar *vardata, - WSBool *free_str) + bool *free_str) { if(seg->type != STRING_SEGMENT_NUM_PLACEHOLDER || seg->num < 0 || seg->num >= vardata->nmatch) { return (cxmutstr){NULL, 0}; diff -r f00d03835dd9 -r a4e1ba59b733 src/server/test/strreplace.c --- a/src/server/test/strreplace.c Tue Jan 13 18:09:20 2026 +0100 +++ b/src/server/test/strreplace.c Tue Feb 03 19:09:53 2026 +0100 @@ -201,9 +201,9 @@ // TODO } -static cxmutstr get_var(const CxAllocator *a, StringTemplateSegment *seg, void *userdata, WSBool *free_str) { +static cxmutstr get_var(const CxAllocator *a, StringTemplateSegment *seg, void *userdata, bool *free_str) { cxmutstr var_value = cx_strcat_a(a, CX_NULLSTR, 3, cx_str("var("), seg->str, cx_str(")")); - *free_str = TRUE; + *free_str = true; return var_value; } diff -r f00d03835dd9 -r a4e1ba59b733 src/server/util/strreplace.c --- a/src/server/util/strreplace.c Tue Jan 13 18:09:20 2026 +0100 +++ b/src/server/util/strreplace.c Tue Feb 03 19:09:53 2026 +0100 @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -38,8 +39,8 @@ StringTemplate* string_template_compile(const CxAllocator *a, cxstring tpl) { StringTemplateSegment *end = NULL; // segment list end - int var = FALSE; - int error = FALSE; + int var = false; + int error = false; CxBuffer buf; // tmp buffer if(cxBufferInit(&buf, NULL, NULL, 128, CX_BUFFER_AUTO_EXTEND|CX_BUFFER_FREE_CONTENTS)) { @@ -58,8 +59,8 @@ for(size_t i=0;i $ i++; - add_char = TRUE; + add_char = true; } else { - var = TRUE; + var = true; if(buf.pos == 0) { // reuse current segment seg->type = STRING_SEGMENT_VAR_PLACEHOLDER; } else { // create new segment - finish_seg = TRUE; + finish_seg = true; } } } else { - add_char = TRUE; + add_char = true; } } if(add_char) { if(cxBufferPut(&buf, c) != c) { - error = TRUE; + error = true; break; } } else if(finish_seg) { // copy buffer content cxmutstr seg_str = cx_strdup_a(a, cx_strn(buf.space, buf.pos)); if(!seg_str.ptr) { - error = TRUE; + error = true; break; } seg->str = seg_str; @@ -145,7 +146,7 @@ if(seg) { cxmutstr seg_str = cx_strdup_a(a, cx_strn(buf.space, buf.pos)); if(!seg_str.ptr) { - error = TRUE; + error = true; } else { seg->str = seg_str; if(seg->type == STRING_SEGMENT_VAR_PLACEHOLDER) { @@ -196,7 +197,7 @@ } } else if(varfunc) { // convert var segment to value - WSBool free_str = FALSE; + bool free_str = false; cxmutstr str = varfunc(a, seg, userdata, &free_str); if(str.length > 0) { size_t r = writef(str.ptr, 1, str.length, stream); diff -r f00d03835dd9 -r a4e1ba59b733 src/server/util/strreplace.h --- a/src/server/util/strreplace.h Tue Jan 13 18:09:20 2026 +0100 +++ b/src/server/util/strreplace.h Tue Feb 03 19:09:53 2026 +0100 @@ -29,8 +29,7 @@ #ifndef STRINGREPLACE_H #define STRINGREPLACE_H -#include "../public/nsapi.h" - +#include #include #include @@ -94,7 +93,7 @@ * free_str: If set to true, the returned string pointer will be freed * using the allocator's free function. */ -typedef cxmutstr (*strtpl_var_func)(const CxAllocator *a, StringTemplateSegment *seg, void *userdata, WSBool *free_str); +typedef cxmutstr (*strtpl_var_func)(const CxAllocator *a, StringTemplateSegment *seg, void *userdata, bool *free_str); /* * Compiles a string template