summaryrefslogtreecommitdiffhomepage
path: root/src/cregex.c
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 /src/cregex.c
parent0eadaa1220e1ba0382638067aaf8566c216765fd (diff)
downloadSTC-modified-3b616b5260f2f477563508b6eec5370506565da9.tar.gz
STC-modified-3b616b5260f2f477563508b6eec5370506565da9.zip
Changed/simplified cregex_replace*() API.
Diffstat (limited to 'src/cregex.c')
-rw-r--r--src/cregex.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cregex.c b/src/cregex.c
index 1747ed3f..53f33a16 100644
--- a/src/cregex.c
+++ b/src/cregex.c
@@ -1244,11 +1244,11 @@ cregex_replace_sv(const cregex* re, csview input, const char* replace, unsigned
}
cstr
-cregex_replace_pattern(const char* pattern, const char* input, const char* replace, unsigned count,
- bool (*mfun)(int, csview, cstr*), int crflags) {
+cregex_replace_pattern_n(const char* pattern, const char* input, const char* replace, unsigned count,
+ bool (*mfun)(int, csview, cstr*), int crflags) {
cregex re = cregex_init();
if (cregex_compile(&re, pattern, crflags) != cre_success)
- return cstr_new("[[error: invalid regex pattern]]");
+ assert(0);
csview sv = {input, strlen(input)};
cstr out = cregex_replace_sv(&re, sv, replace, count, mfun, crflags);
cregex_drop(&re);