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

Re: A proposed solution for svn admin directory names

From: Brass Tilde <brasstilde_at_insightbb.com>
Date: 2005-06-29 19:52:01 CEST

> > Calling getenv() that often is horrible.
> I think if we're going to reject this solution on the basis of
> performance, the burden is on us to measure a performance penalty.
> The other objections raised (environment variables aren't our preferred
> method of configuration, and we'd be breaking source compatibility) are
> more serious, though.

Without looking at the code reading configuration options and using them (and likely not understanding it if I did), what about
combining the two approaches?

I'll presume for the sake of argument that the options in the configuration file are read when the svn program starts, and saved in
some sort of structure to be available when needed. I'll further presume that there is some method, such as a "getConfigOption()"
function, for sections of code to retrieve relevant items from this structure when needed.

Instead of calling getenv() in the #define, call something that reads the configuration structure and gets the SVN_ADM_DIR value.
You could then put it in the configuration file *without* modifying every piece of code that uses the #define.

So, to modify Joseph Galbraith's snippet a wee bit:

char* getadmdir()
   static char* szAdmDir = 0;
   if ( szAdmDir == 0 )
     szAdmDir = getConfigOption("SVN_ADM_DIR");
     if ( szAdmDir == 0 )
        szAdmDir = ".svn";

   return szAdmDir;

#define SVN_WC_ADM_DIR_NAME getadmdir()

No massive code changes (unless that #define is present in every source file that uses it). No dependence on environment. Still
depends on static variables though, and my experience with multi-threaded issues is...paltry.


To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jun 29 19:52:53 2005

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.