[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [1165] Option value expansion implementation

From: Daniel Rall <dlr_at_finemaltcoding.com>
Date: 2003-03-10 19:13:29 CET

=?UTF-8?B?QnJhbmtvIMSMaWJlag==?= <brane@xbc.nu> writes:

> Daniel Rall wrote:
>
> >In libsvn_subr/config.c's make_string_from_option() function, to
> >implement expansion I need to know which section that the option which
> >we're making a string for is coming from.
> >
> >[section]
> >X=foo
> >Y=%(X)s
> >
> >When expanding the value of X for option Y, I need know which section
> >option Y comes from so that I can look their for option X. I see two
> >ways of implementing this:
> >
> >1) Added a cfg_section_t * to the cfg_option_t structure (set in the
> >svn_config_set() function), so that an option knows which section it
> >comes from. This would require moving the block in svn_config_set()
> >which creates a section if one doesn't already exist to before the
> >instantiation of the option.
> >
> >2) Leverage the last parameter of find_option() (a cfg_section_t **),
> >and expand the API of make_string_from_option() to take a
> >cfg_section_t * parameter. find_option() seems to always be called
> >before make_string_from_option().
> >
> >Both are fairly easy to implement, but I'm not sure which would be
> >most appropriate and am hoping for some feedback.
>
> I'd advise to go with (2). It's a lot simpler and touches less code. And
> indeed, as you noticed, you always have a section in hand before calls
> to make_string_from_option, so just passing that along is the simplest
> solution.

Okay. I'd first implemented #1, then replaced it with #2, so #2 is
what I have in my buffer right now. :-)

> (BTW, it strikes me that find_option is the right place to implement the
> [DEFAULT] mechanism for ordinary option values, too.)

I agree.

-- 
Daniel Rall <dlr@finemaltcoding.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Mar 10 19:14:08 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.