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

Re: svn commit: rev 5259 - trunk/subversion/libsvn_ra_dav

From: Greg Stein <gstein_at_lyra.org>
Date: 2003-03-11 01:06:32 CET

On Mon, Mar 10, 2003 at 02:54:42PM +0100, Sander Striker wrote:
>...
> > +++ trunk/subversion/libsvn_ra_dav/commit.c Mon Mar 10 07:22:27 2003
> > @@ -661,7 +661,8 @@
> > enum svn_recurse_kind kind)
> > {
> > apr_hash_t *hash = cc->valid_targets;
> > - apr_hash_set (hash, path, APR_HASH_KEY_STRING, &kind);
> > + svn_string_t *path_str = svn_string_create(path, apr_hash_pool_get(hash));
> > + apr_hash_set (hash, path_str->data, path_str->len, &kind);
> > }
>
> Why not just like so?
>
> apr_hash_set (hash, apr_pstrdup (apr_hash_pool_get (hash), path),
> APR_HASH_KEY_STRING, &kind);

Right. That approach saves an svn_string_t from the heap. It does a bit of
extra length counting, but if that is a problem:

  apr_size_t len = strlen(path);

  path = apr_pstrmemdup(apr_hash_pool_get(hash), path, len);
  apr_hash_set(hash, path, len, &kind);

Woah!! This whole valid_targets thing is way busted, and has been for a long
while. Dang... we've just been lucky. First, we had bad path lifetimes,
which Mike fixed. But we *still* have problems with that kind.

We shove the kind in as a pointer to the stack argument. Whoops!

We pull it *out* as an integer (see merge.c::okay_to_bump_path). Eek.

/me looks around for who wrote this stuff... bleh...

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Mar 11 01:05:11 2003

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.