summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-03-02 14:10:23 +0100
committerTyge Løvset <[email protected]>2021-03-02 14:10:23 +0100
commit0a949f2f34131da55d213ab2081bc9348d24f708 (patch)
tree82af914b54e1f0e8dbc44e6a1287a32dd173a4dd /examples
parent23f0ae51477c08d7329b98f1440ae9cccaccb823 (diff)
downloadSTC-modified-0a949f2f34131da55d213ab2081bc9348d24f708.tar.gz
STC-modified-0a949f2f34131da55d213ab2081bc9348d24f708.zip
Fixed: renamed reserved symbols/names.
Diffstat (limited to 'examples')
-rw-r--r--examples/advanced.c10
-rw-r--r--examples/csmap_v1.h10
2 files changed, 10 insertions, 10 deletions
diff --git a/examples/advanced.c b/examples/advanced.c
index 728e056f..f2f2e756 100644
--- a/examples/advanced.c
+++ b/examples/advanced.c
@@ -47,13 +47,13 @@ int main()
{ {"Olaf", "Denmark"}, 24},
{ {"Harald", "Iceland"}, 12},
});
- cmap_vk_emplace_or_assign(&vikings, (VikingRaw){"Bjorn", "Sweden"}, 10);
+ VikingRaw bjorn = {"Bjorn", "Sweden"};
+ cmap_vk_emplace_or_assign(&vikings, bjorn, 10);
- VikingRaw lookup = {"Einar", "Norway"};
-
- cmap_vk_value_t *e = cmap_vk_find(&vikings, lookup).ref;
+ VikingRaw einar = {"Einar", "Norway"};
+ cmap_vk_value_t *e = cmap_vk_find(&vikings, einar).ref;
e->second += 3; // add 3 hp points to Einar
- cmap_vk_emplace(&vikings, lookup, 0).first->second += 5; // add 5 more to Einar
+ cmap_vk_emplace(&vikings, einar, 0).first->second += 5; // add 5 more to Einar
c_foreach (k, cmap_vk, vikings) {
printf("%s of %s has %d hp\n", k.ref->first.name.str, k.ref->first.country.str, k.ref->second);
diff --git a/examples/csmap_v1.h b/examples/csmap_v1.h
index 94687dd2..1678c76f 100644
--- a/examples/csmap_v1.h
+++ b/examples/csmap_v1.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CSMAP__H__
-#define CSMAP__H__
+#ifndef CSMAP_H_INCLUDED
+#define CSMAP_H_INCLUDED
// Sorted/Ordered set and map - implemented as an AA-tree.
/*
@@ -78,12 +78,12 @@ int main(void) {
using_csset_7(X, Key, keyCompare, keyDel, keyClone, c_trivial_toraw, Key)
#define using_csset_7(X, Key, keyCompareRaw, keyDel, keyFromRaw, keyToRaw, RawKey) \
- _using_CBST(X, csset, Key, Key, keyCompareRaw, _UNUSED_, keyDel, \
- keyFromRaw, keyToRaw, RawKey, _UNUSED_, _UNUSED_, void)
+ _using_CBST(X, csset, Key, Key, keyCompareRaw, @@, keyDel, \
+ keyFromRaw, keyToRaw, RawKey, @@, @@, void)
/* csset_str, csmap_str, csmap_strkey, csmap_strval: */
#define using_csset_str() \
- _using_CBST_strkey(str, csset, cstr_t, _UNUSED_, _UNUSED_)
+ _using_CBST_strkey(str, csset, cstr_t, @@, @@)
#define using_csmap_str() \
_using_CBST(str, csmap, cstr_t, cstr_t, cstr_compare_raw, cstr_del, cstr_del, \
cstr_from, cstr_c_str, const char*, cstr_from, cstr_c_str, const char*)