svn commit: r1926219 - in /subversion/trunk: ./ subversion/include/private/svn_opt_private.h subversion/libsvn_subr/opt.c

[email protected]
Newsgroups gmane.comp.version-control.subversion.svn
Message-ID <[email protected]>
Author: rinrab
Date: Sat Jun  7 18:03:41 2025
New Revision: 1926219

URL: http://svn.apache.org/viewvc?rev=1926219&view=rev
Log:
Implement svn_opt__args_to_target_array() through an internal helper
svn_opt__process_target_array().

(merged from utf8-cmdline-prototype@r1925867)

* subversion/include/private/svn_opt_private.h
  (svn_opt__process_target_array): declare.
* subversion/libsvn_subr/opt.c
  (svn_opt__args_to_target_array): now it just converts os to array.
  (svn_opt__process_target_array): renamed from svn_opt__args_to_target_array
   and adjusted parameters.

No functional changes.

Modified:
    subversion/trunk/   (props changed)
    subversion/trunk/subversion/include/private/svn_opt_private.h
    subversion/trunk/subversion/libsvn_subr/opt.c

Propchange: subversion/trunk/
------------------------------------------------------------------------------
  Merged /subversion/branches/utf8-cmdline-prototype:r1925867

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=1926219&r1=1926218&r2=1926219&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_opt_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_opt_private.h Sat Jun  7 18:03:41 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/opt.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/opt.c?rev=1926219&r1=1926218&r2=1926219&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/opt.c (original)
+++ subversion/trunk/subversion/libsvn_subr/opt.c Sat Jun  7 18:03:41 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.