[augeas-devel] [PATCH] Write last created node in /augeas/tree/last_created for tree_create and tree_insert
Raphaël Pinson
raphink at gmail.com
Sat Aug 9 09:07:39 UTC 2008
On Fri, Aug 8, 2008 at 11:55 PM, David Lutterkort <dlutter at redhat.com>wrote:
> On Fri, 2008-08-08 at 22:57 +0200, Raphaël Pinson wrote:
> >
> >
> > On Fri, Aug 8, 2008 at 10:12 PM, David Lutterkort <dlutter at redhat.com>
> > wrote:
>
> > Yes, I think that would be the cleanest solution: tree_insert
> > should
> > become
> >
> > int tree_insert(struct tree **tree, const char *path,
> > const char *label,
> > int before, struct path **node)
>
> Thinking about this more, this is pretty ugly. I'd prefer it if
> aug_insert actually calls make_path and then passes that to tree_insert,
> which sets the path to the newly created node before returning, so that
> tree_insert ahs the signature
>
> int tree_insert(struct tree **tree, struct path *path, const char
> *label,
> int before)
>
I'm not sure to understand that part, I'll have to look at the code on
monday.
> Yes, that would work here. But how about the tree_create function?
> tree_create is called from tree_set and aug_mv (and will be called
> from aug_cp and it's done).
You have aug_cp working ? Excellent .. looking forward to the patch ;)
>
Argh, I misstyped... I meant s/and/when/ but I think now that I'm beginning
to really understand how it works, I should be able to code cp... whenever I
have time for it.
>
> > Should each of aug_set, aug_mv and aug_cp deal with the node and both
> > tree_create and tree_set calls be changed?
>
> tree_create already sets a struct path up, so only tree_set needs to be
> modified; since that is also used from builtin.c, it's probably easiest
> to split the current tree_set into a tree_set (same signature as curent
> version) and a tree_set_path with signature
>
> struct tree *tree_set_path(struct tree *root, struct path *path,
> const char *value)
>
> that is called from aug_set.
>
> I'd also split all that cruft I had for aug_insert into a static utility
> function, something like 'aug_set_last_created(struct augeas *aug,
> struct path *path)'
OK... Let me know how I can help with that :)
Raphael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080809/5d18864e/attachment.htm>
More information about the augeas-devel
mailing list