diff options
| author | tylo <[email protected]> | 2021-09-15 10:11:48 +0200 |
|---|---|---|
| committer | tylo <[email protected]> | 2021-09-15 10:11:48 +0200 |
| commit | e3f877b8327417cf212d66c156b40c70bdc11b6e (patch) | |
| tree | 247b0ce7a05177158413be0dcb43a6f6b5f6219b | |
| parent | d716acdc8289dd60c394c568b5ef3f88700a855c (diff) | |
| download | STC-modified-e3f877b8327417cf212d66c156b40c70bdc11b6e.tar.gz STC-modified-e3f877b8327417cf212d66c156b40c70bdc11b6e.zip | |
Fixed issue with using i_prefix as indicator of cset/csset.
| -rw-r--r-- | include/stc/cmap.h | 15 | ||||
| -rw-r--r-- | include/stc/cset.h | 4 | ||||
| -rw-r--r-- | include/stc/csmap.h | 13 | ||||
| -rw-r--r-- | include/stc/csset.h | 4 |
4 files changed, 23 insertions, 13 deletions
diff --git a/include/stc/cmap.h b/include/stc/cmap.h index 587b3887..6cf535e1 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -60,9 +60,15 @@ typedef struct { size_t idx; uint_fast8_t hx; } chash_bucket_t; #ifndef i_prefix
#define i_prefix cmap_
-#define cx_MAP_ONLY c_true
-#define cx_SET_ONLY c_false
-#define cx_keyref(vp) (&(vp)->first)
+#endif
+#ifdef cx_isset
+ #define cx_MAP_ONLY c_false
+ #define cx_SET_ONLY c_true
+ #define cx_keyref(vp) (vp)
+#else
+ #define cx_MAP_ONLY c_true
+ #define cx_SET_ONLY c_false
+ #define cx_keyref(vp) (&(vp)->first)
#endif
#include "template.h"
#ifndef i_fwd
@@ -373,8 +379,9 @@ cx_memb(_erase_entry)(Self* self, cx_value_t* _val) { }
#endif // TEMPLATED IMPLEMENTATION
+#undef cx_isset
#undef cx_keyref
#undef cx_MAP_ONLY
#undef cx_SET_ONLY
#include "template.h"
-#define CMAP_H_INCLUDED
\ No newline at end of file +#define CMAP_H_INCLUDED
diff --git a/include/stc/cset.h b/include/stc/cset.h index 2861ce89..44e0808a 100644 --- a/include/stc/cset.h +++ b/include/stc/cset.h @@ -42,7 +42,5 @@ int main(void) { #ifndef i_prefix
#define i_prefix cset_
#endif
-#define cx_MAP_ONLY c_false
-#define cx_SET_ONLY c_true
-#define cx_keyref(vp) (vp)
+#define cx_isset
#include "cmap.h"
diff --git a/include/stc/csmap.h b/include/stc/csmap.h index e176fc58..48a537d9 100644 --- a/include/stc/csmap.h +++ b/include/stc/csmap.h @@ -61,9 +61,15 @@ struct csmap_rep { size_t root, disp, head, size, cap; void* nodes[]; }; #ifndef i_prefix
#define i_prefix csmap_
-#define cx_MAP_ONLY c_true
-#define cx_SET_ONLY c_false
-#define cx_keyref(vp) (&(vp)->first)
+#endif
+#ifdef cx_isset
+ #define cx_MAP_ONLY c_false
+ #define cx_SET_ONLY c_true
+ #define cx_keyref(vp) (vp)
+#else
+ #define cx_MAP_ONLY c_true
+ #define cx_SET_ONLY c_false
+ #define cx_keyref(vp) (&(vp)->first)
#endif
#include "template.h"
@@ -482,6 +488,7 @@ cx_memb(_del)(Self* self) { }
#endif // IMPLEMENTATION
+#undef cx_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 19cf147c..d62526ec 100644 --- a/include/stc/csset.h +++ b/include/stc/csset.h @@ -45,7 +45,5 @@ int main(void) { #ifndef i_prefix
#define i_prefix csset_
#endif
-#define cx_MAP_ONLY c_false
-#define cx_SET_ONLY c_true
-#define cx_keyref(vp) (vp)
+#define cx_isset
#include "csmap.h"
|
