diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/cmap.h | 4 | ||||
| -rw-r--r-- | include/stc/cset.h | 2 | ||||
| -rw-r--r-- | include/stc/csmap.h | 20 | ||||
| -rw-r--r-- | include/stc/csset.h | 2 | ||||
| -rw-r--r-- | include/stc/cvec.h | 2 | ||||
| -rw-r--r-- | include/stc/template.h | 12 | ||||
| -rw-r--r-- | include/stc/test_new_deq.c | 4 | ||||
| -rw-r--r-- | include/stc/test_new_list.c | 4 | ||||
| -rw-r--r-- | include/stc/test_new_map.c | 2 | ||||
| -rw-r--r-- | include/stc/test_new_pque.c | 2 | ||||
| -rw-r--r-- | include/stc/test_new_queue.c | 2 | ||||
| -rw-r--r-- | include/stc/test_new_smap.c | 4 | ||||
| -rw-r--r-- | include/stc/test_new_vec.c | 4 |
13 files changed, 34 insertions, 30 deletions
diff --git a/include/stc/cmap.h b/include/stc/cmap.h index 6cf535e1..989335c1 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -61,7 +61,7 @@ typedef struct { size_t idx; uint_fast8_t hx; } chash_bucket_t; #ifndef i_prefix
#define i_prefix cmap_
#endif
-#ifdef cx_isset
+#ifdef i_isset
#define cx_MAP_ONLY c_false
#define cx_SET_ONLY c_true
#define cx_keyref(vp) (vp)
@@ -379,7 +379,7 @@ cx_memb(_erase_entry)(Self* self, cx_value_t* _val) { }
#endif // TEMPLATED IMPLEMENTATION
-#undef cx_isset
+#undef i_isset
#undef cx_keyref
#undef cx_MAP_ONLY
#undef cx_SET_ONLY
diff --git a/include/stc/cset.h b/include/stc/cset.h index 44e0808a..aa2ba022 100644 --- a/include/stc/cset.h +++ b/include/stc/cset.h @@ -42,5 +42,5 @@ int main(void) { #ifndef i_prefix
#define i_prefix cset_
#endif
-#define cx_isset
+#define i_isset
#include "cmap.h"
diff --git a/include/stc/csmap.h b/include/stc/csmap.h index 48a537d9..d52f70c4 100644 --- a/include/stc/csmap.h +++ b/include/stc/csmap.h @@ -62,7 +62,7 @@ struct csmap_rep { size_t root, disp, head, size, cap; void* nodes[]; }; #ifndef i_prefix
#define i_prefix csmap_
#endif
-#ifdef cx_isset
+#ifdef i_isset
#define cx_MAP_ONLY c_false
#define cx_SET_ONLY c_true
#define cx_keyref(vp) (vp)
@@ -384,13 +384,15 @@ cx_memb(_insert_entry_)(Self* self, i_keyraw rkey) { STC_DEF cx_size_t
cx_memb(_erase_r_)(cx_node_t *d, cx_size_t tn, const cx_rawkey_t* rkey, int *erased) {
- if (tn == 0) return 0;
+ if (tn == 0)
+ return 0;
i_keyraw raw = i_keyto(cx_keyref(&d[tn].value));
cx_size_t tx; int c = i_cmp(&raw, rkey);
if (c != 0)
d[tn].link[c < 0] = cx_memb(_erase_r_)(d, d[tn].link[c < 0], rkey, erased);
else {
- if (!(*erased)++) cx_memb(_value_del)(&d[tn].value);
+ if (!(*erased)++)
+ cx_memb(_value_del)(&d[tn].value);
if (d[tn].link[0] && d[tn].link[1]) {
tx = d[tn].link[0];
while (d[tx].link[1])
@@ -411,11 +413,11 @@ cx_memb(_erase_r_)(cx_node_t *d, cx_size_t tn, const cx_rawkey_t* rkey, int *era if (d[d[tn].link[0]].level < d[tn].level - 1 || d[tx].level < d[tn].level - 1) {
if (d[tx].level > --d[tn].level)
d[tx].level = d[tn].level;
- tn = cx_memb(_skew_)(d, tn);
- tx = d[tn].link[1] = cx_memb(_skew_)(d, d[tn].link[1]);
- d[tx].link[1] = cx_memb(_skew_)(d, d[tx].link[1]);
- tn = cx_memb(_split_)(d, tn);
- d[tn].link[1] = cx_memb(_split_)(d, d[tn].link[1]);
+ tn = cx_memb(_skew_)(d, tn);
+ tx = d[tn].link[1] = cx_memb(_skew_)(d, d[tn].link[1]);
+ d[tx].link[1] = cx_memb(_skew_)(d, d[tx].link[1]);
+ tn = cx_memb(_split_)(d, tn);
+ d[tn].link[1] = cx_memb(_split_)(d, d[tn].link[1]);
}
return tn;
}
@@ -488,7 +490,7 @@ cx_memb(_del)(Self* self) { }
#endif // IMPLEMENTATION
-#undef cx_isset
+#undef i_isset
#undef cx_keyref
#undef cx_MAP_ONLY
#undef cx_SET_ONLY
diff --git a/include/stc/csset.h b/include/stc/csset.h index d62526ec..ee06ec7f 100644 --- a/include/stc/csset.h +++ b/include/stc/csset.h @@ -45,5 +45,5 @@ int main(void) { #ifndef i_prefix
#define i_prefix csset_
#endif
-#define cx_isset
+#define i_isset
#include "csmap.h"
diff --git a/include/stc/cvec.h b/include/stc/cvec.h index 91df7213..607175d6 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -38,7 +38,7 @@ struct MyStruct { #define i_val_str // special for cstr
#include <stc/cvec.h>
-#define f_tag i32 // f: forward declared above; shorthand for i_fwd
+#define F_tag i32 // forward declared above; shorthand for i_fwd
#define i_val int
#include <stc/cvec.h>
diff --git a/include/stc/template.h b/include/stc/template.h index 062f6939..dc83c167 100644 --- a/include/stc/template.h +++ b/include/stc/template.h @@ -42,12 +42,12 @@ #define cx_size_t cx_memb(_size_t)
#endif
-#if defined f_tag
- #define i_tag f_tag
+#ifdef F_tag
+ #define i_tag F_tag
#define i_fwd
#endif
-#if defined i_key_str
+#ifdef i_key_str
#define i_key cstr
#define i_cmp c_rawstr_compare
#define i_equ c_rawstr_equals
@@ -57,7 +57,7 @@ #define i_keyto cstr_str
#define i_keyraw const char*
#endif
-#if defined i_val_str
+#ifdef i_val_str
#define i_val cstr
#ifndef i_key
#define i_cmp c_rawstr_compare
@@ -87,7 +87,7 @@ #error if i_keyraw defined, both i_keyfrom and i_keyto must be defined
#endif
-#if defined i_key
+#ifdef i_key
#if !defined i_keyfrom && defined i_keydel
#define i_keyfrom c_no_clone
#elif !defined i_keyfrom
@@ -130,7 +130,7 @@ #undef i_prefix
#undef i_tag
-#undef f_tag
+#undef F_tag
#undef i_imp
#undef i_fwd
#undef i_cmp
diff --git a/include/stc/test_new_deq.c b/include/stc/test_new_deq.c index 6c81714b..d1a5c2a6 100644 --- a/include/stc/test_new_deq.c +++ b/include/stc/test_new_deq.c @@ -10,7 +10,7 @@ struct MyStruct { } typedef MyStruct;
-#define f_tag i32
+#define F_tag i32
#define i_val int
#include <stc/cdeq.h>
@@ -19,7 +19,7 @@ int point_compare(const Point* a, const Point* b) { int c = c_default_compare(&a->x, &b->x);
return c ? c : c_default_compare(&a->y, &b->y);
}
-#define f_tag pnt
+#define F_tag pnt
#define i_val Point
#define i_cmp point_compare
#include <stc/cdeq.h>
diff --git a/include/stc/test_new_list.c b/include/stc/test_new_list.c index 764146b3..f0983b76 100644 --- a/include/stc/test_new_list.c +++ b/include/stc/test_new_list.c @@ -10,7 +10,7 @@ struct MyStruct { } typedef MyStruct; -#define f_tag i32 +#define F_tag i32 #define i_val int #include "clist.h" @@ -19,7 +19,7 @@ int point_compare(const Point* a, const Point* b) { int c = c_default_compare(&a->x, &b->x); return c ? c : c_default_compare(&a->y, &b->y); } -#define f_tag pnt +#define F_tag pnt #define i_val Point #define i_cmp point_compare #include "clist.h" diff --git a/include/stc/test_new_map.c b/include/stc/test_new_map.c index 25240ee3..2c4ee3bb 100644 --- a/include/stc/test_new_map.c +++ b/include/stc/test_new_map.c @@ -19,7 +19,7 @@ int point_compare(const Point* a, const Point* b) { int c = c_default_compare(&a->x, &b->x);
return c ? c : c_default_compare(&a->y, &b->y);
}
-#define f_tag pnt // f=forward declared
+#define F_tag pnt // F=forward declared
#define i_key Point
#define i_val int
#define i_cmp point_compare
diff --git a/include/stc/test_new_pque.c b/include/stc/test_new_pque.c index d9d66c09..b9750c44 100644 --- a/include/stc/test_new_pque.c +++ b/include/stc/test_new_pque.c @@ -19,7 +19,7 @@ int Point_cmp(const Point* a, const Point* b) { int c = c_default_compare(&a->x, &b->x);
return c ? c : c_default_compare(&a->y, &b->y);
}
-#define f_tag pnt // f: was forward declared.
+#define F_tag pnt // F: was forward declared.
#define i_val Point
#define i_cmp Point_cmp
#include "cpque.h"
diff --git a/include/stc/test_new_queue.c b/include/stc/test_new_queue.c index 32084b22..a76f4fde 100644 --- a/include/stc/test_new_queue.c +++ b/include/stc/test_new_queue.c @@ -9,7 +9,7 @@ int point_compare(const Point* a, const Point* b) { int c = c_default_compare(&a->x, &b->x);
return c ? c : c_default_compare(&a->y, &b->y);
}
-#define f_tag pnt
+#define F_tag pnt
#define i_val Point
#define i_cmp point_compare
#include <stc/cqueue.h>
diff --git a/include/stc/test_new_smap.c b/include/stc/test_new_smap.c index bcb83c61..033749ce 100644 --- a/include/stc/test_new_smap.c +++ b/include/stc/test_new_smap.c @@ -19,7 +19,9 @@ int point_compare(const Point* a, const Point* b) { int c = c_default_compare(&a->x, &b->x);
return c ? c : c_default_compare(&a->y, &b->y);
}
-#define f_tag pnt // f=forward declared
+
+#define i_fwd
+#define i_tag pnt
#define i_key Point
#define i_val int
#define i_cmp point_compare
diff --git a/include/stc/test_new_vec.c b/include/stc/test_new_vec.c index 88c71679..ae1fd155 100644 --- a/include/stc/test_new_vec.c +++ b/include/stc/test_new_vec.c @@ -10,7 +10,7 @@ struct MyStruct { } typedef MyStruct;
-#define f_tag i32
+#define F_tag i32
#define i_val int
#include <stc/cvec.h>
@@ -19,7 +19,7 @@ int point_compare(const Point* a, const Point* b) { int c = c_default_compare(&a->x, &b->x);
return c ? c : c_default_compare(&a->y, &b->y);
}
-#define f_tag pnt
+#define F_tag pnt
#define i_val Point
#define i_cmp point_compare
#include <stc/cvec.h>
|
