summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-08-17 21:45:14 +0200
committerGitHub <[email protected]>2020-08-17 21:45:14 +0200
commit14064aee8b9a8109ffcc8cea48f1a5969122a592 (patch)
tree4ea4d76c2ca744166fee96d6f41c938cfc56dd1d
parentb27630e52f64d5cd2e17ef1ddb98fcaa9709c8ac (diff)
downloadSTC-modified-14064aee8b9a8109ffcc8cea48f1a5969122a592.tar.gz
STC-modified-14064aee8b9a8109ffcc8cea48f1a5969122a592.zip
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!
-rw-r--r--README.md4
1 files 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 <stc/cstr.h>
#include <stc/cmap.h>