summaryrefslogtreecommitdiff
path: root/ht.h
diff options
context:
space:
mode:
Diffstat (limited to 'ht.h')
-rw-r--r--ht.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/ht.h b/ht.h
index 5aaffe7..65e9012 100644
--- a/ht.h
+++ b/ht.h
@@ -1,22 +1,23 @@
#ifndef _ht_h
#define _ht_h
-#define HT_SIZE 128
+#include "val.h"
typedef struct {
- char *k;
- int v;
+ ObjString *k;
+ Val v;
} HtEntry;
typedef struct {
- int len;
- HtEntry b[HT_SIZE];
+ size_t len;
+ size_t cap;
+ HtEntry *b;
} Ht;
-typedef Ht Env;
+uint32_t hash(char *s, size_t len);
Ht ht_new();
-void ht_put(Ht *h, char *k, int v);
-int ht_get(Ht *h, char *k, int *v);
+void ht_put(Ht *h, ObjString *k, Val v);
+Val ht_get(Ht *h, ObjString *k);
#endif