summaryrefslogtreecommitdiffhomepage
path: root/include/stc/csview.h
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2022-09-06 19:30:51 +0200
committerTyge Lovset <[email protected]>2022-09-06 19:30:51 +0200
commita65d94a54ba98ca1fa743d6c70a9b243afad47da (patch)
tree16839d8497eaf9f3cab4e5eb7c0efd3db507d35a /include/stc/csview.h
parent90311ff7eb34e5fc4fc1c2c38b8d0433642e9659 (diff)
downloadSTC-modified-a65d94a54ba98ca1fa743d6c70a9b243afad47da.tar.gz
STC-modified-a65d94a54ba98ca1fa743d6c70a9b243afad47da.zip
Updated docs for cregex and csview.
Diffstat (limited to 'include/stc/csview.h')
-rw-r--r--include/stc/csview.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/stc/csview.h b/include/stc/csview.h
index bfbf1c61..b60f6e38 100644
--- a/include/stc/csview.h
+++ b/include/stc/csview.h
@@ -103,11 +103,14 @@ STC_API csview csview_substr_ex(csview sv, intptr_t pos, size_t n);
STC_API csview csview_slice_ex(csview sv, intptr_t p1, intptr_t p2);
STC_API csview csview_token(csview sv, csview sep, size_t* start);
-#define c_foreach_token(it, input, sep) \
+#define c_foreach_token_sv(it, input, sep) \
for (struct { csview token, _sep, _inp; size_t start; } \
- it = {.token=csview_from(input), ._sep=csview_from(sep), ._inp=it.token, .start=0} \
+ it = {.token=input, ._sep=sep, ._inp=it.token, .start=0} \
; it.start <= it._inp.size && (it.token = csview_token(it._inp, it._sep, &it.start)).str ; )
+#define c_foreach_token(it, input, sep) \
+ c_foreach_token_sv(it, csview_from(input), csview_from(sep))
+
/* csview interaction with cstr: */
#ifdef CSTR_H_INCLUDED