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

Re: [RFC] Simplify use of apr_hash_this()

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Mon, 06 Jul 2009 18:25:56 +0100

I (Julian Foad) wrote:
> On Wed, 2009-07-01 at 11:17 -0400, Greg Hudson wrote:
> > This leads me to believe that the interfaces we really want are:
> >
> > const void *apr_hash_key(hi)
> > void *apr_hash_val(hi)
[...]

OK, I've attached a patch, <apr_hash_this-def-2.patch>.

I chose the names apr_hash_index_key(), apr_hash_index_klen(),
apr_hash_index_val(). They are in APR namespace because, like our
APR_ARRAY_IDX and APR_ARRAY_PUSH, they are APR-level functions that are
candidates for going into APR. (APR_ARRAY_IDX and APR_ARRAY_PUSH made it
into APR 1.3.)

The definitions are in svn_types.h, because they are needed throughout
the code base and we have had other APR helper APIs there.

The implementations are in subversion/libsvn_subr/iter.c because,
although their use is an alternative rather than a complement to
svn_iter_*(), they are closely related.

> we could then write
>
> for (hi = apr_hash_first(pool, entries); hi; hi = apr_hash_next(hi))
> {
> const char *item = apr_hash_key(hi);
> svn_wc_entry_t *entry = apr_hash_val(hi);
>
> ...
> }

This now works, and you can see how much simpler it makes the usage in
the attached <apr_hash_this-use-2.patch>. In this patch I have
simplified the usage in the first several C files in
subversion/libsvn_client/ and all the C files in subversion/svn*/.

Is this a good version that I can go ahead with now?

- Julian

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2368450

Received on 2009-07-06 19:26:29 CEST

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.