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

Re: svn commit: r982397 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/deprecated.c libsvn_wc/props.c

From: Greg Stein <gstein_at_gmail.com>
Date: Wed, 4 Aug 2010 17:22:47 -0400

On Wed, Aug 4, 2010 at 16:45, <rhuijben_at_apache.org> wrote:
>...
> +++ subversion/trunk/subversion/libsvn_wc/deprecated.c Wed Aug  4 20:45:46 2010
> @@ -2330,12 +2330,26 @@ svn_wc_props_modified_p(svn_boolean_t *m
>                         svn_wc_adm_access_t *adm_access,
>                         apr_pool_t *pool)
>  {
> -  svn_wc__db_t *db = svn_wc__adm_get_db(adm_access);
> +  svn_wc_context_t *wc_ctx;
>   const char *local_abspath;
> +  svn_error_t *err;
>
>   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
> +  SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL /* config */,
> +                                         svn_wc__adm_get_db(adm_access), pool));
> +
> +  err = svn_wc_props_modified_p2(modified_p,
> +                                 wc_ctx,
> +                                 local_abspath,
> +                                 pool);
>
> -  return svn_wc__props_modified(modified_p, db, local_abspath, pool);
> +  if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
> +    {
> +      svn_error_clear(err);
> +      *modified_p = FALSE;
> +    }
> +
> +  return svn_error_return(svn_wc_context_destroy(wc_ctx));

You leak an error here, if it isn't PATH_NOT_FOUND.

This is one of the reasons that I prefer the following pattern:

if (err)
  {
    if (!possible-to-handle)
      return svn_error_return(err);
    handle_error();
    svn_error_clear(err);
  }

The error is always returned or cleared. And quite visibly/readable.

>...

Cheers,
-g
Received on 2010-08-04 23:23:26 CEST

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.