Re: [RFC/PATCHv8 08/10] fast-import: Proper notes tree manipulation using the notes API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johan Herland <johan@xxxxxxxxxxx> wrote:
> BTW, while we're on the topic, this whole code is only present because I 
> assume it's not possible to edit the fast-import tree structure _while_ 
> traversing it. Is this assumption correct, or are there ways to get 
> around maintaining a separate edit list that is applied to the tree 
> structure afterwards?

IIRC you can actually edit the tree while you are walking through it.
You just have to watch out for the fact that a struct tree_content
can be reallocated (and thus moved in memory) if the entry_capacity
was too small for the new entry_count when inserting a new entry.

tree_content_set() handles this in its API by taking a struct
tree_entry* rather than a struct tree_content*.  This way if the
tree has to expand during the set and gets reallocated we can return
the new tree pointer to the caller through the struct tree_entry
tree field.

-- 
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]