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

Re: svn commit: r1182984 - /subversion/trunk/subversion/tests/libsvn_subr/cache-test.c

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Thu, 13 Oct 2011 19:32:40 +0200

Philip Martin wrote on Thu, Oct 13, 2011 at 18:15:43 +0100:
> stefan2_at_apache.org writes:
>
> > Author: stefan2
> > Date: Thu Oct 13 17:01:27 2011
> > New Revision: 1182984
> >
> > URL: http://svn.apache.org/viewvc?rev=1182984&view=rev
> > Log:
> > Simplify the code by using APR_HAS_THREADS directly as a parameter
> > instead of setting a thread_safe intermediate.
> >
> > * subversion/tests/libsvn_subr/cache-test.c
> > (test_membuffer_cache_basic): simplify
> >
> > Modified:
> > subversion/trunk/subversion/tests/libsvn_subr/cache-test.c
> >
> > Modified: subversion/trunk/subversion/tests/libsvn_subr/cache-test.c
> > URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/cache-test.c?rev=1182984&r1=1182983&r2=1182984&view=diff
> > ==============================================================================
> > --- subversion/trunk/subversion/tests/libsvn_subr/cache-test.c (original)
> > +++ subversion/trunk/subversion/tests/libsvn_subr/cache-test.c Thu Oct 13 17:01:27 2011
> > @@ -182,16 +182,9 @@ test_membuffer_cache_basic(apr_pool_t *p
> > {
> > svn_cache__t *cache;
> > svn_membuffer_t *membuffer;
> > - svn_boolean_t thread_safe;
> > -
> > -#if APR_HAS_THREADS
> > - thread_safe = TRUE;
> > -#else
> > - thread_safe = FALSE;
> > -#endif
> >
> > SVN_ERR(svn_cache__membuffer_cache_create(&membuffer, 10*1024, 1,
> > - thread_safe, pool));
> > + APR_HAS_THREADS, pool));
>
> Dangerous. What are the valid values for APR_HAS_THREADS? When
> threading is present it uses something like:
>
> #define APR_HAS_THREADS 1
>
> but when threading is not present it may simply not define
> APR_HAS_THREADS at all.
>

First of all, I made the same patch yesterday elsewhere.

Second of all, the use is #if, not #ifdef, so I believe the macro is
always defined (to 0 or 1).

> --
> Philip
Received on 2011-10-13 19:33:33 CEST

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