aboutsummaryrefslogtreecommitdiff
path: root/src/compiler/hash_tables/name_table.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-07-16 02:03:33 +0200
committerToni Uhlig <matzeton@googlemail.com>2023-07-16 02:03:33 +0200
commit5a40295c4cf0af5ea8da9ced04a4ce7d3621a080 (patch)
treecb21506e7b04d10b45d6066a0ee1655563d5d52b /src/compiler/hash_tables/name_table.c
Squashed 'flatcc/' content from commit 473da2a
git-subtree-dir: flatcc git-subtree-split: 473da2afa5ca435363f8c5e6569167aee6bc31c5
Diffstat (limited to 'src/compiler/hash_tables/name_table.c')
-rw-r--r--src/compiler/hash_tables/name_table.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/compiler/hash_tables/name_table.c b/src/compiler/hash_tables/name_table.c
new file mode 100644
index 0000000..ec0f7c2
--- /dev/null
+++ b/src/compiler/hash_tables/name_table.c
@@ -0,0 +1,21 @@
+ /* Note: only one hash table can be implemented a single file. */
+#include "../symbols.h"
+#include "hash/hash_table_def.h"
+DEFINE_HASH_TABLE(fb_name_table)
+
+#include "hash/hash_table_impl.h"
+
+static inline int ht_match(const void *key, size_t len, fb_name_t *name)
+{
+ return len == (size_t)name->name.s.len && memcmp(key, name->name.s.s, len) == 0;
+}
+
+static inline const void *ht_key(fb_name_t *name)
+{
+ return name->name.s.s;
+}
+
+static inline size_t ht_key_len(fb_name_t *name)
+{
+ return (size_t)name->name.s.len;
+}