diff options
| author | Tyge Løvset <[email protected]> | 2020-03-26 09:15:50 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-03-26 09:15:50 +0100 |
| commit | 0c5eab4bb2167588fbd33d12a0d84bd9ede0c097 (patch) | |
| tree | 59fdbc5cf8b7599b1031361bc38045fcea562930 | |
| parent | 044655f4b953253ff02eec09dee5e7a584b9d6e5 (diff) | |
| download | STC-modified-0c5eab4bb2167588fbd33d12a0d84bd9ede0c097.tar.gz STC-modified-0c5eab4bb2167588fbd33d12a0d84bd9ede0c097.zip | |
Add files via upload
| -rw-r--r-- | c_lib/cdefs.h | 2 | ||||
| -rw-r--r-- | c_lib/cmap.h | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/c_lib/cdefs.h b/c_lib/cdefs.h index 4c76cefd..54244d40 100644 --- a/c_lib/cdefs.h +++ b/c_lib/cdefs.h @@ -47,7 +47,7 @@ #define c_defaultInitRaw(x) (x)
#define c_defaultGetRaw(x) (x)
#define c_defaultCompare(x, y) (*(x) == *(y) ? 0 : *(x) < *(y) ? -1 : 1)
-#define c_defaultEquals(x, y) (*(x) == *(y))
+#define c_defaultEquals(x, y) (memcmp(x, y, sizeof(*(y))) == 0)
static inline void c_defaultDestroy(void* value) {}
#define c_foreach(it, ctag, con) \
diff --git a/c_lib/cmap.h b/c_lib/cmap.h index d74973a8..16b5b38e 100644 --- a/c_lib/cmap.h +++ b/c_lib/cmap.h @@ -57,7 +57,10 @@ enum {cmapentry_HASH=0x7fff, cmapentry_USED=0x8000}; #define declare_CMap(...) c_MACRO_OVERLOAD(declare_CMap, __VA_ARGS__)
#define declare_CMap_3(tag, Key, Value) \
- declare_CMap_5(tag, Key, Value, c_defaultDestroy, c_defaultHash)
+ declare_CMap_4(tag, Key, Value, c_defaultDestroy)
+
+#define declare_CMap_4(tag, Key, Value, valueDestroy) \
+ declare_CMap_5(tag, Key, Value, valueDestroy, c_defaultHash)
#define declare_CMap_5(tag, Key, Value, valueDestroy, keyHash) \
declare_CMap_7(tag, Key, Value, valueDestroy, keyHash, c_defaultEquals, c_defaultDestroy)
|
