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

Re: Updated [patch] new part 1 for log command

From: Ben Collins <bcollins_at_debian.org>
Date: 2002-03-01 05:49:09 CET

> > + /* And put the revision into our array, if it doesn't already
> > + * exist. */
> > + for (t = 0; t < array->nelts && ! exists; t++)
> > + if (APR_ARRAY_IDX(array, t, svn_revnum_t) == revision)
> > + exists = 1;
>
> I'm mildly concerned about O(n^2) operation here, but I can't imagine this
> being all that large of an array. Regardless, when you find a match, you
> should 'break' out of the loop.

It does break out of the loop. Where it checks "! exist" in the for().
Once it finds a match, the loop will stop.

> An alternative to the nested loop is to remove dups after the qsort()
> occurs.

That's an idea. Means we only loop through once, recreating the array
and skipping duplicates.

> >...
> > + /* We split the path here. If this is the only target (a full path)
> > + we'll end up using BASENAME as the URL, and FILE as the path to
> > + search on. For both cases, BASENAME gets passed to
> > + svn_client__get_revision_number() below. */
> > + svn_path_split (base, &basename, &file, pool);
> >...
> > @@ -94,13 +149,14 @@
> > SVN_ERR (svn_client__open_ra_session (&session, ra_lib, URL, basename,
> > TRUE, TRUE, auth_baton, pool));
> >
> > + /* Get the revisions based on the users "hints". */
> > SVN_ERR (svn_client__get_revision_number
> > (&start_revnum, ra_lib, session, start, basename->data, pool));
> > SVN_ERR (svn_client__get_revision_number
> > (&end_revnum, ra_lib, session, end, basename->data, pool));
>
> When using a URL for an argument, there might not be a working copy. That
> implies that NULL should be passed for the 'base_dir' arg to open_ra_session
> (and FALSE for the do_store and use_admin flags). Also, NULL should be
> passed for the 'path' argument to get_revision_number.

Ok.

> >...
> > + if (revs)
> > + {
> > + int i, matched = 0;
> > + for (i = 0; i < revs->nelts && !matched; i++)
> > + if (this_rev == ((svn_revnum_t *)(revs->elts))[i])
> > + matched = 1;
>
> And break out of here, too.

Same as before, checks for !matched, so will break on the first match.

-- 
 .----------=======-=-======-=========-----------=====------------=-=-----.
/       Ben Collins    --    Debian GNU/Linux    --    WatchGuard.com      \
`          bcollins@debian.org   --   Ben.Collins@watchguard.com           '
 `---=========------=======-------------=-=-----=-===-======-------=--=---'
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:10 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.