[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-21 22:14:30 CEST

Erik Huelsmann wrote:
> However, calling svn_pool_create(NULL) isn't thread safe AFAIK,
> because it allocates from the main pool (is this right, Branko,
> anybody?). Or is that the only bit for which the main pool *is*
> protected?

This is not allocation from the global pool, it's subpool creation,
which is a different beast. If subpool creation weren't thread-safe, you
couldn't create _any_ pools safely.

>
> Anyway: two other comments inline below:
>
> @@ -418,6 +424,35 @@
> }
>
>
> +svn_boolean_t
> +svn_path_is_root(const char *path, apr_size_t len)
> +{
> + char *root_path = NULL;
> + apr_status_t status;
> + apr_pool_t *strpool = svn_pool_create(NULL);
> + char *rel_path = apr_pstrmemdup(strpool, path, len);
> +
> + /* 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. */
> + if (svn_path_cstring_from_utf8(&rel_path, rel_path, strpool) !=
> APR_SUCCESS)
>
> Here you may leek a pool.

This function returns an svn_error_t*, which really shouldn't be
compared to APR_SUCCESS, because they're two totally different beasts.
You'll have to introduce an svn_error_t* variable to hold the return
value, and call svn_error_clear. For example,

svn_error_t *err = svn_path_cstring_from_utf8(&rel_path, rel_path, strpool);
if (err)
  {
    svn_error_clear(err);
    return FALSE;
  }

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Aug 21 22:34:16 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.