byedpi/mpool.h

32 lines
517 B
C
Raw Normal View History

2024-08-07 11:25:26 +00:00
#ifndef MPOOL_H
#define MPOOL_H
2024-04-16 17:55:41 +00:00
#include <stdbool.h>
2024-03-08 18:33:25 +00:00
#include <time.h>
2024-04-16 17:55:41 +00:00
#include "kavl.h"
2024-03-08 18:33:25 +00:00
2024-03-08 00:37:02 +00:00
struct elem {
2024-04-16 17:55:41 +00:00
int len;
char *data;
2024-03-08 00:37:02 +00:00
int m;
2024-03-08 18:33:25 +00:00
time_t time;
2024-04-16 17:55:41 +00:00
KAVL_HEAD(struct elem) head;
2024-03-08 00:37:02 +00:00
};
2024-04-16 17:55:41 +00:00
2024-03-08 00:37:02 +00:00
struct mphdr {
2024-04-16 17:55:41 +00:00
bool stat;
struct elem *root;
2024-03-08 00:37:02 +00:00
};
2024-04-16 17:55:41 +00: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);
2024-08-07 11:25:26 +00:00
#endif