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

Re: svn commit: r22349 - trunk/subversion/libsvn_subr

From: Daniel Rall <dlr_at_collab.net>
Date: 2006-11-20 01:46:23 CET

Lieven, does this change address the performance problems pointed out
by Philip a couple months ago?

On Sun, 19 Nov 2006, lgo@tigris.org wrote:

> Author: lgo
> Date: Sun Nov 19 11:34:35 2006
> New Revision: 22349
>
> Log:
> Reimplement svn_path_is_absolute. To improve its performance, don't use
> the slow apr_filepath_root function.
>
> * subversion/libsvn_subr/path.c
> (svn_path_is_absolute): replace call to apr_filepath_root with a custom
> and faster implementation
>
> Modified:
> trunk/subversion/libsvn_subr/path.c
>
> Modified: trunk/subversion/libsvn_subr/path.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/path.c?pathrev=22349&r1=22348&r2=22349
> ==============================================================================
> --- trunk/subversion/libsvn_subr/path.c (original)
> +++ trunk/subversion/libsvn_subr/path.c Sun Nov 19 11:34:35 2006
> @@ -477,26 +477,20 @@
> svn_boolean_t
> svn_path_is_absolute(const char *path, apr_size_t len, apr_pool_t *pool)
> {
> - const char *root_path = NULL;
> - const char *rel_path = apr_pstrmemdup(pool, path, len);
> - const char *rel_path_apr;
> -
> - /* svn_path_cstring_from_utf8 will create a copy of path.
> -
> - It should be safe to convert this error to a false return value. An error
> - in this case would indicate that the path isn't encoded in UTF-8, which
> - will cause problems elsewhere, anyway. */
> - svn_error_t *err = svn_path_cstring_from_utf8(&rel_path_apr, rel_path,
> - pool);
> - if (err)
> - {
> - svn_error_clear(err);
> - return FALSE;
> - }
> -
> - if (apr_filepath_root(&root_path, &rel_path_apr, 0, pool) != APR_ERELATIVE)
> + /* path is absolute if it starts with '/' */
> + if (len > 0 && path[0] == '/')
> return TRUE;
> -
> +
> + /* On Windows, path is also absolute when it starts with 'H:' or 'H:/'
> + where 'H' is any letter. */
> +#if defined (WIN32)
> + if (len >= 2 &&
> + (path[1] == ':') &&
> + ((path[0] >= 'A' && path[0] <= 'Z') ||
> + (path[0] >= 'a' && path[0] <= 'z')))
> + return TRUE;
> +#endif /* WIN32 */
> +
> return FALSE;
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org

  • application/pgp-signature attachment: stored
Received on Mon Nov 20 01:47:52 2006

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