summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cstr.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-01-29 17:24:33 +0100
committerTyge Løvset <[email protected]>2023-01-29 17:24:33 +0100
commit209bf743e0c1253a4bc81d2ffb6897f657a84c8a (patch)
tree9631a2a79e1890cb7c46515aae0ef105710ad59c /include/stc/cstr.h
parenta344b43728ff40a2e1ee25f2f1b592f33432aee7 (diff)
downloadSTC-modified-209bf743e0c1253a4bc81d2ffb6897f657a84c8a.tar.gz
STC-modified-209bf743e0c1253a4bc81d2ffb6897f657a84c8a.zip
Some method renaming in cspan: cspan_multidim() ctor => cspan_md(). cspan_atN() => cspan_submdN().
cstr_replace_ex() merged as overload of cstr_replace().
Diffstat (limited to 'include/stc/cstr.h')
-rw-r--r--include/stc/cstr.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/stc/cstr.h b/include/stc/cstr.h
index 04091968..071e40e8 100644
--- a/include/stc/cstr.h
+++ b/include/stc/cstr.h
@@ -373,12 +373,12 @@ STC_INLINE char* cstr_append_s(cstr* self, cstr s) {
return cstr_append_n(self, sv.str, sv.size);
}
-STC_INLINE void cstr_replace_ex(cstr* self, const char* search, const char* repl, unsigned count) {
+#define cstr_replace(...) c_MACRO_OVERLOAD(cstr_replace, __VA_ARGS__)
+#define cstr_replace_3(self, search, repl) cstr_replace_4(self, search, repl, ~0U)
+STC_INLINE void cstr_replace_4(cstr* self, const char* search, const char* repl, unsigned count) {
cstr_take(self, cstr_replace_sv(cstr_sv(self), c_SV(search, strlen(search)),
c_SV(repl, strlen(repl)), count));
}
-STC_INLINE void cstr_replace(cstr* self, const char* search, const char* repl)
- { cstr_replace_ex(self, search, repl, ~0U); }
STC_INLINE void cstr_replace_at_sv(cstr* self, size_t pos, size_t len, const csview repl) {
char* d = _cstr_internal_move(self, pos + len, pos + repl.size);