summaryrefslogtreecommitdiff
path: root/val.h
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-08-05 04:15:17 +0100
committerubq323 <ubq323@ubq323.website>2023-08-05 04:15:20 +0100
commit9ee73a8459eb2bb58adc29da02de312b7e4e7dca (patch)
treef41bddde050c61e254af8ba4c53a3bc11ca7b804 /val.h
parent93fe66fb8ef5c731b46a30a804f74b4bf3b133d7 (diff)
refactor hashtables, and use objstrings for keys
doesn't yet work without string interning, which will require further refactoring
Diffstat (limited to 'val.h')
-rw-r--r--val.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/val.h b/val.h
index 6e4cc18..3cf3251 100644
--- a/val.h
+++ b/val.h
@@ -2,6 +2,9 @@
#define _val_h
#include <stdbool.h>
+#include <stdint.h>
+#include <stddef.h>
+
typedef struct _val Val;
typedef struct _obj Obj;
@@ -38,10 +41,12 @@ typedef struct _obj {
typedef struct {
Obj obj;
size_t len;
+ uint32_t hash;
char *b;
} ObjString;
-// copies data
-ObjString *objstring_new(char *src, size_t len);
+
+ObjString *objstring_copy(char *src, size_t len);
+ObjString *objstring_take(char *src, size_t len);
#define IS_NIL(x) (x.ty == NIL)