You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/05/20 11:28:59 UTC
svn commit: r946577 - in /subversion/trunk/subversion:
include/private/svn_skel.h libsvn_fs_base/revs-txns.c libsvn_subr/skel.c
libsvn_wc/wc_db.c svn/diff-cmd.c
Author: julianfoad
Date: Thu May 20 09:28:59 2010
New Revision: 946577
URL: http://svn.apache.org/viewvc?rev=946577&view=rev
Log:
Avoid casting away "const" in a few places.
* subversion/include/private/svn_skel.h,
subversion/libsvn_subr/skel.c
(svn_skel__append): Remove "const" from the skel parameter, because, even
though it is not *modified* by this function, it must be *modifiable* in
order to be part of the list. Thus, no longer cast away "const" in the
implementation.
* subversion/libsvn_fs_base/revs-txns.c
(txn_body_cleanup_txn_copy, txn_body_cleanup_txn_changes,
txn_body_delete_txn): Dereference the "baton" parameter instead of
type-casting it to get the desired "const char *" pointer.
(svn_fs_base__purge_txn): Instead of casting away "const" to pass the
required "const char *" pointer as a "void *" baton, pass its address.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_read_conflict_victims): Use an intermediate variable to avoid
casting away "const".
* subversion/svn/diff-cmd.c
(summarize_xml, summarize_regular): Dereference the "baton" parameter
instead of type-casting it to get the desired "const char *" pointer.
(svn_cl__diff): Instead of casting away "const" to pass the required
"const char *" pointer as a "void *" baton, pass its address.
Modified:
subversion/trunk/subversion/include/private/svn_skel.h
subversion/trunk/subversion/libsvn_fs_base/revs-txns.c
subversion/trunk/subversion/libsvn_subr/skel.c
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/svn/diff-cmd.c
Modified: subversion/trunk/subversion/include/private/svn_skel.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_skel.h?rev=946577&r1=946576&r2=946577&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_skel.h (original)
+++ subversion/trunk/subversion/include/private/svn_skel.h Thu May 20 09:28:59 2010
@@ -142,7 +142,7 @@ void svn_skel__prepend(svn_skel_t *skel,
generally want to use svn_skel__prepend().
NOTE: careful of the argument order here. */
-void svn_skel__append(svn_skel_t *list, const svn_skel_t *skel);
+void svn_skel__append(svn_skel_t *list, svn_skel_t *skel);
/* Create an atom skel whose contents are the string representation
Modified: subversion/trunk/subversion/libsvn_fs_base/revs-txns.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/revs-txns.c?rev=946577&r1=946576&r2=946577&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/revs-txns.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/revs-txns.c Thu May 20 09:28:59 2010
@@ -992,7 +992,8 @@ txn_body_cleanup_txn(void *baton, trail_
static svn_error_t *
txn_body_cleanup_txn_copy(void *baton, trail_t *trail)
{
- svn_error_t *err = svn_fs_bdb__delete_copy(trail->fs, baton, trail,
+ const char *copy_id = *(const char **)baton;
+ svn_error_t *err = svn_fs_bdb__delete_copy(trail->fs, copy_id, trail,
trail->pool);
/* Copy doesn't exist? No sweat. */
@@ -1008,7 +1009,9 @@ txn_body_cleanup_txn_copy(void *baton, t
static svn_error_t *
txn_body_cleanup_txn_changes(void *baton, trail_t *trail)
{
- return svn_fs_bdb__changes_delete(trail->fs, baton, trail, trail->pool);
+ const char *key = *(const char **)baton;
+
+ return svn_fs_bdb__changes_delete(trail->fs, key, trail, trail->pool);
}
@@ -1122,7 +1125,9 @@ delete_txn_tree(svn_fs_t *fs,
static svn_error_t *
txn_body_delete_txn(void *baton, trail_t *trail)
{
- return svn_fs_bdb__delete_txn(trail->fs, baton, trail, trail->pool);
+ const char *txn_id = *(const char **)baton;
+
+ return svn_fs_bdb__delete_txn(trail->fs, txn_id, trail, trail->pool);
}
@@ -1151,7 +1156,7 @@ svn_fs_base__purge_txn(svn_fs_t *fs,
/* Kill the transaction's changes (which should gracefully recover
if...). */
SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_cleanup_txn_changes,
- (void *)txn_id, TRUE, pool));
+ &txn_id, TRUE, pool));
/* Kill the transaction's copies (which should gracefully...). */
if (txn->copies)
@@ -1160,14 +1165,14 @@ svn_fs_base__purge_txn(svn_fs_t *fs,
{
SVN_ERR(svn_fs_base__retry_txn
(fs, txn_body_cleanup_txn_copy,
- (void *)APR_ARRAY_IDX(txn->copies, i, const char *),
+ &APR_ARRAY_IDX(txn->copies, i, const char *),
TRUE, pool));
}
}
/* Kill the transaction itself (which ... just kidding -- this has
no graceful failure mode). */
- return svn_fs_base__retry_txn(fs, txn_body_delete_txn, (void *)txn_id,
+ return svn_fs_base__retry_txn(fs, txn_body_delete_txn, &txn_id,
TRUE, pool);
}
Modified: subversion/trunk/subversion/libsvn_subr/skel.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/skel.c?rev=946577&r1=946576&r2=946577&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/skel.c (original)
+++ subversion/trunk/subversion/libsvn_subr/skel.c Thu May 20 09:28:59 2010
@@ -612,20 +612,20 @@ void svn_skel__prepend_str(const char *v
}
-void svn_skel__append(svn_skel_t *list_skel, const svn_skel_t *skel)
+void svn_skel__append(svn_skel_t *list_skel, svn_skel_t *skel)
{
SVN_ERR_ASSERT_NO_RETURN(list_skel != NULL && !list_skel->is_atom);
if (list_skel->children == NULL)
{
- list_skel->children = (svn_skel_t *)skel;
+ list_skel->children = skel;
}
else
{
list_skel = list_skel->children;
while (list_skel->next != NULL)
list_skel = list_skel->next;
- list_skel->next = (svn_skel_t *)skel;
+ list_skel->next = skel;
}
}
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=946577&r1=946576&r2=946577&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu May 20 09:28:59 2010
@@ -6078,6 +6078,7 @@ svn_wc__db_read_conflict_victims(const a
const char *tree_conflict_data;
svn_boolean_t have_row;
apr_hash_t *found;
+ apr_array_header_t *found_keys;
*victims = NULL;
@@ -6142,7 +6143,8 @@ svn_wc__db_read_conflict_victims(const a
}
}
- SVN_ERR(svn_hash_keys((apr_array_header_t **)victims, found, result_pool));
+ SVN_ERR(svn_hash_keys(&found_keys, found, result_pool));
+ *victims = found_keys;
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/svn/diff-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/diff-cmd.c?rev=946577&r1=946576&r2=946577&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/diff-cmd.c (original)
+++ subversion/trunk/subversion/svn/diff-cmd.c Thu May 20 09:28:59 2010
@@ -83,12 +83,12 @@ kind_to_word(svn_client_diff_summarize_k
* the path the working copy root corresponds to. */
static svn_error_t *
summarize_xml(const svn_client_diff_summarize_t *summary,
- void *baton,
- apr_pool_t *pool)
+ void *baton,
+ apr_pool_t *pool)
{
/* Full path to the object being diffed. This is created by taking the
* baton, and appending the target's relative path. */
- const char *path = baton;
+ const char *path = *(const char **)baton;
svn_stringbuf_t *sb = svn_stringbuf_create("", pool);
/* Tack on the target path, so we can differentiate between different parts
@@ -115,10 +115,10 @@ summarize_xml(const svn_client_diff_summ
* svn_client_diff_summarize_func_t interface. */
static svn_error_t *
summarize_regular(const svn_client_diff_summarize_t *summary,
- void *baton,
- apr_pool_t *pool)
+ void *baton,
+ apr_pool_t *pool)
{
- const char *path = baton;
+ const char *path = *(const char **)baton;
/* Tack on the target path, so we can differentiate between different parts
* of the output when we're given multiple targets. */
@@ -335,8 +335,7 @@ svn_cl__diff(apr_getopt_t *os,
opt_state->depth,
! opt_state->notice_ancestry,
opt_state->changelists,
- summarize_func,
- (void *) target1,
+ summarize_func, &target1,
ctx, iterpool));
else
SVN_ERR(svn_client_diff5
@@ -380,8 +379,7 @@ svn_cl__diff(apr_getopt_t *os,
opt_state->depth,
! opt_state->notice_ancestry,
opt_state->changelists,
- summarize_func,
- (void *) truepath,
+ summarize_func, &truepath,
ctx, iterpool));
else
SVN_ERR(svn_client_diff_peg5