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

Re: svn commit: r999507 - in /subversion/trunk/subversion: svnrdump/dump_editor.c tests/cmdline/svnrdump_tests.py

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Wed, 22 Sep 2010 21:32:50 +0200

[ sorry for the delayed reply. ]

Ramkumar Ramachandra wrote on Wed, Sep 22, 2010 at 00:24:30 +0530:
> Daniel Shahaf writes:
> > > - /* Disallow a path relative to nothing. */
> > > - SVN_ERR_ASSERT_NO_RETURN(!path || pb);
> > > -
> >
> > Why did you drop this assertion?
>
> I thought about it for a bit, and I can't seem to figure out why I
> added it in the first place. My current sanity logic: Without a pb,
> this function (make_dir_baton) generates a root baton. Whatever `path`
> the user passes is ignored anyway- the root baton has `abspath` set to
> `/`. With a `pb`, I MUST pass a non-null `path` -- there's probably
> something about this I haven't thought about properly that's making
> test 14 fail (there's an empty Node-path there). Either way, I don't
> see where an assert fits into the picture.
>

It actually makes sense: "either there is a parent baton, or I'm
creating the root baton (and therefore the caller passed path=NULL)".

Choosing path=NULL to represent "the root" seems odd to me (that's not
how we usually represent it), but that's for another day.

> > > /* Construct the full path of this node. */
> > > if (pb)
> > > abspath = svn_uri_join("/", path, pool);
> > > else
> > > - abspath = "/";
> > > + abspath = apr_pstrdup(pool, "/");
> > >
> >
> > It is most likely unnecessary to duplicate a static string constant. :-)
>
> True. However, abspath is a `char *` with no memory allocated to it: I
> want whatever its value is to be allocated in `pool` since it's passed
> around.

I think you've got your pointers confused. Can you drop the pstrdup(),
see that nothing breaks, and then we can discuss why nothing broke?

:-)

Daniel

>
> -- Ram
Received on 2010-09-22 21:33:58 CEST

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