1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Lib: Save/restore state for linpools

Also change linpool.current ptr to really point to thr current chunk.
This commit is contained in:
Ondrej Zajicek (work)
2017-12-12 19:51:36 +01:00
parent ac48e72bf6
commit 1e11918c8c
2 changed files with 65 additions and 11 deletions

View File

@@ -59,11 +59,18 @@ void mb_free(void *);
typedef struct linpool linpool;
typedef struct lp_state {
void *current, *large;
byte *ptr;
} lp_state;
linpool *lp_new(pool *, unsigned blk);
void *lp_alloc(linpool *, unsigned size); /* Aligned */
void *lp_allocu(linpool *, unsigned size); /* Unaligned */
void *lp_allocz(linpool *, unsigned size); /* With clear */
void lp_flush(linpool *); /* Free everything, but leave linpool */
void lp_save(linpool *m, lp_state *p); /* Save state */
void lp_restore(linpool *m, lp_state *p); /* Restore state */
extern const int lp_chunk_size;
#define LP_GAS 1024