summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-01-08 23:13:32 +0100
committerTyge Løvset <[email protected]>2022-01-08 23:13:32 +0100
commit63562f5135243ac2a2553b4e7360c59e86686d6f (patch)
tree439a3853a6bfded32a3031b577457bfba470f1a7 /examples
parent0a9910eee6582e6ee414071a0d5e7062448989cf (diff)
downloadSTC-modified-63562f5135243ac2a2553b4e7360c59e86686d6f.tar.gz
STC-modified-63562f5135243ac2a2553b4e7360c59e86686d6f.zip
Moved utf8 from cregex.h to separate file. Splitted csview.h into another file strings.h.
Diffstat (limited to 'examples')
-rw-r--r--examples/regex_match.c6
-rw-r--r--examples/splitstr.c4
-rw-r--r--examples/sview_split.c6
3 files changed, 8 insertions, 8 deletions
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 <stc/csview.h>
+#include <stc/strings.h>
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 <stc/csview.h>
+#include <stc/strings.h>
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);