[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
Mon Aug 11 19:27:49 UTC 2008


On Mon, Aug 11, 2008 at 8:44 PM, David Lutterkort <dlutter at redhat.com>wrote:

> On Mon, 2008-08-11 at 12:22 +0200, Raphaël Pinson wrote:
> > If I change tree_insert to take a struct path *path instead of a const
> > char *path, then there is a problem with tree_insert_glue in
> > builtin.c, because it can't provide a struct path to tree_insert since
> > struct path is a structure specific to augeas.c. On the other hand, if
> > I move struct path to internal.h, then I still have to move make_path
> > aswell...
>
> There's two things you can do:
>
>      * Declare struct path and make_path to internal.h, so that they
>        can be called from tree_insert_glue


That's a big change somehow, since that means that all things path are made
generic, but that's where it lead me.



>      * Leave the prototype for tree_insert the way it is, but change
>        its implementation to just call make_path, and move the rest of
>        its body into a new function tree_insert_path that takes a
>        struct path
>

I don't understand how that would change the problem. Eventually, the
function that calculates the path to the newly created node has to know
about the new tree. This tree cannot be easily exported so that means that
this calculation is better done within tree_insert, and tree_insert has to
return the result, so I don't see how a tree_insert_path function would
change that. It seems much easier to me to call tree_insert with a struct
path like you suggested before, and have struct path be generic.


Raphael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080811/625d92fa/attachment.htm>


More information about the augeas-devel mailing list