Parsing of simple requests. HashMap.
This commit is contained in:
30
src/utils/hashmap.h
Normal file
30
src/utils/hashmap.h
Normal file
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// Created by nazar on 13.09.2025.
|
||||
//
|
||||
|
||||
#ifndef SIMPLEHTTPSERVER_HASHMAP_H
|
||||
#define SIMPLEHTTPSERVER_HASHMAP_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#define DEFAULT_CAPACITY 8
|
||||
|
||||
typedef struct pair {
|
||||
char* key;
|
||||
char* val;
|
||||
struct pair* next;
|
||||
} pair_t;
|
||||
|
||||
typedef struct hashmap {
|
||||
pair_t** list;
|
||||
unsigned int cap;
|
||||
unsigned int len;
|
||||
} hashmap_t;
|
||||
|
||||
hashmap_t* new_hash_map();
|
||||
unsigned int hashcode(const hashmap_t* this, const char* key);
|
||||
char* get(const hashmap_t* this, const char* key);
|
||||
void set(hashmap_t* this, char* key, char* val);
|
||||
void expand_hash_map(hashmap_t* this);
|
||||
void free_hash_map(const hashmap_t* this);
|
||||
|
||||
#endif //SIMPLEHTTPSERVER_HASHMAP_H
|
||||
Reference in New Issue
Block a user