You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2010/04/24 22:45:18 UTC
svn commit: r937692 - in /subversion/trunk/subversion: include/svn_subst.h
libsvn_subr/deprecated.c libsvn_subr/subst.c
Author: gstein
Date: Sat Apr 24 20:45:17 2010
New Revision: 937692
URL: http://svn.apache.org/viewvc?rev=937692&view=rev
Log:
Deprecate svn_subst_copy_and_translate3() in favor of a version that has a
cancellation function.
* subversion/include/svn_subst.h:
(svn_subst_copy_and_translate4): new function, like the translate3
version, but with CANCEL_FUNC/BATON.
(svn_subst_copy_and_translate3): mark as deprecated
* subversion/libsvn_subr/subst.c:
(detranslate_special_file): take a CANCEL_FUNC/BATON param pair and pass
it along to svn_stream_copy3(). add an svn_error_return
(svn_subst_copy_and_translate3): renamed to ...
(svn_subst_copy_and_translate4): ... this, and take a CANCEL_FUNC/BATON
pair. pass CANCEL_FUNC/BATON to detranslate_special_file and
svn_stream_copy3.
* subversion/libsvn_subr/deprecated.c:
(svn_subst_copy_and_translate3): new. call svn_subst_copy_and_translate4
with NULL for the CANCEL_FUNC/BATON.
(...): add some svn_error_return love
Modified:
subversion/trunk/subversion/include/svn_subst.h
subversion/trunk/subversion/libsvn_subr/deprecated.c
subversion/trunk/subversion/libsvn_subr/subst.c
Modified: subversion/trunk/subversion/include/svn_subst.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_subst.h?rev=937692&r1=937691&r2=937692&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_subst.h (original)
+++ subversion/trunk/subversion/include/svn_subst.h Sat Apr 24 20:45:17 2010
@@ -415,8 +415,32 @@ svn_subst_stream_from_specialfile(svn_st
* If @a eol_str and @a keywords are @c NULL, behavior is just a byte-for-byte
* copy.
*
+ * @a cancel_func and @a cancel_baton will be called (if not NULL)
+ * periodically to check for cancellation.
+ *
+ * @since New in 1.7.
+ */
+svn_error_t *
+svn_subst_copy_and_translate4(const char *src,
+ const char *dst,
+ const char *eol_str,
+ svn_boolean_t repair,
+ apr_hash_t *keywords,
+ svn_boolean_t expand,
+ svn_boolean_t special,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool);
+
+
+/**
+ * Similar to svn_subst_copy_and_translate4() but without a cancellation
+ * function and baton.
+ *
* @since New in 1.3.
+ * @deprecated Provided for backward compatibility with the 1.6 API.
*/
+SVN_DEPRECATED
svn_error_t *
svn_subst_copy_and_translate3(const char *src,
const char *dst,
@@ -427,6 +451,7 @@ svn_subst_copy_and_translate3(const char
svn_boolean_t special,
apr_pool_t *pool);
+
/**
* Similar to svn_subst_copy_and_translate3() except that @a keywords is a
* @c svn_subst_keywords_t struct instead of a keywords hash.
Modified: subversion/trunk/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/deprecated.c?rev=937692&r1=937691&r2=937692&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_subr/deprecated.c Sat Apr 24 20:45:17 2010
@@ -127,7 +127,8 @@ svn_subst_translate_stream3(svn_stream_t
dst_stream = svn_subst_stream_translated(dst_stream, eol_str, repair,
keywords, expand, pool);
- return svn_stream_copy3(src_stream, dst_stream, NULL, NULL, pool);
+ return svn_error_return(svn_stream_copy3(src_stream, dst_stream,
+ NULL, NULL, pool));
}
svn_error_t *
@@ -141,7 +142,8 @@ svn_subst_translate_stream2(svn_stream_t
{
apr_hash_t *kh = kwstruct_to_kwhash(keywords, pool);
- return svn_subst_translate_stream3(s, d, eol_str, repair, kh, expand, pool);
+ return svn_error_return(svn_subst_translate_stream3(s, d, eol_str, repair,
+ kh, expand, pool));
}
svn_error_t *
@@ -156,7 +158,7 @@ svn_subst_translate_stream(svn_stream_t
svn_error_t *err = svn_subst_translate_stream2(s, d, eol_str, repair,
keywords, expand, pool);
svn_pool_destroy(pool);
- return err;
+ return svn_error_return(err);
}
svn_error_t *
@@ -170,8 +172,9 @@ svn_subst_translate_cstring(const char *
{
apr_hash_t *kh = kwstruct_to_kwhash(keywords, pool);
- return svn_subst_translate_cstring2(src, dst, eol_str, repair,
- kh, expand, pool);
+ return svn_error_return(svn_subst_translate_cstring2(src, dst, eol_str,
+ repair, kh, expand,
+ pool));
}
svn_error_t *
@@ -183,8 +186,9 @@ svn_subst_copy_and_translate(const char
svn_boolean_t expand,
apr_pool_t *pool)
{
- return svn_subst_copy_and_translate2(src, dst, eol_str, repair, keywords,
- expand, FALSE, pool);
+ return svn_error_return(svn_subst_copy_and_translate2(src, dst, eol_str,
+ repair, keywords,
+ expand, FALSE, pool));
}
svn_error_t *
@@ -199,12 +203,30 @@ svn_subst_copy_and_translate2(const char
{
apr_hash_t *kh = kwstruct_to_kwhash(keywords, pool);
- return svn_subst_copy_and_translate3(src, dst, eol_str,
- repair, kh, expand, special,
- pool);
+ return svn_error_return(svn_subst_copy_and_translate3(src, dst, eol_str,
+ repair, kh, expand,
+ special, pool));
}
svn_error_t *
+svn_subst_copy_and_translate3(const char *src,
+ const char *dst,
+ const char *eol_str,
+ svn_boolean_t repair,
+ apr_hash_t *keywords,
+ svn_boolean_t expand,
+ svn_boolean_t special,
+ apr_pool_t *pool)
+{
+ return svn_error_return(svn_subst_copy_and_translate4(src, dst, eol_str,
+ repair, keywords,
+ expand, special,
+ NULL, NULL,
+ pool));
+}
+
+
+svn_error_t *
svn_subst_stream_translated_to_normal_form(svn_stream_t **stream,
svn_stream_t *source,
svn_subst_eol_style_t eol_style,
@@ -246,10 +268,11 @@ svn_subst_stream_detranslated(svn_stream
when the returned stream is closed. */
SVN_ERR(svn_stream_open_readonly(&src_stream, src, pool, pool));
- return svn_subst_stream_translated_to_normal_form(stream_p, src_stream,
- eol_style, eol_str,
- always_repair_eols,
- keywords, pool);
+ return svn_error_return(svn_subst_stream_translated_to_normal_form(
+ stream_p, src_stream,
+ eol_style, eol_str,
+ always_repair_eols,
+ keywords, pool));
}
svn_error_t *
@@ -269,13 +292,14 @@ svn_subst_translate_to_normal_form(const
|| eol_style == svn_subst_eol_style_none))
return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
- return svn_subst_copy_and_translate3(src, dst, eol_str,
- eol_style == svn_subst_eol_style_fixed
- || always_repair_eols,
- keywords,
- FALSE /* contract keywords */,
- special,
- pool);
+ return svn_error_return(svn_subst_copy_and_translate3(
+ src, dst, eol_str,
+ eol_style == svn_subst_eol_style_fixed
+ || always_repair_eols,
+ keywords,
+ FALSE /* contract keywords */,
+ special,
+ pool));
}
@@ -418,7 +442,8 @@ svn_opt_args_to_target_array3(apr_array_
const apr_array_header_t *known_targets,
apr_pool_t *pool)
{
- return svn_opt__args_to_target_array(targets_p, os,known_targets, pool);
+ return svn_error_return(svn_opt__args_to_target_array(targets_p, os,
+ known_targets, pool));
}
svn_error_t *
@@ -498,17 +523,17 @@ svn_opt_print_help2(apr_getopt_t *os,
const char *footer,
apr_pool_t *pool)
{
- return svn_opt_print_help3(os,
- pgm_name,
- print_version,
- quiet,
- version_footer,
- header,
- cmd_table,
- option_table,
- NULL,
- footer,
- pool);
+ return svn_error_return(svn_opt_print_help3(os,
+ pgm_name,
+ print_version,
+ quiet,
+ version_footer,
+ header,
+ cmd_table,
+ option_table,
+ NULL,
+ footer,
+ pool));
}
svn_error_t *
@@ -603,10 +628,10 @@ svn_io_open_unique_file2(apr_file_t **fi
const char *filename;
svn_path_split(path, &dirpath, &filename, pool);
- return svn_io_open_uniquely_named(file, temp_path,
- dirpath, filename, suffix,
- delete_when,
- pool, pool);
+ return svn_error_return(svn_io_open_uniquely_named(file, temp_path,
+ dirpath, filename, suffix,
+ delete_when,
+ pool, pool));
}
svn_error_t *
@@ -617,12 +642,12 @@ svn_io_open_unique_file(apr_file_t **fil
svn_boolean_t delete_on_close,
apr_pool_t *pool)
{
- return svn_io_open_unique_file2(file, temp_path,
- path, suffix,
- delete_on_close
- ? svn_io_file_del_on_close
- : svn_io_file_del_none,
- pool);
+ return svn_error_return(svn_io_open_unique_file2(file, temp_path,
+ path, suffix,
+ delete_on_close
+ ? svn_io_file_del_on_close
+ : svn_io_file_del_none,
+ pool));
}
svn_error_t *
@@ -641,9 +666,11 @@ svn_io_run_diff(const char *dir,
{
SVN_ERR(svn_path_cstring_to_utf8(&diff_cmd, diff_cmd, pool));
- return svn_io_run_diff2(dir, user_args, num_user_args, label1, label2,
- from, to, pexitcode, outfile, errfile, diff_cmd,
- pool);
+ return svn_error_return(svn_io_run_diff2(dir, user_args, num_user_args,
+ label1, label2,
+ from, to, pexitcode,
+ outfile, errfile, diff_cmd,
+ pool));
}
svn_error_t *
@@ -662,9 +689,11 @@ svn_io_run_diff3_2(int *exitcode,
{
SVN_ERR(svn_path_cstring_to_utf8(&diff3_cmd, diff3_cmd, pool));
- return svn_io_run_diff3_3(exitcode, dir, mine, older, yours, mine_label,
- older_label, yours_label, merged, diff3_cmd,
- user_args, pool);
+ return svn_error_return(svn_io_run_diff3_3(exitcode, dir,
+ mine, older, yours,
+ mine_label, older_label,
+ yours_label, merged,
+ diff3_cmd, user_args, pool));
}
svn_error_t *
@@ -680,16 +709,17 @@ svn_io_run_diff3(const char *dir,
const char *diff3_cmd,
apr_pool_t *pool)
{
- return svn_io_run_diff3_2(exitcode, dir, mine, older, yours,
- mine_label, older_label, yours_label,
- merged, diff3_cmd, NULL, pool);
+ return svn_error_return(svn_io_run_diff3_2(exitcode, dir, mine, older, yours,
+ mine_label, older_label,
+ yours_label,
+ merged, diff3_cmd, NULL, pool));
}
svn_error_t *
svn_io_remove_file(const char *path,
apr_pool_t *scratch_pool)
{
- return svn_io_remove_file2(path, FALSE, scratch_pool);
+ return svn_error_return(svn_io_remove_file2(path, FALSE, scratch_pool));
}
/*** From constructors.c ***/
@@ -715,7 +745,8 @@ svn_cmdline_prompt_user(const char **res
const char *prompt_str,
apr_pool_t *pool)
{
- return svn_cmdline_prompt_user2(result, prompt_str, NULL, pool);
+ return svn_error_return(svn_cmdline_prompt_user2(result, prompt_str, NULL,
+ pool));
}
svn_error_t *
@@ -730,10 +761,11 @@ svn_cmdline_setup_auth_baton(svn_auth_ba
void *cancel_baton,
apr_pool_t *pool)
{
- return svn_cmdline_create_auth_baton(ab, non_interactive,
- auth_username, auth_password,
- config_dir, no_auth_cache, FALSE,
- cfg, cancel_func, cancel_baton, pool);
+ return svn_error_return(svn_cmdline_create_auth_baton(
+ ab, non_interactive,
+ auth_username, auth_password,
+ config_dir, no_auth_cache, FALSE,
+ cfg, cancel_func, cancel_baton, pool));
}
/*** From dso.c ***/
@@ -837,17 +869,19 @@ svn_error_t *svn_stream_copy2(svn_stream
void *cancel_baton,
apr_pool_t *scratch_pool)
{
- return svn_stream_copy3(svn_stream_disown(from, scratch_pool),
- svn_stream_disown(to, scratch_pool),
- cancel_func, cancel_baton, scratch_pool);
+ return svn_error_return(svn_stream_copy3(
+ svn_stream_disown(from, scratch_pool),
+ svn_stream_disown(to, scratch_pool),
+ cancel_func, cancel_baton, scratch_pool));
}
svn_error_t *svn_stream_copy(svn_stream_t *from, svn_stream_t *to,
apr_pool_t *scratch_pool)
{
- return svn_stream_copy3(svn_stream_disown(from, scratch_pool),
- svn_stream_disown(to, scratch_pool),
- NULL, NULL, scratch_pool);
+ return svn_error_return(svn_stream_copy3(
+ svn_stream_disown(from, scratch_pool),
+ svn_stream_disown(to, scratch_pool),
+ NULL, NULL, scratch_pool));
}
svn_stream_t *
@@ -918,8 +952,9 @@ svn_mergeinfo_inheritable(svn_mergeinfo_
svn_revnum_t end,
apr_pool_t *pool)
{
- return svn_mergeinfo_inheritable2(output, mergeinfo, path, start, end,
- TRUE, pool, pool);
+ return svn_error_return(svn_mergeinfo_inheritable2(output, mergeinfo, path,
+ start, end,
+ TRUE, pool, pool));
}
svn_error_t *
@@ -929,7 +964,8 @@ svn_rangelist_inheritable(apr_array_head
svn_revnum_t end,
apr_pool_t *pool)
{
- return svn_rangelist_inheritable2(inheritable_rangelist, rangelist,
- start, end, TRUE, pool, pool);
+ return svn_error_return(svn_rangelist_inheritable2(inheritable_rangelist,
+ rangelist,
+ start, end, TRUE,
+ pool, pool));
}
-
Modified: subversion/trunk/subversion/libsvn_subr/subst.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/subst.c?rev=937692&r1=937691&r2=937692&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/subst.c (original)
+++ subversion/trunk/subversion/libsvn_subr/subst.c Sat Apr 24 20:45:17 2010
@@ -1341,6 +1341,7 @@ svn_subst_translate_cstring2(const char
/* ### this should be folded into svn_subst_copy_and_translate3 */
static svn_error_t *
detranslate_special_file(const char *src, const char *dst,
+ svn_cancel_func_t cancel_func, void *cancel_baton,
apr_pool_t *scratch_pool)
{
const char *dst_tmp;
@@ -1355,10 +1356,11 @@ detranslate_special_file(const char *src
scratch_pool, scratch_pool));
SVN_ERR(svn_subst_read_specialfile(&src_stream, src,
scratch_pool, scratch_pool));
- SVN_ERR(svn_stream_copy3(src_stream, dst_stream, NULL, NULL, scratch_pool));
+ SVN_ERR(svn_stream_copy3(src_stream, dst_stream,
+ cancel_func, cancel_baton, scratch_pool));
/* Do the atomic rename from our temporary location. */
- return svn_io_file_rename(dst_tmp, dst, scratch_pool);
+ return svn_error_return(svn_io_file_rename(dst_tmp, dst, scratch_pool));
}
/* Creates a special file DST from the "normal form" located in SOURCE.
@@ -1437,13 +1439,15 @@ create_special_file_from_stream(svn_stre
svn_error_t *
-svn_subst_copy_and_translate3(const char *src,
+svn_subst_copy_and_translate4(const char *src,
const char *dst,
const char *eol_str,
svn_boolean_t repair,
apr_hash_t *keywords,
svn_boolean_t expand,
svn_boolean_t special,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
apr_pool_t *pool)
{
svn_stream_t *src_stream;
@@ -1483,7 +1487,10 @@ svn_subst_copy_and_translate3(const char
}
/* else !expand */
- return svn_error_return(detranslate_special_file(src, dst, pool));
+ return svn_error_return(detranslate_special_file(src, dst,
+ cancel_func,
+ cancel_baton,
+ pool));
}
/* The easy way out: no translation needed, just copy. */
@@ -1503,7 +1510,8 @@ svn_subst_copy_and_translate3(const char
keywords, expand, pool);
/* ###: use cancel func/baton in place of NULL/NULL below. */
- err = svn_stream_copy3(src_stream, dst_stream, NULL, NULL, pool);
+ err = svn_stream_copy3(src_stream, dst_stream, cancel_func, cancel_baton,
+ pool);
if (err)
{
/* On errors, we have a pathname available. */