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

Re: svn commit: r1076645 - /subversion/trunk/subversion/libsvn_wc/wc_db.c

From: Hyrum K Wright <hyrum_at_hyrumwright.org>
Date: Thu, 3 Mar 2011 09:35:46 -0600

On Thu, Mar 3, 2011 at 9:03 AM, <philip_at_apache.org> wrote:
> Author: philip
> Date: Thu Mar  3 15:03:42 2011
> New Revision: 1076645
>
> URL: http://svn.apache.org/viewvc?rev=1076645&view=rev
> Log:
> Wrap pointer in a baton to avoid a complier warning or cast.

I think a single cast is better than the obfuscation of wrapping a
single value in a baton. Please reconsider this change.

-Hyrum

>
> * subversion/libsvn_wc/wc_db.c
>  (struct set_changelist_baton): New.
>  (set_changelist_txn): Go through struct.
>  (svn_wc__db_op_set_changelist): Pass baton.
>
> Modified:
>    subversion/trunk/subversion/libsvn_wc/wc_db.c
>
> Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1076645&r1=1076644&r2=1076645&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Mar  3 15:03:42 2011
> @@ -3291,6 +3291,10 @@ svn_wc__db_op_modified(svn_wc__db_t *db,
>  }
>
>
> +struct set_changelist_baton {
> +  const char *changelist;
> +};
> +
>  /* */
>  static svn_error_t *
>  set_changelist_txn(void *baton,
> @@ -3298,7 +3302,7 @@ set_changelist_txn(void *baton,
>                    const char *local_relpath,
>                    apr_pool_t *scratch_pool)
>  {
> -  const char *new_changelist = baton;
> +  struct set_changelist_baton *b = baton;
>   const char *existing_changelist;
>   svn_sqlite__stmt_t *stmt;
>   svn_boolean_t have_row;
> @@ -3315,7 +3319,7 @@ set_changelist_txn(void *baton,
>     {
>       /* We need to insert an ACTUAL node, but only if we're not attempting
>          to remove a (non-existent) changelist. */
> -      if (new_changelist == NULL)
> +      if (b->changelist == NULL)
>         return SVN_NO_ERROR;
>
>       SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
> @@ -3333,8 +3337,8 @@ set_changelist_txn(void *baton,
>       /* We have an existing row, and it simply needs to be updated, if
>          it's different. */
>       if (existing_changelist
> -            && new_changelist
> -            && strcmp(existing_changelist, new_changelist) == 0)
> +            && b->changelist
> +            && strcmp(existing_changelist, b->changelist) == 0)
>         return SVN_NO_ERROR;
>
>       SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
> @@ -3342,7 +3346,7 @@ set_changelist_txn(void *baton,
>     }
>
>   SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id, local_relpath,
> -                            new_changelist));
> +                            b->changelist));
>
>   return svn_error_return(svn_sqlite__step_done(stmt));
>  }
> @@ -3356,6 +3360,7 @@ svn_wc__db_op_set_changelist(svn_wc__db_
>  {
>   svn_wc__db_wcroot_t *wcroot;
>   const char *local_relpath;
> +  struct set_changelist_baton scb;
>
>   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
>
> @@ -3364,7 +3369,9 @@ svn_wc__db_op_set_changelist(svn_wc__db_
>                               scratch_pool, scratch_pool));
>   VERIFY_USABLE_WCROOT(wcroot);
>
> -  SVN_ERR(with_db_txn(wcroot, local_relpath, set_changelist_txn, changelist,
> +  scb.changelist = changelist;
> +
> +  SVN_ERR(with_db_txn(wcroot, local_relpath, set_changelist_txn, &scb,
>                       scratch_pool));
>
>   /* No need to flush the parent entries; changelists were not stored in the
>
>
>
Received on 2011-03-03 16:36:23 CET

This is an archived mail posted to the Subversion Dev mailing list.