diff options
author | default <nobody@localhost> | 2024-08-30 19:10:26 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2024-08-30 19:10:26 +0200 |
commit | 0218e964b0d73340c8d0c5d9e37991359d7c4be9 (patch) | |
tree | 9cfc1650abf8780be52dc219e37a311244a294e2 /xs_regex.h | |
parent | bff33fc2eda701ff5d6cd8433c15dfd9aca768f7 (diff) |
Backport from xs.
Diffstat (limited to 'xs_regex.h')
-rw-r--r-- | xs_regex.h | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -71,13 +71,12 @@ xs_list *xs_regex_select_n(const char *str, const char *rx, int count) xs *split = NULL; const xs_val *v; int n = 0; - int c = 0; /* split */ split = xs_regex_split_n(str, rx, count); /* now iterate to get only the 'separators' (odd ones) */ - while (xs_list_next(split, &v, &c)) { + xs_list_foreach(split, v) { if (n & 0x1) list = xs_list_append(list, v); @@ -96,10 +95,9 @@ xs_list *xs_regex_replace_in(xs_str *str, const char *rx, const char *rep, int c xs *split = xs_regex_split_n(str, rx, count); const xs_val *v; int n = 0; - int c = 0; int pholder = !!strchr(rep, '&'); - while (xs_list_next(split, &v, &c)) { + xs_list_foreach(split, v) { if (n & 0x1) { if (pholder) { /* rep has a placeholder; process char by char */ |