summaryrefslogtreecommitdiffhomepage
path: root/docs/cvec_api.md
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-04-24 23:53:56 +0200
committerTyge Løvset <[email protected]>2022-04-24 23:53:56 +0200
commit1ebbd367675a4a25c82b27da75301846fa315f4c (patch)
tree53c2947afaac64ac6505d45bd577a9843241f029 /docs/cvec_api.md
parent81b541b85f85b48660ceb461b851f1fb09d68344 (diff)
downloadSTC-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.md8
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
}