byedpi/mpool.h

27 lines
476 B
C
Raw Normal View History

2024-04-16 20:55:41 +03:00
#include <stdbool.h>
2024-03-08 21:33:25 +03:00
#include <time.h>
2024-04-16 20:55:41 +03:00
#include "kavl.h"
2024-03-08 21:33:25 +03:00
2024-03-08 03:37:02 +03:00
struct elem {
2024-04-16 20:55:41 +03:00
int len;
char *data;
2024-03-08 03:37:02 +03:00
int m;
2024-03-08 21:33:25 +03:00
time_t time;
2024-04-16 20:55:41 +03:00
KAVL_HEAD(struct elem) head;
2024-03-08 03:37:02 +03:00
};
2024-04-16 20:55:41 +03:00
2024-03-08 03:37:02 +03:00
struct mphdr {
2024-04-16 20:55:41 +03:00
bool stat;
struct elem *root;
2024-03-08 03:37:02 +03:00
};
2024-04-16 20:55:41 +03:00
struct mphdr *mem_pool(bool cst);
struct elem *mem_get(struct mphdr *hdr, char *str, int len);
struct elem *mem_add(struct mphdr *hdr, char *str, int len);
void mem_delete(struct mphdr *hdr, char *str, int len);
void mem_destroy(struct mphdr *hdr);