[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: Joseph Galbraith <galb_at_vandyke.com>
Date: 2005-06-29 18:51:48 CEST

Joseph Galbraith wrote:
> C. Michael Pilato wrote:
>
>> Philip Martin <philip@codematters.co.uk> writes:
>>
>>
>>> Ben Collins-Sussman <sussman@collab.net> writes:
>>>
>>>
>>>> On Jun 29, 2005, at 10:51 AM, Jonathan Malek wrote:
>>>>
>>>>> #define SVN_WC_ADM_DIR_NAME ( ( getenv( "SVN_ADM_DIR") ) ? ( getenv(
>>>>> "SVN_ADM_DIR") ) : (".svn") )
>>>
>>>
>>>> IANTSP -- "I am not the subversion project". Do any other developers
>>>> have opinions about this?
>>>
>>>
>>> Calling getenv() that often is horrible.
>
> Well, maybe this is better, or perhaps more horrible (excuse
> the C++ism and pseudo-hungarianisms:
>
> char* getadmdir()
> {
> static bool bHaveDir = false;
> static char* szAdmDir = 0;
> if ( ! bHaveDir )
> {
> bHaveDir = true;
> szAdmDir = ::getevn("SVN_ADM_DIR");
> if ( szAdmDir == 0 )
> szAdmDir = ".svn";
> }
>
> return szAdmDir;
> }
>
> #define SVN_WC_ADM_DIR_NAME getadmdir()

Argh... one should always re-read code-- or how about
this more consise snippet with fewer typos to boot:

char* getadmdir()
{
   static char* szAdmDir = 0;
   if ( szAdmDir == 0 )
   {
     szAdmDir = ::getenv("SVN_ADM_DIR");
     if ( szAdmDir == 0 )
        szAdmDir = ".svn";
   }

   return szAdmDir;
}

#define SVN_WC_ADM_DIR_NAME getadmdir()

Of course getadmdir() has to be put someplace it won't cause multiple
definitions and can be found everyplace SVN_WC_ADM_DIR_NAME is used...
but surely there is someplace that meets these requirements?

Thanks,

Joseph

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jun 29 18:47:56 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.