diff options
author | Jacob Moody <moody@posixcafe.org> | 2022-07-17 14:52:11 +0000 |
---|---|---|
committer | Jacob Moody <moody@posixcafe.org> | 2022-07-17 14:52:11 +0000 |
commit | c147614656b9c1b4338099a69c35e42c1f4313a5 (patch) | |
tree | 7a74217a2dfc87b1896a7256d4a969227cd9f138 /sys/src/cmd/ktrans/hash.h | |
parent | ccbabf1c16caa4917c97b8d8f5cadfb8759610b3 (diff) |
ktrans: 你好
This consolidates jisho and map lookups
to use the same structure and removes
the old jisho code.
Diffstat (limited to 'sys/src/cmd/ktrans/hash.h')
-rw-r--r-- | sys/src/cmd/ktrans/hash.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/src/cmd/ktrans/hash.h b/sys/src/cmd/ktrans/hash.h new file mode 100644 index 000000000..66e9e78db --- /dev/null +++ b/sys/src/cmd/ktrans/hash.h @@ -0,0 +1,23 @@ +typedef union Hkey Hkey; +union Hkey { + void *p; + int v; +}; + +typedef struct Hmap Hmap; +struct Hmap { + int nbs; + int nsz; + + int len; + int cap; + uchar *nodes; +}; + +Hmap* hmapalloc(int nbuckets, int size); +int hmapget(Hmap *h, char *key, void *dst); +int hmapset(Hmap **h, char *key, void *new, void *old); +int hmapdel(Hmap *h, char *key, void *dst, int freekey); +void hmapfree(Hmap *h, int freekeys); +char* hmapkey(Hmap *h, char *key); +void hmapreset(Hmap *h, int freekeys); |