[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: Greg Hudson <ghudson_at_mit.edu>
Date: Wed, 01 Jul 2009 11:17:33 -0400

On Wed, 2009-07-01 at 00:45 +0100, Julian Foad wrote:
> In a minority of instances, we are using explicit casts:

I observe that in every instance you cited, one of the arguments passed
is NULL.

This leads me to believe that the interfaces we really want are:

const void *apr_hash_key(hi)
void *apr_hash_val(hi)

which nicely sidestep the aliasing issue by returning the value instead
of using a pointer argument. Even in the (apparently rare) cases where
we want the key and the value, it may be more elegant to make two
function calls than to use a single call with temporaries, or a
multi-line macro.

Of course, those APIs do not exist in APR (right now), so we'd have to
define them ourselves.

Received on 2009-07-01 17:18:00 CEST

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