add json request support

This commit is contained in:
lxsang
2016-10-31 17:34:20 +01:00
parent 08a29ee87e
commit 9305d4f800
9 changed files with 33 additions and 3 deletions

Binary file not shown.

Binary file not shown.

View File

@ -320,11 +320,16 @@ char to_hex(char code) {
return hex[code & 15];
}
unsigned hash(const char* key, int hash_size)
{
unsigned hashval = simple_hash(key);
return hashval % hash_size;
}
unsigned simple_hash(const char* key)
{
unsigned hashval;
for (hashval = 0; *key != '\0'; key++)
hashval = *key + 31 * hashval;
return hashval % hash_size;
return hashval;
}
int is_file(const char* f)
{

View File

@ -80,5 +80,6 @@ char *url_encode(const char *str);
char from_hex(char ch);
char to_hex(char code);
unsigned hash(const char*, int);
unsigned simple_hash(const char*);
int is_file(const char* f);
#endif