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

Re: svn commit: r14445 - in trunk/subversion: tests/libsvn_subr

From: <kfogel_at_collab.net>
Date: 2005-04-25 22:24:52 CEST

lundblad@tigris.org writes:
> --- trunk/subversion/libsvn_subr/path.c (original)
> +++ trunk/subversion/libsvn_subr/path.c Mon Apr 25 15:14:21 2005
> @@ -711,40 +711,35 @@
> skip_uri_scheme (const char *path)
> {
> apr_size_t j;
> - apr_size_t len = strlen (path);
>
> - /* ### Taking strlen() initially is inefficient. It's a holdover
> - from svn_stringbuf_t days. */
> + assert (path);
>
> - /* Make sure we have enough characters to even compare. */
> - if (len < 4)
> + /* <scheme> has length > 0 and doesn't contain ':' or '/'.
> + (i.e. the first char is not ':' or '/')
> + path[1] and path[2] are tested to assert the precondition
> + of the following loop. */
> + if (path[0] == '\0' || path[0] == ':' || path[0] == '/'
> + || path[1] == '\0' || path[2] == '\0')
> return NULL;
>
> - /* Look for the sequence '://' */
> - for (j = 0; j < len - 3; j++)
> + for (j = 1; path[j + 2] != '\0'; ++j)
> {

Still waiting for Greg Hudson to mutter something about cycle
counting... but I confess I enjoyed this code :-).

-K

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Apr 25 22:56:34 2005

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.