summaryrefslogtreecommitdiffhomepage
path: root/examples/sview_split.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-12-29 12:14:35 +0100
committerTyge Løvset <[email protected]>2021-12-29 12:14:35 +0100
commit48e9d858da36b0fee7787edd12e7f336ccdf04b4 (patch)
treecea95d0d3240c073de0877da08bc0675900a22ea /examples/sview_split.c
parent390e99e911c46ad59ecb966bffb275c9cba92fe1 (diff)
downloadSTC-modified-48e9d858da36b0fee7787edd12e7f336ccdf04b4.tar.gz
STC-modified-48e9d858da36b0fee7787edd12e7f336ccdf04b4.zip
Fixed and simplified csview tokensizer call.
Diffstat (limited to 'examples/sview_split.c')
-rw-r--r--examples/sview_split.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/sview_split.c b/examples/sview_split.c
index 3a079583..ed0365ec 100644
--- a/examples/sview_split.c
+++ b/examples/sview_split.c
@@ -4,11 +4,13 @@ int main()
{
// No memory allocations or string length calculations!
const csview date = c_sv("2021/03/12");
- const csview year = csview_first_token(date, c_sv("/"));
- const csview month = csview_next_token(date, c_sv("/"), year);
- const csview day = csview_next_token(date, c_sv("/"), month);
+ size_t pos = 0;
+ const csview year = csview_token(date, c_sv("/"), &pos);
+ const csview month = csview_token(date, c_sv("/"), &pos);
+ const csview day = csview_token(date, c_sv("/"), &pos);
- printf(c_svfmt ", " c_svfmt ", " c_svfmt "\n", c_svarg(year), c_svarg(month), c_svarg(day));
+ printf(c_svfmt ", " c_svfmt ", " c_svfmt "\n",
+ c_svarg(year), c_svarg(month), c_svarg(day));
c_auto (cstr, y, m, d) {
y = cstr_from_v(year), m = cstr_from_v(month), d = cstr_from_v(day);