summaryrefslogtreecommitdiffhomepage
path: root/src/cregex.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-10-21 10:57:05 +0200
committerTyge Løvset <[email protected]>2022-10-21 10:57:05 +0200
commit3b0e849ca26bceab8c6a7b19e6a27bb4aa4d123a (patch)
tree0aef18c4f50d336ae7bb2164913d21ec97d3641b /src/cregex.c
parent3eb08b0372dd669af535a368e8a8cdb8a9c793c5 (diff)
downloadSTC-modified-3b0e849ca26bceab8c6a7b19e6a27bb4aa4d123a.tar.gz
STC-modified-3b0e849ca26bceab8c6a7b19e6a27bb4aa4d123a.zip
Swapped two last params in cregex_replace_pattern() and cregex_replace_sv() to always have flags at last (sorry for inconveniences).
Fixed a small bug in cregex_find_sv(), and added cre_default flag for readability.
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 88893de6..6eadd257 100644
--- a/src/cregex.c
+++ b/src/cregex.c
@@ -1225,7 +1225,7 @@ cregex_find_pattern(const char* pattern, const char* input,
cstr
cregex_replace_sv(const cregex* re, csview input, const char* replace, unsigned count,
- int rflags, bool (*mfun)(int, csview, cstr*)) {
+ bool (*mfun)(int, csview, cstr*), int rflags) {
cstr out = cstr_null;
cstr subst = cstr_null;
csview match[cre_MAXCAPTURES];
@@ -1248,12 +1248,12 @@ 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,
- int crflags, bool (*mfun)(int, csview, cstr*)) {
+ 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]]");
csview sv = {input, strlen(input)};
- cstr out = cregex_replace_sv(&re, sv, replace, count, crflags, mfun);
+ cstr out = cregex_replace_sv(&re, sv, replace, count, mfun, crflags);
cregex_drop(&re);
return out;
}