summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cregex.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-12-08 16:36:30 +0100
committerTyge Løvset <[email protected]>2022-12-08 16:36:30 +0100
commit3b616b5260f2f477563508b6eec5370506565da9 (patch)
tree99cc4b4edfb5b09289574a4f24053e3d1044eee0 /include/stc/cregex.h
parent0eadaa1220e1ba0382638067aaf8566c216765fd (diff)
downloadSTC-modified-3b616b5260f2f477563508b6eec5370506565da9.tar.gz
STC-modified-3b616b5260f2f477563508b6eec5370506565da9.zip
Changed/simplified cregex_replace*() API.
Diffstat (limited to 'include/stc/cregex.h')
-rw-r--r--include/stc/cregex.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/stc/cregex.h b/include/stc/cregex.h
index 877f4052..57157b47 100644
--- a/include/stc/cregex.h
+++ b/include/stc/cregex.h
@@ -124,14 +124,18 @@ cstr cregex_replace_sv(const cregex* re, csview input, const char* replace, unsi
bool (*mfun)(int i, csview match, cstr* mstr), int rflags);
static inline
-cstr cregex_replace(const cregex* re, const char* input, const char* replace, unsigned count) {
+cstr cregex_replace(const cregex* re, const char* input, const char* replace) {
csview sv = {input, strlen(input)};
- return cregex_replace_sv(re, sv, replace, count, NULL, cre_default);
+ return cregex_replace_sv(re, sv, replace, 0, NULL, cre_default);
}
/* replace + compile RE pattern, and extra arguments */
-cstr cregex_replace_pattern(const char* pattern, const char* input, const char* replace, unsigned count,
- bool (*mfun)(int i, csview match, cstr* mstr), int crflags);
+cstr cregex_replace_pattern_n(const char* pattern, const char* input, const char* replace, unsigned count,
+ bool (*mfun)(int i, csview match, cstr* mstr), int crflags);
+static inline
+cstr cregex_replace_pattern(const char* pattern, const char* input, const char* replace)
+ { return cregex_replace_pattern_n(pattern, input, replace, 0, NULL, cre_default); }
+
/* destroy regex */
void cregex_drop(cregex* self);