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

Re: CVS update: subversion/subversion/libsvn_ra_local Makefile.am ra_local.h ra_plugin.c split_url.c

From: Greg Stein <gstein_at_lyra.org>
Date: 2001-02-10 04:19:57 CET

On Fri, Feb 09, 2001 at 08:06:42PM -0600, Ben Collins-Sussman wrote:
> Greg Stein <gstein@lyra.org> writes:
>...
> > >... [ split_url ]
> >
> > This function would be a *lot* simpler, if you:
> >
> > 1) make a dup of the URL
> > 2) strip the leading file:// portion (leaving "/abs/path/foo/bar")
> > 3) loop:
> > a) try to open FS with the path. succeed: break
> > b) chop the last component off
> > 4) fs_path is what remains, repos_path is &URL[strlen(fs_path) + 7]
> > (the +7 is to account for "file://" at the start of the URL)
>
> Oh, this is the *easy* way, which I purposely avoided.
>
> I wanted to be "correct" by searching from the other direction,
> thereby always finding the repository with the shortest path, not the
> longest.

Ah. Right. Sorry...

But still a simple change. Search from the left for '/'; replace with '\0';
test for an FS; if not found, then put the '/' back and look for the next
'/' (repeat).

>...
> Do you think it's worth re-writing?

Yes, given how much simpler it could be, I think it would be a STACK item
that anybody could pick up. It works now, but for long-term maintenance, it
would be nice to have a simplifed version.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:21 2006

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.