[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: Branko Čibej <brane_at_xbc.nu>
Date: 2003-03-09 20:53:44 CET

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.

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

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Mar 9 20:54:34 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.