diff options
| author | Tyge Løvset <[email protected]> | 2020-10-14 23:14:02 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-10-14 23:14:02 +0200 |
| commit | 47190a51588341d0ab715398ded6a480bc4fa95a (patch) | |
| tree | 2f48b0cb83d6bd06506806e4a78f98f2fc19ed19 /examples/share_ptr.c | |
| parent | 48b5199a2ff5a31349bcff2d3ff70cb1d31a3f9f (diff) | |
| download | STC-modified-47190a51588341d0ab715398ded6a480bc4fa95a.tar.gz STC-modified-47190a51588341d0ab715398ded6a480bc4fa95a.zip | |
Renamed cstr() constructor to cstr_from(), cstr_from() to cstr_from_fmt().
Diffstat (limited to 'examples/share_ptr.c')
| -rw-r--r-- | examples/share_ptr.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/share_ptr.c b/examples/share_ptr.c index 28f1975c..5dd52d19 100644 --- a/examples/share_ptr.c +++ b/examples/share_ptr.c @@ -7,7 +7,7 @@ typedef struct { cstr_t name, last; } Person;
Person* Person_make(Person* p, const char* name, const char* last) {
- p->name = cstr(name), p->last = cstr(last);
+ p->name = cstr_from(name), p->last = cstr_from(last);
return p;
}
void Person_del(Person* p) {
@@ -27,15 +27,15 @@ int main() { clist_pe queue = clist_pe_init();
cvec_pe vec = cvec_pe_init();
- csptr_pe joe = csptr_pe_make((Person) {cstr("Joe"), cstr("Jordan")});
+ csptr_pe joe = csptr_pe_make((Person) {cstr_from("Joe"), cstr_from("Jordan")});
clist_pe_push_back(&queue, csptr_pe_share(joe));
cvec_pe_push_back(&vec, csptr_pe_share(joe));
puts("Push 10:");
c_forrange (i, 10) {
csptr_pe p = csptr_pe_from(c_new(Person));
- p.get->name = cstr_from("Name %d", (i * 7) % 10);
- p.get->last = cstr_from("Last %d", (i * 7) % 10);
+ p.get->name = cstr_from_fmt("Name %d", (i * 7) % 10);
+ p.get->last = cstr_from_fmt("Last %d", (i * 7) % 10);
clist_pe_push_back(&queue, p);
cvec_pe_push_back(&vec, csptr_pe_share(p)); // Don't forget to share!
}
|
