From 3b616b5260f2f477563508b6eec5370506565da9 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Thu, 8 Dec 2022 16:36:30 +0100 Subject: Changed/simplified cregex_replace*() API. --- include/stc/cregex.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'include') 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); -- cgit v1.2.3