Author: rinrab Date: Thu May 29 17:04:40 2025 New Revision: 1925944 URL: http://svn.apache.org/viewvc?rev=1925944&view=rev Log: On the 'utf8-cmdline-prototype' branch: Move svn_opt__collect_targets() from libsvn_client/cmdline.c to libsvn_subr/opt.c and declare it as internal function in svn_opt_private.h header.
Modified: subversion/branches/utf8-cmdline-prototype/subversion/include/private/svn_opt_private.h subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/opt.c Modified: subversion/branches/utf8-cmdline-prototype/subversion/include/private/svn_opt_private.h URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/include/private/svn_opt_private.h?rev=1925944&r1=1925943&r2=1925944&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/include/private/svn_opt_private.h (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/include/private/svn_opt_private.h Thu May 29 17:04:40 2025 @@ -122,6 +122,20 @@ svn_opt__process_target_array(apr_array_ apr_pool_t *pool); /** + * Collects targets from @a utf8_targets (unamed arguments from apr_getopt) + * and @a known_targets (--targets). + * + * If a relative URL was found, sets @a rel_url_found_p to @c TRUE, if + * it is not @c NULL. + */ +svn_error_t * +svn_opt__collect_targets(apr_array_header_t **targets_p, + svn_boolean_t *rel_url_found_p, + const apr_array_header_t *utf8_targets, + const apr_array_header_t *known_targets, + apr_pool_t *pool); + +/** * Return a human-readable description of @a revision. The result * will be allocated statically or from @a result_pool. * Modified: subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c?rev=1925944&r1=1925943&r2=1925944&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c Thu May 29 17:04:40 2025 @@ -108,54 +108,6 @@ check_root_url_of_target(const char **ro return SVN_NO_ERROR; } -/** - * Collects targets from @a utf8_targets (unamed arguments from apr_getopt) - * and @a known_targets (--targets). - * - * If a relative URL was found, sets @a rel_url_found_p to @c TRUE, if - * it is not @c NULL. - */ -static svn_error_t * -collect_targets(apr_array_header_t **targets_p, - svn_boolean_t *rel_url_found_p, - const apr_array_header_t *utf8_targets, - const apr_array_header_t *known_targets, - apr_pool_t *pool) -{ - int i; - apr_array_header_t *input_targets = apr_array_make( - pool, utf8_targets->nelts + known_targets->nelts, sizeof(const char *)); - - for (i = 0; i < utf8_targets->nelts; i++) - { - const char *utf8_target = APR_ARRAY_IDX(utf8_targets, i, const char *); - - if (rel_url_found_p != NULL && - svn_path_is_repos_relative_url(utf8_target)) - *rel_url_found_p = TRUE; - - APR_ARRAY_PUSH(input_targets, const char *) = utf8_target; - } - - if (known_targets) - { - for (i = 0; i < known_targets->nelts; i++) - { - /* The --targets array have already been converted to UTF-8, - because we needed to split up the list with svn_cstring_split. */ - const char *utf8_target = APR_ARRAY_IDX(known_targets, - i, const char *); - - if (rel_url_found_p != NULL && - svn_path_is_repos_relative_url(utf8_target)) - *rel_url_found_p = TRUE; - - APR_ARRAY_PUSH(input_targets, const char *) = utf8_target; - } - } - - *targets_p = input_targets; -} /* Note: This is substantially copied from svn_opt__args_to_target_array() in * order to move to libsvn_client while maintaining backward compatibility. */ @@ -180,8 +132,8 @@ svn_client__process_target_array(apr_arr If any of the targets are relative urls, then set the rel_url_found flag.*/ - SVN_ERR(collect_targets(&input_targets, &rel_url_found, - utf8_targets, known_targets, pool)); + SVN_ERR(svn_opt__collect_targets(&input_targets, &rel_url_found, + utf8_targets, known_targets, pool)); /* Step 2: process each target. */ Modified: subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/opt.c URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/opt.c?rev=1925944&r1=1925943&r2=1925944&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/opt.c (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/opt.c Thu May 29 17:04:40 2025 @@ -247,6 +247,48 @@ svn_opt__args_to_target_array(apr_array_ targets_p, utf8_input_targets, known_targets, pool)); } +svn_error_t * +svn_opt__collect_targets(apr_array_header_t **targets_p, + svn_boolean_t *rel_url_found_p, + const apr_array_header_t *utf8_targets, + const apr_array_header_t *known_targets, + apr_pool_t *pool) +{ + int i; + apr_array_header_t *input_targets = apr_array_make( + pool, utf8_targets->nelts + known_targets->nelts, sizeof(const char *)); + + for (i = 0; i < utf8_targets->nelts; i++) + { + const char *utf8_target = APR_ARRAY_IDX(utf8_targets, i, const char *); + + if (rel_url_found_p != NULL && + svn_path_is_repos_relative_url(utf8_target)) + *rel_url_found_p = TRUE; + + APR_ARRAY_PUSH(input_targets, const char *) = utf8_target; + } + + if (known_targets) + { + for (i = 0; i < known_targets->nelts; i++) + { + /* The --targets array have already been converted to UTF-8, + because we needed to split up the list with svn_cstring_split. */ + const char *utf8_target = APR_ARRAY_IDX(known_targets, + i, const char *); + + if (rel_url_found_p != NULL && + svn_path_is_repos_relative_url(utf8_target)) + *rel_url_found_p = TRUE; + + APR_ARRAY_PUSH(input_targets, const char *) = utf8_target; + } + } + + *targets_p = input_targets; +} + /* Note: This is substantially copied into svn_client_args_to_target_array() in * order to move to libsvn_client while maintaining backward compatibility. */ svn_error_t *