On 8/21/06, Garrett Rooney <firstname.lastname@example.org> wrote:
> On 8/21/06, Erik Huelsmann <email@example.com> wrote:
> > Ok. I didn't investigate more of it myself, so I rely on you to make
> > sure that we call svn_path_is_root from other functions which don't
> > have a pool (excluding is_canonical, since Philip said we can safely
> > remove that function from consideration).
> > 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?
> Incorrect, creating a new global pool (via svn_pool_create(NULL))
> should be thread safe (allocating things directly from the global pool
> yourself is not necessarily thread safe though, although you have to
> jump through hoops to get a handle on it anyway), it's just not
> something you really want to do very often because it's kinda slow.
> Creating a new pool involves allocating about 8k of data, which is
> kind of silly if you're just going to use it for one tiny thing then
> destroy it.
Reading it Garrett's way: we may want to rev the APIs just because of
the pool requirement. But, when the pool being passed in is NULL (as
the old api compat routines would), we'd need to create our own pool
with svn_pool_create(NULL); something along these lines:
svn_path_is_root(const char *path, apr_size_t len, apr_pool_t *pool)
char *root_path = NULL;
apr_pool_t *strpool = (pool) ? NULL : svn_pool_create(NULL);
char *rel_path = apr_pstrmemdup(strpool, path, len);
if (! pool)
pool = strpool;
/* 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 (err = svn_path_cstring_from_utf8(&rel_path, rel_path, strpool))
status = apr_filepath_root(&root_path, &rel_path, 0, strpool);
if ((status == APR_SUCCESS ||
status == APR_EINCOMPLETE) &&
rel_path == '\0')
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com
Received on Mon Aug 21 22:43:58 2006