You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/03/04 16:33:48 UTC
svn commit: r1078008 - /subversion/trunk/subversion/libsvn_wc/wc_db.c
Author: hwright
Date: Fri Mar 4 15:33:48 2011
New Revision: 1078008
URL: http://svn.apache.org/viewvc?rev=1078008&view=rev
Log:
With Philip's permission, revert r1076645, while at the same time adding a
cast from const to silence a compiler warning. Mail thread is here:
http://svn.haxx.se/dev/archive-2011-03/0100.shtml
* subversion/libsvn_wc/wc_db.c
(set_changelist_baton): Remove.
(set_changelist_txn): Don't use the baton struct, just the baton.
(svn_wc__db_op_set_changelist): Don't use a baton, just cast const away
from the changelist param.
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=1078008&r1=1078007&r2=1078008&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Mar 4 15:33:48 2011
@@ -3291,10 +3291,6 @@ 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,
@@ -3302,7 +3298,7 @@ set_changelist_txn(void *baton,
const char *local_relpath,
apr_pool_t *scratch_pool)
{
- struct set_changelist_baton *b = baton;
+ const char *new_changelist = baton;
const char *existing_changelist;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
@@ -3319,7 +3315,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 (b->changelist == NULL)
+ if (new_changelist == NULL)
return SVN_NO_ERROR;
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -3337,8 +3333,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
- && b->changelist
- && strcmp(existing_changelist, b->changelist) == 0)
+ && new_changelist
+ && strcmp(existing_changelist, new_changelist) == 0)
return SVN_NO_ERROR;
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -3346,7 +3342,7 @@ set_changelist_txn(void *baton,
}
SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id, local_relpath,
- b->changelist));
+ new_changelist));
return svn_error_return(svn_sqlite__step_done(stmt));
}
@@ -3360,7 +3356,6 @@ 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));
@@ -3369,10 +3364,8 @@ svn_wc__db_op_set_changelist(svn_wc__db_
scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- scb.changelist = changelist;
-
- SVN_ERR(with_db_txn(wcroot, local_relpath, set_changelist_txn, &scb,
- scratch_pool));
+ SVN_ERR(with_db_txn(wcroot, local_relpath, set_changelist_txn,
+ (void *) changelist, scratch_pool));
/* No need to flush the parent entries; changelists were not stored in the
stub */
Re: svn commit: r1078008 - /subversion/trunk/subversion/libsvn_wc/wc_db.c
Posted by Greg Stein <gs...@gmail.com>.
On Fri, Mar 4, 2011 at 11:19, Hyrum K Wright <hy...@hyrumwright.org> wrote:
> 2011/3/4 Branko Čibej <br...@e-reka.si>:
>> On 04.03.2011 16:33, hwright@apache.org wrote:
>>> Author: hwright
>>> Date: Fri Mar 4 15:33:48 2011
>>> New Revision: 1078008
>>>
>>>
>>> - scb.changelist = changelist;
>>> -
>>> - SVN_ERR(with_db_txn(wcroot, local_relpath, set_changelist_txn, &scb,
>>> - scratch_pool));
>>> + SVN_ERR(with_db_txn(wcroot, local_relpath, set_changelist_txn,
>>> + (void *) changelist, scratch_pool));
>>
>> This is not casting const away. This is changing the type. I know it's a
>> nitpick, but strictly speaking, your log message is wrong.
>
> At the risk of building a bikeshed of epic proportions, which
> construct would be favored in this case (char *) or (void *)?
(void *) ... if we're going to have an explicit cast, then may as well
make it the target (rather than one explicit plus one implicit).
Cheers,
-g
Re: svn commit: r1078008 - /subversion/trunk/subversion/libsvn_wc/wc_db.c
Posted by Hyrum K Wright <hy...@hyrumwright.org>.
2011/3/4 Branko Čibej <br...@e-reka.si>:
> On 04.03.2011 16:33, hwright@apache.org wrote:
>> Author: hwright
>> Date: Fri Mar 4 15:33:48 2011
>> New Revision: 1078008
>>
>>
>> - scb.changelist = changelist;
>> -
>> - SVN_ERR(with_db_txn(wcroot, local_relpath, set_changelist_txn, &scb,
>> - scratch_pool));
>> + SVN_ERR(with_db_txn(wcroot, local_relpath, set_changelist_txn,
>> + (void *) changelist, scratch_pool));
>
> This is not casting const away. This is changing the type. I know it's a
> nitpick, but strictly speaking, your log message is wrong.
At the risk of building a bikeshed of epic proportions, which
construct would be favored in this case (char *) or (void *)?
-Hyrum
Re: svn commit: r1078008 - /subversion/trunk/subversion/libsvn_wc/wc_db.c
Posted by Branko Čibej <br...@e-reka.si>.
On 04.03.2011 16:33, hwright@apache.org wrote:
> Author: hwright
> Date: Fri Mar 4 15:33:48 2011
> New Revision: 1078008
>
>
> - scb.changelist = changelist;
> -
> - SVN_ERR(with_db_txn(wcroot, local_relpath, set_changelist_txn, &scb,
> - scratch_pool));
> + SVN_ERR(with_db_txn(wcroot, local_relpath, set_changelist_txn,
> + (void *) changelist, scratch_pool));
This is not casting const away. This is changing the type. I know it's a
nitpick, but strictly speaking, your log message is wrong.
-- Brane