diff options
| -rw-r--r-- | README.md | 24 | ||||
| -rw-r--r-- | stc/clist.h | 4 | ||||
| -rw-r--r-- | stc/cvec.h | 4 |
3 files changed, 16 insertions, 16 deletions
@@ -221,16 +221,16 @@ int main() { ```
#include <stc/cstr.h>
#include <stc/cvec.h>
-declare_CVec_str(cs);
+declare_CVec_str();
int main() {
- CVec_cs names = cvec_init;
- cvec_cs_pushBack(&names, cstr_make("Mary"));
- cvec_cs_pushBack(&names, cstr_make("Joe"));
+ CVec_str names = cvec_init;
+ cvec_str_pushBack(&names, cstr_make("Mary"));
+ cvec_str_pushBack(&names, cstr_make("Joe"));
cstr_assign(&names.data[1], cstr_make("Jake")); // replace Joe
printf("%s\n", names.data[1].str); // Access the string char*
- cvec_cs_destroy(&names);
+ cvec_str_destroy(&names);
}
```
**CMap** of *int -> int*
@@ -252,18 +252,18 @@ int main() { ```
#include <stc/cstr.h>
#include <stc/cmap.h>
-declare_CSet_str(s); // CStr set. See the discussion above.
+declare_CSet_str(); // CStr set. See the discussion above.
int main() {
- CSet_s words = cset_init;
- cset_s_put(&words, "Hello");
- cset_s_put(&words, "Groovy");
- cset_s_erase(&words, "Hello");
+ CSet_str words = cset_init;
+ cset_str_put(&words, "Hello");
+ cset_str_put(&words, "Groovy");
+ cset_str_erase(&words, "Hello");
// iterate the map:
- c_foreach (i, cset_s, words)
+ c_foreach (i, cset_str, words)
printf("%s\n", i.item->key.str);
- cset_s_destroy(&words);
+ cset_str_destroy(&words);
}
```
**CMap** of *CStr -> CStr*. Temporary CStr values are created by *cstr_make()*, and moved into the container
diff --git a/stc/clist.h b/stc/clist.h index 24353af1..8577fc40 100644 --- a/stc/clist.h +++ b/stc/clist.h @@ -60,8 +60,8 @@ declare_CList_4(tag, Value, valueDestroy, c_defaultCompare)
#define declare_CList_4(tag, Value, valueDestroy, valueCompare) \
declare_CList_6(tag, Value, valueDestroy, Value, valueCompare, c_defaultGetRaw)
-#define declare_CList_str(tag) \
- declare_CList_6(tag, CStr, cstr_destroy, const char*, cstr_compareRaw, cstr_getRaw)
+#define declare_CList_str() \
+ declare_CList_6(str, CStr, cstr_destroy, const char*, cstr_compareRaw, cstr_getRaw)
#define declare_CListTypes(tag, Value) \
typedef struct CListNode_##tag { \
@@ -39,8 +39,8 @@ declare_CVec_4(tag, Value, valueDestroy, c_defaultCompare)
#define declare_CVec_4(tag, Value, valueDestroy, valueCompare) \
declare_CVec_6(tag, Value, valueDestroy, valueCompare, Value, c_defaultGetRaw)
-#define declare_CVec_str(tag) \
- declare_CVec_6(tag, CStr, cstr_destroy, cstr_compareRaw, const char*, cstr_getRaw)
+#define declare_CVec_str() \
+ declare_CVec_6(str, CStr, cstr_destroy, cstr_compareRaw, const char*, cstr_getRaw)
#define declare_CVec_6(tag, Value, valueDestroy, valueCompareRaw, RawValue, valueGetRaw) \
|
