diff options
| author | Tyge Løvset <[email protected]> | 2022-04-24 23:53:56 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-04-24 23:53:56 +0200 |
| commit | 1ebbd367675a4a25c82b27da75301846fa315f4c (patch) | |
| tree | 53c2947afaac64ac6505d45bd577a9843241f029 /docs/cvec_api.md | |
| parent | 81b541b85f85b48660ceb461b851f1fb09d68344 (diff) | |
| download | STC-modified-1ebbd367675a4a25c82b27da75301846fa315f4c.tar.gz STC-modified-1ebbd367675a4a25c82b27da75301846fa315f4c.zip | |
Updated docs to use cstr_str(&s) instead of s.str
Diffstat (limited to 'docs/cvec_api.md')
| -rw-r--r-- | docs/cvec_api.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/cvec_api.md b/docs/cvec_api.md index e02a944e..f5dd11ae 100644 --- a/docs/cvec_api.md +++ b/docs/cvec_api.md @@ -161,10 +161,10 @@ int main() { // emplace() will not compile if adding a new cstr type. Use push_back(): cvec_str_push(&names, tmp); // tmp is moved to names, do not drop() it. - printf("%s\n", names.data[1].str); // Access the second element + printf("%s\n", cstr_str(&names.data[1])); // Access the second element c_foreach (i, cvec_str, names) - printf("item: %s\n", i.ref->str); + printf("item: %s\n", cstr_str(i.ref)); cvec_str_drop(&names); } ``` @@ -187,7 +187,7 @@ typedef struct { } User; int User_cmp(const User* a, const User* b) { - int c = strcmp(a->name.str, b->name.str); + int c = strcmp(cstr_str(&a->name), cstr_str(&b->name)); return c != 0 ? c : a->id - b->id; } void User_drop(User* self) { @@ -214,7 +214,7 @@ int main(void) { cvec_u vec2 = cvec_u_clone(vec); c_foreach (i, cvec_u, vec2) - printf("%s: %d\n", i.ref->name.str, i.ref->id); + printf("%s: %d\n", cstr_str(&i.ref->name), i.ref->id); c_drop(cvec_u, &vec, &vec2); // cleanup } |
