]> git.ozlabs.org Git - ccan/blobdiff - ccan/ccan_tokenizer/dict.h
Added module ccan_tokenizer from snapshot at:
[ccan] / ccan / ccan_tokenizer / dict.h
diff --git a/ccan/ccan_tokenizer/dict.h b/ccan/ccan_tokenizer/dict.h
new file mode 100644 (file)
index 0000000..0628898
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef CCAN_TOKENIZER_DICT_H
+#define CCAN_TOKENIZER_DICT_H
+
+#include <stdint.h>
+#include <ccan/talloc/talloc.h>
+       //needed for freeing the struct dict*
+
+struct dict_entry {
+       int id;
+       const char *str;
+};
+
+struct dict {
+       struct dict_entry *zero;
+       struct dict_entry *by_first_letter[256];
+};
+
+struct dict *dict_build(void *ctx, const struct dict_entry *entries, size_t count);
+struct dict_entry *dict_lookup(struct dict *dict, const char **sp, const char *e);
+
+#endif