summaryrefslogtreecommitdiffhomepage
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
parent23f0ae51477c08d7329b98f1440ae9cccaccb823 (diff)
downloadSTC-modified-0a949f2f34131da55d213ab2081bc9348d24f708.tar.gz
STC-modified-0a949f2f34131da55d213ab2081bc9348d24f708.zip
Fixed: renamed reserved symbols/names.
-rw-r--r--examples/advanced.c10
-rw-r--r--examples/csmap_v1.h10
-rw-r--r--stc/carray.h4
-rw-r--r--stc/cbits.h4
-rw-r--r--stc/ccommon.h22
-rw-r--r--stc/cdeq.h4
-rw-r--r--stc/clist.h4
-rw-r--r--stc/cmap.h8
-rw-r--r--stc/coption.h4
-rw-r--r--stc/cpque.h4
-rw-r--r--stc/cptr.h4
-rw-r--r--stc/cqueue.h4
-rw-r--r--stc/crandom.h4
-rw-r--r--stc/cset.h4
-rw-r--r--stc/csmap.h8
-rw-r--r--stc/csset.h4
-rw-r--r--stc/cstack.h4
-rw-r--r--stc/cstr.h4
-rw-r--r--stc/cvec.h4
19 files changed, 57 insertions, 57 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*)
diff --git a/stc/carray.h b/stc/carray.h
index 7a49de50..28b6df94 100644
--- a/stc/carray.h
+++ b/stc/carray.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CARRAY__H__
-#define CARRAY__H__
+#ifndef CARRAY_H_INCLUDED
+#define CARRAY_H_INCLUDED
#include <stdlib.h>
#include "ccommon.h"
diff --git a/stc/cbits.h b/stc/cbits.h
index 8bd30aaa..bf62bd39 100644
--- a/stc/cbits.h
+++ b/stc/cbits.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CBITSET__H__
-#define CBITSET__H__
+#ifndef CBITSET_H_INCLUDED
+#define CBITSET_H_INCLUDED
/*
Similar to boost::dynamic_bitset / std::bitset
diff --git a/stc/ccommon.h b/stc/ccommon.h
index 15a7ecdf..46ef6238 100644
--- a/stc/ccommon.h
+++ b/stc/ccommon.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CCOMMON__H__
-#define CCOMMON__H__
+#ifndef CCOMMON_H_INCLUDED
+#define CCOMMON_H_INCLUDED
#define __USE_MINGW_ANSI_STDIO 1
@@ -75,7 +75,7 @@
#define c_free(p) free(p)
#endif
-#define c_swap(T, x, y) do { T __t = x; x = y; y = __t; } while (0)
+#define c_swap(T, x, y) do { T _c_t = x; x = y; y = _c_t; } while (0)
#define c_arraylen(a) (sizeof (a)/sizeof (a)[0])
#define c_default_compare(x, y) (c_default_less(y, x) - c_default_less(x, y))
@@ -110,23 +110,23 @@
#define c_withfile(f, open) for (FILE *f = open; f; fclose(f), f = NULL)
#define c_withbuffer(b, type, n) c_withbuffer_x(b, type, n, 256)
#define c_withbuffer_x(b, type, n, BYTES) \
- for (type __b[((BYTES) - 1) / sizeof(type) + 1], \
- *b = (n) * sizeof *b > (BYTES) ? c_new_2(type, n) : __b; \
- b; b != __b ? c_free(b) : (void)0, b = NULL)
+ for (type _c_b[((BYTES) - 1) / sizeof(type) + 1], \
+ *b = (n) * sizeof *b > (BYTES) ? c_new_2(type, n) : _c_b; \
+ b; b != _c_b ? c_free(b) : (void)0, b = NULL)
#define c_breakwith continue
#define c_init(ctype, c, ...) \
ctype c = ctype##_init(); c_emplace_items(&c, ctype, __VA_ARGS__)
#define c_emplace_items(self, ctype, ...) do { \
- const ctype##_rawvalue_t __arr[] = __VA_ARGS__; \
- ctype##_emplace_n(self, __arr, c_arraylen(__arr)); \
+ const ctype##_rawvalue_t _c_arr[] = __VA_ARGS__; \
+ ctype##_emplace_n(self, _c_arr, c_arraylen(_c_arr)); \
} while (0)
#define c_del(ctype, ...) do { \
- ctype* __arr[] = {__VA_ARGS__}; \
- for (size_t __i = 0; __i < c_arraylen(__arr); ++__i) \
- ctype##_del(__arr[__i]); \
+ ctype* _c_arr[] = {__VA_ARGS__}; \
+ for (size_t _c_i = 0; _c_i < c_arraylen(_c_arr); ++_c_i) \
+ ctype##_del(_c_arr[_c_i]); \
} while (0)
#if defined(__SIZEOF_INT128__)
diff --git a/stc/cdeq.h b/stc/cdeq.h
index 3d693e3b..34d30360 100644
--- a/stc/cdeq.h
+++ b/stc/cdeq.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CDEQ__H__
-#define CDEQ__H__
+#ifndef CDEQ_H_INCLUDED
+#define CDEQ_H_INCLUDED
#include "ccommon.h"
#include <stdlib.h>
diff --git a/stc/clist.h b/stc/clist.h
index 82fa6de2..41b2c5d4 100644
--- a/stc/clist.h
+++ b/stc/clist.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CLIST__H__
-#define CLIST__H__
+#ifndef CLIST_H_INCLUDED
+#define CLIST_H_INCLUDED
/* Circular Singly-linked Lists.
diff --git a/stc/cmap.h b/stc/cmap.h
index 6300a46a..f2524110 100644
--- a/stc/cmap.h
+++ b/stc/cmap.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CMAP__H__
-#define CMAP__H__
+#ifndef CMAP_H_INCLUDED
+#define CMAP_H_INCLUDED
// Unordered set/map - implemented as closed hashing with linear probing and no tombstones.
/*
@@ -109,12 +109,12 @@ typedef struct {size_t idx; uint_fast8_t hx;} chash_bucket_t;
#define using_cset_8(X, Key, keyEqualsRaw, keyHashRaw, keyDel, keyFromRaw, keyToRaw, RawKey) \
_using_CHASH(X, cset, Key, Key, keyEqualsRaw, keyHashRaw, \
- _UNUSED_, _UNUSED_, _UNUSED_, void, \
+ @@, @@, @@, void, \
keyDel, keyFromRaw, keyToRaw, RawKey)
/* cset_str, cmap_str, cmap_strkey, cmap_strval: */
#define using_cset_str() \
- _using_CHASH_strkey(str, cset, cstr_t, _UNUSED_, _UNUSED_, _UNUSED_, void)
+ _using_CHASH_strkey(str, cset, cstr_t, @@, @@, @@, void)
#define using_cmap_str() \
_using_CHASH(str, cmap, cstr_t, cstr_t, cstr_equals_raw, cstr_hash_raw, \
cstr_del, cstr_from, cstr_c_str, const char*, \
diff --git a/stc/coption.h b/stc/coption.h
index 27ec880b..6bc4e8ca 100644
--- a/stc/coption.h
+++ b/stc/coption.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef COPTION__H__
-#define COPTION__H__
+#ifndef COPTION_H_INCLUDED
+#define COPTION_H_INCLUDED
/*
// Inspired by https://attractivechaos.wordpress.com/2018/08/31/a-survey-of-argument-parsing-libraries-in-c-c
diff --git a/stc/cpque.h b/stc/cpque.h
index f1bf7529..1ebf5791 100644
--- a/stc/cpque.h
+++ b/stc/cpque.h
@@ -44,8 +44,8 @@
cpque_f_del(&queue);
}
*/
-#ifndef CPQUEUE__H__
-#define CPQUEUE__H__
+#ifndef CPQUEUE_H_INCLUDED
+#define CPQUEUE_H_INCLUDED
#include "cvec.h"
diff --git a/stc/cptr.h b/stc/cptr.h
index 6c684ccc..43439e85 100644
--- a/stc/cptr.h
+++ b/stc/cptr.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CPTR__H__
-#define CPTR__H__
+#ifndef CPTR_H_INCLUDED
+#define CPTR_H_INCLUDED
/* cptr: std::unique_ptr -like type */
/*
diff --git a/stc/cqueue.h b/stc/cqueue.h
index 832e68de..50fe929a 100644
--- a/stc/cqueue.h
+++ b/stc/cqueue.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CQUEUE__H__
-#define CQUEUE__H__
+#ifndef CQUEUE_H_INCLUDED
+#define CQUEUE_H_INCLUDED
/* Queue adapter, default uses clist.
diff --git a/stc/crandom.h b/stc/crandom.h
index 5734be26..bf256d17 100644
--- a/stc/crandom.h
+++ b/stc/crandom.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CRANDOM__H__
-#define CRANDOM__H__
+#ifndef CRANDOM_H_INCLUDED
+#define CRANDOM_H_INCLUDED
/*
// crandom: Pseudo-random number generator
diff --git a/stc/cset.h b/stc/cset.h
index e025bb45..9cbe6c9e 100644
--- a/stc/cset.h
+++ b/stc/cset.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CSET__H__
-#define CSET__H__
+#ifndef CSET_H_INCLUDED
+#define CSET_H_INCLUDED
// Unordered set - implemented as closed hashing with linear probing and no tombstones.
diff --git a/stc/csmap.h b/stc/csmap.h
index 350e0df2..0184f053 100644
--- a/stc/csmap.h
+++ b/stc/csmap.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.
/*
@@ -91,12 +91,12 @@ int main(void) {
#define using_csset_7(X, Key, keyCompareRaw, keyDel, keyFromRaw, keyToRaw, RawKey) \
_using_AATREE(X, csset, Key, Key, keyCompareRaw, \
- _UNUSED_, _UNUSED_, _UNUSED_, void, \
+ @@, @@, @@, void, \
keyDel, keyFromRaw, keyToRaw, RawKey)
/* csset_str, csmap_str, csmap_strkey, csmap_strval: */
#define using_csset_str() \
- _using_AATREE_strkey(str, csset, cstr_t, _UNUSED_, _UNUSED_, _UNUSED_, void)
+ _using_AATREE_strkey(str, csset, cstr_t, @@, @@, @@, void)
#define using_csmap_str() \
_using_AATREE(str, csmap, cstr_t, cstr_t, cstr_compare_raw, \
cstr_del, cstr_from, cstr_c_str, const char*, \
diff --git a/stc/csset.h b/stc/csset.h
index 0f11e65f..24150d52 100644
--- a/stc/csset.h
+++ b/stc/csset.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CSSET__H__
-#define CSSET__H__
+#ifndef CSSET_H_INCLUDED
+#define CSSET_H_INCLUDED
// Sorted set - implemented as an AA-tree (balanced binary tree).
diff --git a/stc/cstack.h b/stc/cstack.h
index ecfc00be..d093ddcf 100644
--- a/stc/cstack.h
+++ b/stc/cstack.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CSTACK__H__
-#define CSTACK__H__
+#ifndef CSTACK_H_INCLUDED
+#define CSTACK_H_INCLUDED
/* Stack adapter, default uses cvec.
diff --git a/stc/cstr.h b/stc/cstr.h
index 2ba66dd4..11951902 100644
--- a/stc/cstr.h
+++ b/stc/cstr.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CSTR__H__
-#define CSTR__H__
+#ifndef CSTR_H_INCLUDED
+#define CSTR_H_INCLUDED
#include "ccommon.h"
#include <stdlib.h> /* malloc */
diff --git a/stc/cvec.h b/stc/cvec.h
index c977ddcf..69b90d10 100644
--- a/stc/cvec.h
+++ b/stc/cvec.h
@@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef CVEC__H__
-#define CVEC__H__
+#ifndef CVEC_H_INCLUDED
+#define CVEC_H_INCLUDED
#include "ccommon.h"
#include <stdlib.h>