From 14064aee8b9a8109ffcc8cea48f1a5969122a592 Mon Sep 17 00:00:00 2001 From: Tyge Løvset <60263450+tylov@users.noreply.github.com> Date: Mon, 17 Aug 2020 21:45:14 +0200 Subject: Fixed bug in README.md cstr_t demo. cstr_assign_s() / cstr_append_s() COPIES the input stream, so don't use cstr_make(). Meant to take owned cstr_t only! --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8ab5acbf..9a2e74b1 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,7 @@ int main() { cvec_str names = cvec_init; cvec_str_push_back(&names, cstr_make("Mary")); cvec_str_push_back(&names, cstr_make("Joe")); - cstr_assign(&names.data[1], cstr_make("Jake")); // replace Joe + cstr_assign(&names.data[1], "Jake"); // replace "Joe". printf("%s\n", names.data[1].str); // Access the string char* c_foreach (i, cvec_str, names) @@ -246,7 +246,7 @@ int main() { cset_str_destroy(&words); } ``` -**cmap** of *cstr -> cstr*. Temporary cstr values are created by *cstr_make()*, and moved into the container +**cmap** of *cstr -> cstr*. cstr keys are created internally via *cstr_make()* from const char* key input. ``` #include #include -- cgit v1.2.3