From 63562f5135243ac2a2553b4e7360c59e86686d6f Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sat, 8 Jan 2022 23:13:32 +0100 Subject: Moved utf8 from cregex.h to separate file. Splitted csview.h into another file strings.h. --- examples/regex_match.c | 6 +++--- examples/splitstr.c | 4 ++-- examples/sview_split.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'examples') diff --git a/examples/regex_match.c b/examples/regex_match.c index 952d445b..01cbb772 100644 --- a/examples/regex_match.c +++ b/examples/regex_match.c @@ -18,7 +18,7 @@ int main() re = cregex_new("[+-]?([0-9]*\\.)?[0-9]+([Ee][-+]?[0-9]+)?"); cregex_match match; if (cregex_find(re, s, &match)) { - printf("Found digits at position %u-%u\n", match.start, match.end); + printf("Found digits at position %zu-%zu\n", match.start, match.end); } else { printf("Could not find any digits\n"); } @@ -27,8 +27,8 @@ int main() matches = cregex_find_all(re, s); csview sv = csview_from(s); c_foreach (i, cregex_result, matches) { - csview r = csview_slice(sv, i.ref->start, i.ref->end); - printf(c_svfmt " / ", c_svarg(r)); + csview rs = csview_slice(sv, i.ref->start, i.ref->end); + printf(c_PRIsv " | ", c_ARGsv(rs)); } } puts(""); diff --git a/examples/splitstr.c b/examples/splitstr.c index 81688ec7..db46eaed 100644 --- a/examples/splitstr.c +++ b/examples/splitstr.c @@ -1,4 +1,4 @@ -#include +#include void print_split(csview str, csview sep) { @@ -6,7 +6,7 @@ void print_split(csview str, csview sep) while (pos != str.size) { csview tok = csview_token(str, sep, &pos); // print non-null-terminated csview - printf("[" c_svfmt "]\n", c_svarg(tok)); + printf("[" c_PRIsv "]\n", c_ARGsv(tok)); } } diff --git a/examples/sview_split.c b/examples/sview_split.c index 8e8443b8..22d94f23 100644 --- a/examples/sview_split.c +++ b/examples/sview_split.c @@ -1,4 +1,4 @@ -#include +#include int main() { @@ -9,8 +9,8 @@ int main() 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_PRIsv ", " c_PRIsv ", " c_PRIsv "\n", + c_ARGsv(year), c_ARGsv(month), c_ARGsv(day)); c_auto (cstr, y, m, d) { y = cstr_from_v(year), m = cstr_from_v(month), d = cstr_from_v(day); -- cgit v1.2.3