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

Re: svn commit: r934627 - in /subversion/trunk: ./ subversion/libsvn_client/patch.c subversion/tests/cmdline/patch_tests.py

From: Hyrum K. Wright <hyrum_wright_at_mail.utexas.edu>
Date: Fri, 16 Apr 2010 07:27:59 -0500

On Fri, Apr 16, 2010 at 5:38 AM, Philip Martin
<philip.martin_at_wandisco.com>wrote:

> Julian Foad <julian.foad_at_wandisco.com> writes:
>
> > Stefan Sperling wrote:
> >> On Fri, Apr 16, 2010 at 10:08:15AM +0100, Philip Martin wrote:
> >> > stsp_at_apache.org writes:
> >> >
> >> > > Author: stsp
> >> > > Date: Thu Apr 15 22:18:59 2010
> >> > > New Revision: 934627
> >> > >
> >> > > URL: http://svn.apache.org/viewvc?rev=934627&view=rev
> >> > > Log:
> >> > > Reintegrate the svn-patch-improvements branch into trunk.
> >> >
> >> > > + /* Rebuild the empty dirs list, replacing empty dirs which
> have
> >> > > + * an empty parent with their parent. */
> >> > > + again = FALSE;
> >> > > + empty_dirs_copy = apr_array_copy(iterpool, empty_dirs);
> >> > > + apr_array_clear(empty_dirs);
> >> > > + for (i = 0; i < empty_dirs_copy->nelts; i++)
> >> >
> >> > apr_array_clear is only available in APR 1.3.x and later.
> >> >
> >> > We could write svn_array_clear, or perhaps even apr_array_clear, or we
> >> > could simply reset empty_dirs->nelts directly.
> >>
> >> Hmmm...
> >>
> >> I'll use apr_array_clear in an #ifdef APR_VERSION(...), and clear the
>
> APR_VERSION_AT_LEAST
>

When using this macro, don't forget to include svn_dep_compat.h.
APR_VERSION_AT_LEAST wasn't introduced into APR itself until 1.3.0.

> >> array manually in the #else clause.
> >
> > Just write "arr->nelts = 0;" (which is the entire body of
> > apr_array_clear()) and don't introduce an ifdef.
>
> I agree that we don't want #if like that in the main code. Put it in
> one of our private header files if you want to use it.
>

+1

-Hyrum
Received on 2010-04-16 14:28:30 CEST

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