summaryrefslogtreecommitdiffhomepage
path: root/examples/svmap.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-06-11 16:38:06 +0200
committerTyge Løvset <[email protected]>2021-06-11 16:38:06 +0200
commitb8f24b90481d83d06ae89e2594c249c9741dae21 (patch)
tree84e8c3807f97221435ec5191e17fb0e8b78e483e /examples/svmap.c
parentc7944e2ddb51819dfaee9dd8d3708df54bd5a5d1 (diff)
downloadSTC-modified-b8f24b90481d83d06ae89e2594c249c9741dae21.tar.gz
STC-modified-b8f24b90481d83d06ae89e2594c249c9741dae21.zip
Improve naming of c_sv() and c_lit() in csview.h: Rename c_sv(cstr) => cstr_sv(cstr), and c_lit(string literal) => c_sv(string literal). Hopefully not too much used yet, as they are fairly new.
Diffstat (limited to 'examples/svmap.c')
-rw-r--r--examples/svmap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/svmap.c b/examples/svmap.c
index 769913df..d0f84ce4 100644
--- a/examples/svmap.c
+++ b/examples/svmap.c
@@ -6,7 +6,7 @@
using_cmap_strvkey(si, int);
int main() {
- csview fox = c_lit("The quick brown fox jumps over the lazy dog.");
+ csview fox = c_sv("The quick brown fox jumps over the lazy dog.");
printf("\"%s\", length=%zu\n", fox.str, fox.size);
c_forvar_initdel (cmap_si, frequencies)
@@ -18,13 +18,13 @@ int main() {
// Emplace: csview element API
const char* key = "hundred";
- cmap_si_emplace(&frequencies, c_lit("hundred"), 300); // c_lit() shorthand for csview_lit()
+ cmap_si_emplace(&frequencies, c_sv("hundred"), 300); // c_sv() shorthand for csview_lit()
cmap_si_emplace(&frequencies, csview_from_n(key, 4), 400); // insert "hund"
cmap_si_emplace_or_assign(&frequencies, csview_from(key), 500); // update
- cmap_si_emplace(&frequencies, c_lit("hundred"), 600); // ignored, already inserted
+ cmap_si_emplace(&frequencies, c_sv("hundred"), 600); // ignored, already inserted
// Lookup always uses "raw" type API, i.e. csview here.
- printf("at(\"hundred\"): %d\n", *cmap_si_at(&frequencies, c_lit("hundred")));
+ printf("at(\"hundred\"): %d\n", *cmap_si_at(&frequencies, c_sv("hundred")));
c_foreach (i, cmap_si, frequencies)
printf("%s: %d\n", i.ref->first.str, i.ref->second);