--- a/src/string.c Thu Oct 31 14:39:05 2024 +0100 +++ b/src/string.c Thu Oct 31 14:54:44 2024 +0100 @@ -27,7 +27,6 @@ */ #include "cx/string.h" -#include "cx/utils.h" #include <string.h> #include <stdarg.h> @@ -89,7 +88,7 @@ va_list ap; va_start(ap, count); size_t size = 0; - cx_for_n(i, count) { + for (size_t i = 0; i < count; i++) { cxstring str = va_arg(ap, cxstring); size += str.length; } @@ -114,7 +113,7 @@ // get all args and overall length size_t slen = str.length; - cx_for_n(i, count) { + for (size_t i = 0; i < count; i++) { cxstring s = va_arg (ap, cxstring); strings[i] = s; slen += s.length; @@ -132,7 +131,7 @@ // concatenate strings size_t pos = str.length; str.length = slen; - cx_for_n(i, count) { + for (size_t i = 0; i < count; i++) { cxstring s = strings[i]; memcpy(str.ptr + pos, s.ptr, s.length); pos += s.length; @@ -193,7 +192,7 @@ ) { chr = 0xFF & chr; // TODO: improve by comparing multiple bytes at once - cx_for_n(i, string.length) { + for (size_t i = 0; i < string.length; i++) { if (string.ptr[i] == chr) { return cx_strsubs(string, i); } @@ -556,13 +555,13 @@ } void cx_strlower(cxmutstr string) { - cx_for_n(i, string.length) { + for (size_t i = 0; i < string.length; i++) { string.ptr[i] = (char) tolower(string.ptr[i]); } } void cx_strupper(cxmutstr string) { - cx_for_n(i, string.length) { + for (size_t i = 0; i < string.length; i++) { string.ptr[i] = (char) toupper(string.ptr[i]); } } @@ -748,7 +747,7 @@ // if more delimiters are specified, check them now if (ctx->delim_more_count > 0) { - cx_for_n(i, ctx->delim_more_count) { + for (size_t i = 0; i < ctx->delim_more_count; i++) { cxstring d = cx_strstr(haystack, ctx->delim_more[i]); if (d.length > 0 && (delim.length == 0 || d.ptr < delim.ptr)) { delim.ptr = d.ptr;