diff options
Diffstat (limited to 'flatcc/src/compiler/hash_tables/schema_table.c')
-rw-r--r-- | flatcc/src/compiler/hash_tables/schema_table.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/flatcc/src/compiler/hash_tables/schema_table.c b/flatcc/src/compiler/hash_tables/schema_table.c new file mode 100644 index 0000000..2a7e322 --- /dev/null +++ b/flatcc/src/compiler/hash_tables/schema_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_schema_table) + +#include "hash/hash_table_impl.h" + +static inline int ht_match(const void *key, size_t len, fb_schema_t *schema) +{ + return len == (size_t)schema->name.name.s.len && memcmp(key, schema->name.name.s.s, len) == 0; +} + +static inline const void *ht_key(fb_schema_t *schema) +{ + return schema->name.name.s.s; +} + +static inline size_t ht_key_len(fb_schema_t *schema) +{ + return (size_t)schema->name.name.s.len; +} |