summaryrefslogtreecommitdiffstats
path: root/src/ctx.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ctx.c')
-rw-r--r--src/ctx.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ctx.c b/src/ctx.c
index f5dc465..a3c5140 100644
--- a/src/ctx.c
+++ b/src/ctx.c
@@ -22,6 +22,9 @@ struct bfs_ctx *bfs_ctx_new(void) {
return NULL;
}
+ SLIST_INIT(&ctx->expr_list);
+ ARENA_INIT(&ctx->expr_arena, struct bfs_expr);
+
ctx->maxdepth = INT_MAX;
ctx->flags = BFTW_RECOVER;
ctx->strategy = BFTW_BFS;
@@ -202,9 +205,6 @@ int bfs_ctx_free(struct bfs_ctx *ctx) {
CFILE *cout = ctx->cout;
CFILE *cerr = ctx->cerr;
- bfs_expr_free(ctx->exclude);
- bfs_expr_free(ctx->expr);
-
bfs_mtab_free(ctx->mtab);
bfs_groups_free(ctx->groups);
@@ -241,6 +241,11 @@ int bfs_ctx_free(struct bfs_ctx *ctx) {
free_colors(ctx->colors);
+ for_slist (struct bfs_expr, expr, &ctx->expr_list) {
+ bfs_expr_clear(expr);
+ }
+ arena_destroy(&ctx->expr_arena);
+
for (size_t i = 0; i < ctx->npaths; ++i) {
free((char *)ctx->paths[i]);
}