+#include <stdlib.h>
+#include <string.h>
#include "xht.h"
typedef struct xhn_struct
{
char flag;
struct xhn_struct *next;
- const char *key;
+ char *key;
void *val;
} *xhn;
}
/* does the set work, used by xht_set and xht_store */
-xhn _xht_set(xht h, const char *key, void *val, char flag)
+void _xht_set(xht h, char *key, void *val, char flag)
{
int i;
xhn n;
n->val = val;
}
-void xht_set(xht h, const char *key, void *val)
+void xht_set(xht h, char *key, void *val)
{
if(h == 0 || key == 0)
return;
// caller responsible for key storage, no copies made (don't free it b4 xht_free()!)
// set val to NULL to clear an entry, memory is reused but never free'd (# of keys only grows to peak usage)
-void xht_set(xht h, const char *key, void *val);
+void xht_set(xht h, char *key, void *val);
// ooh! unlike set where key/val is in caller's mem, here they are copied into xht and free'd when val is 0 or xht_free()
void xht_store(xht h, const char *key, int klen, void *val, int vlen);