diff -r 348fd9cb7b14 -r 0380e438a7ce src/string.c --- a/src/string.c Wed May 16 14:02:59 2018 +0200 +++ b/src/string.c Wed May 16 18:56:44 2018 +0200 @@ -65,7 +65,7 @@ } -size_t ucx_strnlen(size_t n, ...) { +size_t scstrnlen(size_t n, ...) { va_list ap; va_start(ap, n); @@ -150,7 +150,7 @@ return str; } -sstr_t ucx_strcat(size_t count, scstr_t s1, ...) { +sstr_t scstrcat(size_t count, scstr_t s1, ...) { va_list ap; va_start(ap, s1); sstr_t s = sstrvcat_a(ucx_default_allocator(), count, s1, ap); @@ -158,7 +158,7 @@ return s; } -sstr_t ucx_strcat_a(UcxAllocator *a, size_t count, scstr_t s1, ...) { +sstr_t scstrcat_a(UcxAllocator *a, size_t count, scstr_t s1, ...) { va_list ap; va_start(ap, s1); sstr_t s = sstrvcat_a(a, count, s1, ap); @@ -348,7 +348,7 @@ return result; } -sstr_t ucx_sstrstr(sstr_t string, scstr_t match) { +sstr_t scstrsstr(sstr_t string, scstr_t match) { sstr_t result; size_t reslen; @@ -366,7 +366,7 @@ return result; } -scstr_t ucx_scstrstr(scstr_t string, scstr_t match) { +scstr_t scstrscstr(scstr_t string, scstr_t match) { scstr_t result; size_t reslen; @@ -387,11 +387,11 @@ #undef ptable_r #undef ptable_w -sstr_t* ucx_strsplit(scstr_t s, scstr_t d, ssize_t *n) { - return ucx_strsplit_a(ucx_default_allocator(), s, d, n); +sstr_t* scstrsplit(scstr_t s, scstr_t d, ssize_t *n) { + return scstrsplit_a(ucx_default_allocator(), s, d, n); } -sstr_t* ucx_strsplit_a(UcxAllocator *allocator, scstr_t s, scstr_t d, ssize_t *n) { +sstr_t* scstrsplit_a(UcxAllocator *allocator, scstr_t s, scstr_t d, ssize_t *n) { if (s.length == 0 || d.length == 0) { *n = -1; return NULL; @@ -435,7 +435,7 @@ match.length--; } } else { - match = scstrstr(curpos, d); + match = scstrscstr(curpos, d); } if (match.length > 0) { /* is this our last try? */ @@ -487,7 +487,7 @@ return result; } -int ucx_strcmp(scstr_t s1, scstr_t s2) { +int scstrcmp(scstr_t s1, scstr_t s2) { if (s1.length == s2.length) { return memcmp(s1.ptr, s2.ptr, s1.length); } else if (s1.length > s2.length) { @@ -497,7 +497,7 @@ } } -int ucx_strcasecmp(scstr_t s1, scstr_t s2) { +int scstrcasecmp(scstr_t s1, scstr_t s2) { if (s1.length == s2.length) { #ifdef _WIN32 return _strnicmp(s1.ptr, s2.ptr, s1.length); @@ -511,11 +511,11 @@ } } -sstr_t ucx_strdup(scstr_t s) { +sstr_t scstrdup(scstr_t s) { return sstrdup_a(ucx_default_allocator(), s); } -sstr_t ucx_strdup_a(UcxAllocator *allocator, scstr_t s) { +sstr_t scstrdup_a(UcxAllocator *allocator, scstr_t s) { sstr_t newstring; newstring.ptr = (char*)almalloc(allocator, s.length + 1); if (newstring.ptr) { @@ -561,7 +561,7 @@ return newstr; } -int ucx_strprefix(scstr_t string, scstr_t prefix) { +int scstrprefix(scstr_t string, scstr_t prefix) { if (string.length == 0) { return prefix.length == 0; } @@ -576,7 +576,7 @@ } } -int ucx_strsuffix(scstr_t string, scstr_t suffix) { +int scstrsuffix(scstr_t string, scstr_t suffix) { if (string.length == 0) { return suffix.length == 0; } @@ -592,7 +592,7 @@ } } -sstr_t ucx_strlower(scstr_t string) { +sstr_t scstrlower(scstr_t string) { sstr_t ret = sstrdup(string); for (size_t i = 0; i < ret.length ; i++) { ret.ptr[i] = tolower(ret.ptr[i]); @@ -600,7 +600,7 @@ return ret; } -sstr_t ucx_strlower_a(UcxAllocator *allocator, scstr_t string) { +sstr_t scstrlower_a(UcxAllocator *allocator, scstr_t string) { sstr_t ret = sstrdup_a(allocator, string); for (size_t i = 0; i < ret.length ; i++) { ret.ptr[i] = tolower(ret.ptr[i]); @@ -608,7 +608,7 @@ return ret; } -sstr_t ucx_strupper(scstr_t string) { +sstr_t scstrupper(scstr_t string) { sstr_t ret = sstrdup(string); for (size_t i = 0; i < ret.length ; i++) { ret.ptr[i] = toupper(ret.ptr[i]); @@ -616,7 +616,7 @@ return ret; } -sstr_t ucx_strupper_a(UcxAllocator *allocator, scstr_t string) { +sstr_t scstrupper_a(UcxAllocator *allocator, scstr_t string) { sstr_t ret = sstrdup_a(allocator, string); for (size_t i = 0; i < ret.length ; i++) { ret.ptr[i] = toupper(ret.ptr[i]);