30 lines
657 B
C
30 lines
657 B
C
//
|
|
// 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
|