Author: rinrab
Date: Sun Jun 8 14:20:47 2025
New Revision: 1926253
URL: http://svn.apache.org/viewvc?rev=1926253&view=rev
Log:
Factor-out svn_opt__process_target_array() function that handles target
collection of svn_opt layer, operating with apr_array_header_t.
(merged from utf8-cmdline-prototype@r1925867,r1925876,r1925878)
* subversion/include/private/svn_opt_private.h
(svn_opt__process_target_array): declare.
* subversion/libsvn_subr/deprecated.c
(svn_opt_args_to_target_array3): Implement svn_opt_args_to_target_array3()
through svn_opt__process_target_array() and convert args manually, instead
of relying on svn_opt__args_to_target().
* subversion/libsvn_subr/opt.c
(svn_opt__args_to_target_array): now it just converts os to array and calls
svn_opt__process_target_array().
(svn_opt__process_target_array): renamed from svn_opt__args_to_target_array
and adjusted parameters.
Modified:
subversion/trunk/ (props changed)
subversion/trunk/subversion/include/private/svn_opt_private.h
subversion/trunk/subversion/libsvn_subr/deprecated.c
subversion/trunk/subversion/libsvn_subr/opt.c
Propchange: subversion/trunk/
------------------------------------------------------------------------------
Merged /subversion/branches/utf8-cmdline-prototype:r1925867,1925876,1925878
Modified: subversion/trunk/subversion/include/private/svn_opt_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_opt_private.h?rev=1926253&r1=1926252&r2=1926253&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_opt_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_opt_private.h Sun Jun 8 14:20:47 2025
@@ -115,6 +115,12 @@ svn_opt__args_to_target_array(apr_array_
const apr_array_header_t *known_targets,
apr_pool_t *pool);
+svn_error_t *
+svn_opt__process_target_array(apr_array_header_t **targets_p,
+ apr_array_header_t *utf8_input_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/trunk/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/deprecated.c?rev=1926253&r1=1926252&r2=1926253&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_subr/deprecated.c Sun Jun 8 14:20:47 2025
@@ -814,8 +814,22 @@ svn_opt_args_to_target_array3(apr_array_
const apr_array_header_t *known_targets,
apr_pool_t *pool)
{
- return svn_error_trace(svn_opt__args_to_target_array(targets_p, os,
- known_targets, pool));
+ apr_array_header_t *utf8_input_targets =
+ apr_array_make(pool, os->argc - os->ind, sizeof(const char *));
+
+ for (; os->ind < os->argc; os->ind++)
+ {
+ /* The apr_getopt targets are still in native encoding. */
+ const char *raw_target = os->argv[os->ind];
+ const char *utf8_target;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_target, raw_target, pool));
+
+ APR_ARRAY_PUSH(utf8_input_targets, const char *) = utf8_target;
+ }
+
+ return svn_error_trace(svn_opt__process_target_array(
+ targets_p, utf8_input_targets, known_targets, pool));
}
svn_error_t *
Modified: subversion/trunk/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/opt.c?rev=1926253&r1=1926252&r2=1926253&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/opt.c (original)
+++ subversion/trunk/subversion/libsvn_subr/opt.c Sun Jun 8 14:20:47 2025
@@ -218,35 +218,47 @@ svn_opt_parse_path(svn_opt_revision_t *r
return SVN_NO_ERROR;
}
-
-/* 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 *
svn_opt__args_to_target_array(apr_array_header_t **targets_p,
apr_getopt_t *os,
const apr_array_header_t *known_targets,
apr_pool_t *pool)
{
- int i;
- svn_error_t *err = SVN_NO_ERROR;
- apr_array_header_t *input_targets =
- apr_array_make(pool, DEFAULT_ARRAY_SIZE, sizeof(const char *));
- apr_array_header_t *output_targets =
- apr_array_make(pool, DEFAULT_ARRAY_SIZE, sizeof(const char *));
-
- /* Step 1: create a master array of targets that are in UTF-8
- encoding, and come from concatenating the targets left by apr_getopt,
- plus any extra targets (e.g., from the --targets switch.) */
+ apr_array_header_t *utf8_input_targets =
+ apr_array_make(pool, os->argc - os->ind, sizeof(const char *));
for (; os->ind < os->argc; os->ind++)
{
/* The apr_getopt targets are still in native encoding. */
const char *raw_target = os->argv[os->ind];
- SVN_ERR(svn_utf_cstring_to_utf8
- ((const char **) apr_array_push(input_targets),
- raw_target, pool));
+ const char *utf8_target;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_target, raw_target, pool));
+
+ APR_ARRAY_PUSH(utf8_input_targets, const char *) = utf8_target;
}
+ return svn_error_trace(svn_opt__process_target_array(
+ targets_p, utf8_input_targets, known_targets, pool));
+}
+
+/* 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 *
+svn_opt__process_target_array(apr_array_header_t **targets_p,
+ apr_array_header_t *input_targets,
+ const apr_array_header_t *known_targets,
+ apr_pool_t *pool)
+{
+ int i;
+ svn_error_t *err = SVN_NO_ERROR;
+ apr_array_header_t *output_targets =
+ apr_array_make(pool, DEFAULT_ARRAY_SIZE, sizeof(const char *));
+
+ /* Step 1: create a master array of targets, and come from concatenating
+ the targets left by apr_getopt, plus any extra targets (e.g., from the
+ --targets switch.) */
+
if (known_targets)
{
for (i = 0; i < known_targets->nelts; i++)
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.