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

Re: [PATCH] fix for issue #2556: support working copies on the root of a (virtual) drive

From: Branko Čibej <brane_at_xbc.nu>
Date: 2006-08-20 18:38:20 CEST

Erik Huelsmann wrote:
>> > I don't like the idea of rolling our own function for
>> > something that APR already does. The overhead is trivial when
>> > compared to the extra functionality *and portability* of
>> > apr_filepath_root. I think you need to prove that the
>> > overhead is unacceptable performance-wise.
>> >
>> I think you misunderstood me, the svn_path_is_root function is a wrapper
>> around apr_file_path_root. This is the current version (probably the one
>> that's going to be included in the patch):
>>
>> svn_boolean_t
>> svn_path_is_root(const char *path, apr_pool_t *pool)
>> {
>> #if defined(WIN32)
>> char *root_path = NULL;
>> apr_pool_t *subpool = svn_pool_create(pool);
>> char *rel_path = apr_pstrmemdup(subpool, path, strlen(path));
>>
>> apr_status_t status = apr_filepath_root(&root_path, &rel_path, 0,
>> subpool);
>>
>> apr_pool_destroy(subpool);
>>
>> if ((status == APR_SUCCESS ||
>> status == APR_EINCOMPLETE) &&
>> rel_path[0] == 0)
>> return TRUE;
>>
>> return FALSE;
>> #endif /* WIN32 */
>>
>> return path[0] == '/' && path[1] == 0;
>> }
>
> I wouldn't bother with the subpool creation: the extra memory required
> is negligeable when compared to other allocated amounts. We generally
> don't create subpools for usecases like this.

Right. I have a few other comments:

    * Don't make calling apr_filepath_root Windows-specific; that
      defeats the whole point of calling that function in the first place.
    * Use svn_path_cstring_from_utf8, which will convert the string from
      internal encoding to whatever APR expects (and is usually a no-op
      on Windows, by the way).

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Aug 20 18:38:34 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.