diff options
| author | Tyge Løvset <[email protected]> | 2020-08-17 21:45:14 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-08-17 21:45:14 +0200 |
| commit | 14064aee8b9a8109ffcc8cea48f1a5969122a592 (patch) | |
| tree | 4ea4d76c2ca744166fee96d6f41c938cfc56dd1d | |
| parent | b27630e52f64d5cd2e17ef1ddb98fcaa9709c8ac (diff) | |
| download | STC-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.md | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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>
|
