summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-03-24 23:25:16 +0100
committerTyge Løvset <[email protected]>2022-03-24 23:25:16 +0100
commit233e354798d19dbac03ee0ff9c5e366bfefead6c (patch)
tree153f8c3c3e0a0193af828cba81d2f7a16e6eb442 /examples
parent0468971b404cee5582d360d7d1c66bb4148e1614 (diff)
downloadSTC-modified-233e354798d19dbac03ee0ff9c5e366bfefead6c.tar.gz
STC-modified-233e354798d19dbac03ee0ff9c5e366bfefead6c.zip
Misc. small internal API renaming/refactoring and additions.
Diffstat (limited to 'examples')
-rw-r--r--examples/regex2.c4
-rw-r--r--examples/regex_match.c5
2 files changed, 3 insertions, 6 deletions
diff --git a/examples/regex2.c b/examples/regex2.c
index d27b0406..1a8ac31d 100644
--- a/examples/regex2.c
+++ b/examples/regex2.c
@@ -1,5 +1,4 @@
#include <stc/cregex.h>
-#include <stc/csview.h>
#include <stc/cstr.h>
int main()
@@ -24,8 +23,7 @@ int main()
{
c_forrange (j, cregex_captures(re))
{
- csview cap = {m[j].str, m[j].len};
- printf(" submatch %" PRIuMAX ": " c_PRIsv "\n", j, c_ARGsv(cap));
+ printf(" submatch %" PRIuMAX ": " c_PRIsv "\n", j, c_ARGsv(m[j]));
}
puts("");
}
diff --git a/examples/regex_match.c b/examples/regex_match.c
index cc5bb483..899fc072 100644
--- a/examples/regex_match.c
+++ b/examples/regex_match.c
@@ -1,5 +1,4 @@
#include <stdio.h>
-#include <stc/csview.h>
#include <stc/cregex.h>
#include <stc/crandom.h>
#define i_val double
@@ -20,13 +19,13 @@ int main()
printf("%d\n", res);
cregmatch m[10];
if (cregex_find(&re, s, 10, m, 0) > 0) {
- printf("Found digits at position %" PRIuMAX "-%" PRIuMAX "\n", m[0].str - s, m[0].str - s + m[0].len);
+ printf("Found digits at position %" PRIuMAX "-%" PRIuMAX "\n", m[0].str - s, m[0].str - s + m[0].size);
} else {
printf("Could not find any digits\n");
}
while (cregex_find(&re, s, 10, m, creg_next) > 0) {
- printf("%.*s ; ", (int)m[0].len, m[0].str);
+ printf(c_PRIsv " ; ", c_ARGsv(m[0]));
}
puts("");
}