summaryrefslogtreecommitdiffhomepage
path: root/examples/new_sptr.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-04-18 00:44:51 +0200
committerTyge Løvset <[email protected]>2022-04-18 00:44:51 +0200
commit00804d9ff488f63468a0bb528c7b807aea7c3ea3 (patch)
tree51b47787adc853bd1a10ec820a6ef5c184fa2498 /examples/new_sptr.c
parent4436a1c0ac37dc2e73a2134d5ad85c010340b35d (diff)
downloadSTC-modified-00804d9ff488f63468a0bb528c7b807aea7c3ea3.tar.gz
STC-modified-00804d9ff488f63468a0bb528c7b807aea7c3ea3.zip
Converted all example to use cstr_str(&s) instead of s.str to allow SSO string. Fixed misc warnings.
Diffstat (limited to 'examples/new_sptr.c')
-rw-r--r--examples/new_sptr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/new_sptr.c b/examples/new_sptr.c
index 61eaf5ae..2fb058df 100644
--- a/examples/new_sptr.c
+++ b/examples/new_sptr.c
@@ -10,7 +10,7 @@ Person Person_clone(Person p) {
return p;
}
void Person_drop(Person* p) {
- printf("drop: %s %s\n", p->name.str, p->last.str);
+ printf("drop: %s %s\n", cstr_str(&p->name), cstr_str(&p->last));
c_drop(cstr, &p->name, &p->last);
}
@@ -37,7 +37,7 @@ int main(void) {
q = carc_person_clone(p);
r = carc_person_clone(p);
s = carc_person_from(Person_clone(*p.get)); // deep copy
- printf("%s %s. uses: %lu\n", r.get->name.str, s.get->last.str, *p.use_count);
+ printf("%s %s. uses: %lu\n", cstr_str(&r.get->name), cstr_str(&s.get->last), *p.use_count);
}
c_auto (cstack_iptr, stk) {