andeh575 / duvis

fast ASCII du visualizer in C
Other
1 stars 0 forks source link

Finding the correct offset for build_tree_postOrder( ) #13

Closed andeh575 closed 10 years ago

andeh575 commented 10 years ago

When parsing through the data gathered from du it becomes necessary to determine the correct offset to use when trying to find subtrees. There are four scenarios that can occur:

  1. The next entry is a parent
  2. The next entry is a child
  3. The next entry is a totally new branch
  4. Something went wrong and there's a completely unexpected entry

Given these four instances it's possible to ensure that the correct component is being compared to determine the lineage of any entry. I will be constructing a helper function that finds this offset to keep the computation out of the postOrder() function itself.