Skip to content

Commit d3e7905

Browse files
committed
refactor: change depth variable type to size_t for better compatibility
1 parent 886da65 commit d3e7905

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

easy_memory.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,7 +2421,7 @@ static Block *insert_block(Block *h, Block *new_block) {
24212421
}
24222422

24232423
Block *path[EM_MAX_TREE_HEIGHT];
2424-
int depth = 0;
2424+
size_t depth = 0;
24252425
Block *current = h;
24262426

24272427
/*
@@ -2456,7 +2456,7 @@ static Block *insert_block(Block *h, Block *new_block) {
24562456
* PHASE 3: Bottom-Up Rebalancing
24572457
* Walk back up the saved path to balance the tree, simulating recursive unwinding.
24582458
*/
2459-
for (int i = depth - 1; i >= 0; i--) {
2459+
for (size_t i = depth; i-- > 0;) {
24602460
Block *node = path[i];
24612461
Block *balanced = balance(node);
24622462

0 commit comments

Comments
 (0)