summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-05-13 14:36:25 +0200
committerTyge Løvset <[email protected]>2022-05-13 14:36:25 +0200
commit688a828e3bfaa1d56d50e132b31930d964e26c5d (patch)
treee8649a2ec64c34bc0ca251ed8208edf1d9d70d23 /examples
parenteda5a6418d0dda97261e340998f8f7e23a8e57b2 (diff)
downloadSTC-modified-688a828e3bfaa1d56d50e132b31930d964e26c5d.tar.gz
STC-modified-688a828e3bfaa1d56d50e132b31930d964e26c5d.zip
Changed csview c_PRIsv macro. Now must be prefixed with "%", to match with PRIxYYY macros from inttypes.h. E.g. printf("%40" c_PRIsv "\n", c_ARGsv(sv)); to specify 40 character right aligned output of sv. Check your usage.
Diffstat (limited to 'examples')
-rw-r--r--examples/regex2.c2
-rw-r--r--examples/regex_match.c2
-rw-r--r--examples/splitstr.c2
-rw-r--r--examples/sso_substr.c2
-rw-r--r--examples/sview_split.c2
-rw-r--r--examples/utf8replace_c.c2
6 files changed, 6 insertions, 6 deletions
diff --git a/examples/regex2.c b/examples/regex2.c
index 09eaecd3..750638c4 100644
--- a/examples/regex2.c
+++ b/examples/regex2.c
@@ -24,7 +24,7 @@ int main()
{
c_forrange (j, cregex_captures(re))
{
- printf(" submatch %" PRIuMAX ": " c_PRIsv "\n", j, c_ARGsv(m[j]));
+ 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 7f02f892..3747b319 100644
--- a/examples/regex_match.c
+++ b/examples/regex_match.c
@@ -26,7 +26,7 @@ int main()
}
while (cregex_find(&re, s, 10, m, creg_next) > 0) {
- printf(c_PRIsv " ; ", c_ARGsv(m[0]));
+ printf("%" c_PRIsv " ; ", c_ARGsv(m[0]));
}
puts("");
}
diff --git a/examples/splitstr.c b/examples/splitstr.c
index 427c61c8..d0aefa85 100644
--- a/examples/splitstr.c
+++ b/examples/splitstr.c
@@ -8,7 +8,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_PRIsv "]\n", c_ARGsv(tok));
+ printf("[%" c_PRIsv "]\n", c_ARGsv(tok));
}
}
diff --git a/examples/sso_substr.c b/examples/sso_substr.c
index f8382f16..8e21b7fe 100644
--- a/examples/sso_substr.c
+++ b/examples/sso_substr.c
@@ -8,7 +8,7 @@ int main ()
size_t pos = cstr_find(str, "live"); // position of "live"
csview sv2 = cstr_substr(&str, pos, 4); // "live"
csview sv3 = cstr_slice(&str, -8, -1); // "details"
- printf(c_PRIsv ", " c_PRIsv ", " c_PRIsv "\n",
+ printf("%" c_PRIsv ", %" c_PRIsv ", %" c_PRIsv "\n",
c_ARGsv(sv1), c_ARGsv(sv2), c_ARGsv(sv3));
cstr_assign(&str, "apples are green or red");
diff --git a/examples/sview_split.c b/examples/sview_split.c
index 3e3c584b..3594a599 100644
--- a/examples/sview_split.c
+++ b/examples/sview_split.c
@@ -10,7 +10,7 @@ int main()
const csview month = csview_token(date, c_sv("/"), &pos);
const csview day = csview_token(date, c_sv("/"), &pos);
- printf(c_PRIsv ", " c_PRIsv ", " c_PRIsv "\n",
+ printf("%" c_PRIsv ", %" c_PRIsv ", %" c_PRIsv "\n",
c_ARGsv(year), c_ARGsv(month), c_ARGsv(day));
c_auto (cstr, y, m, d) {
diff --git a/examples/utf8replace_c.c b/examples/utf8replace_c.c
index 5ca51d22..6b3fcebe 100644
--- a/examples/utf8replace_c.c
+++ b/examples/utf8replace_c.c
@@ -16,6 +16,6 @@ int main() {
csview sv = csview_from_s(&hello);
c_foreach (c, csview, sv)
- printf(c_PRIsv ",", c_ARGsv(c.codep));
+ printf("%" c_PRIsv ",", c_ARGsv(c.codep));
}
}