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