Skip to content

Commit

Permalink
Merge pull request #274 from Dr-Emann/push-xzomnwlpmsqu
Browse files Browse the repository at this point in the history
Recycle stack items in SqshTreeTraversal on pop
  • Loading branch information
Gottox authored Jul 28, 2024
2 parents 8eff9ad + 8d90f88 commit da70b06
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion libsqsh/include/sqsh_tree_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ struct SqshTreeTraversal {

struct CxPreallocPool stack_pool;
struct SqshTreeTraversalStackElement *stack;
size_t stack_size;

size_t depth;
size_t max_depth;
Expand Down
2 changes: 1 addition & 1 deletion libsqsh/src/tree/traversal.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ sqsh__tree_traversal_init(
&traversal->stack_pool, 8,
sizeof(struct SqshTreeTraversalStackElement));
traversal->stack = NULL;
traversal->stack_size = 0;
traversal->base_file = file;
traversal->state = SQSH_TREE_TRAVERSAL_STATE_INIT;
traversal->max_depth = SIZE_MAX;
Expand Down Expand Up @@ -110,6 +109,7 @@ pop_stack(struct SqshTreeTraversal *traversal) {
sqsh__file_cleanup(&element->file);
sqsh__directory_iterator_cleanup(&element->iterator);
traversal->stack = element->next;
cx_prealloc_pool_recycle(&traversal->stack_pool, element);
element = traversal->stack;

if (traversal->stack == NULL) {
Expand Down

0 comments on commit da70b06

Please sign in to comment.