Sun, 29 Dec 2019 19:45:00 +0100
fixes string replace function in case replmax is 0
src/string.c | file | annotate | diff | comparison | revisions |
--- a/src/string.c Sun Dec 29 16:04:34 2019 +0100 +++ b/src/string.c Sun Dec 29 19:45:00 2019 +0100 @@ -682,7 +682,7 @@ sstr_t scstrreplacen_a(UcxAllocator *allocator, scstr_t str, scstr_t pattern, scstr_t replacement, size_t replmax) { - if (pattern.length == 0 || pattern.length > str.length) + if (pattern.length == 0 || pattern.length > str.length || replmax == 0) return sstrdup(str); /* Compute expected buffer length */