Author: rinrab
Date: Tue May 27 12:14:25 2025
New Revision: 1925865
URL: http://svn.apache.org/viewvc?rev=1925865&view=rev
Log:
On the 'utf8-cmdline-prototype' branch: Allocate exact amount of nelts
needed for targets array in svn_client_args_to_target_array() family,
and drop SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE constant.
* subversion/libsvn_client/client.h
(SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE): remove.
* subversion/libsvn_client/cmdline.c
(svn_client__process_target_array): ditto for input_targets and
output_targets. Allocate reserved_names for one item, because in most
cases it wouldn't contain that many items, since it is needed to throw
an error.
(svn_client_args_to_target_array3): ditto and format code.
* subversion/libsvn_client/deprecated.c
(svn_client_args_to_target_array2): ditto.
Modified:
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/client.h
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/deprecated.c
Modified:
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/client.h
URL:
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/client.h?rev=1925865&r1=1925864&r2=1925865&view=diff
==============================================================================
---
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/client.h
(original)
+++
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/client.h
Tue May 27 12:14:25 2025
@@ -1280,8 +1280,6 @@ svn_client__textbase_sync(svn_ra_session
const svn_version_t *
svn_client__compatible_wc_version_optional_pristine(apr_pool_t *result_pool);
-#define SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE 5
-
/* Helper for svn_client_args_to_target_array2 and
* svn_client_args_to_target_array3.
*/
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=1925865&r1=1925864&r2=1925865&view=diff
==============================================================================
---
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c
(original)
+++
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c
Tue May 27 12:14:25 2025
@@ -122,9 +122,9 @@ svn_client__process_target_array(apr_arr
svn_boolean_t rel_url_found = FALSE;
const char *root_url = NULL;
apr_array_header_t *input_targets = apr_array_make(
- pool, SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE, sizeof(const char *));
+ pool, utf8_targets->nelts, sizeof(const char *));
apr_array_header_t *output_targets = apr_array_make(
- pool, SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE, sizeof(const char *));
+ pool, utf8_targets->nelts, sizeof(const char *));
apr_array_header_t *reserved_names = NULL;
/* Step 1: create a master array of targets that are in UTF-8
@@ -271,9 +271,8 @@ svn_client__process_target_array(apr_arr
if (svn_wc_is_adm_dir(base_name, pool))
{
if (!reserved_names)
- reserved_names = apr_array_make(
- pool, SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE,
- sizeof(const char *));
+ reserved_names = apr_array_make(pool, 1,
+ sizeof(const char *));
APR_ARRAY_PUSH(reserved_names, const char *) = utf8_target;
@@ -374,14 +373,14 @@ svn_client_args_to_target_array3(apr_arr
apr_pool_t *pool)
{
apr_array_header_t *utf8_input_targets = apr_array_make(
- pool, SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE, sizeof(const char *));
+ pool, os->argc - os->ind, sizeof(const char *));
for (; os->ind < os->argc; os->ind++)
{
APR_ARRAY_PUSH(utf8_input_targets, const char *) = os->argv[os->ind];
}
- return svn_error_trace(
- svn_client__process_target_array(targets_p, utf8_input_targets,
known_targets, ctx,
- keep_last_origpath_on_truepath_collision, pool));
+ return svn_error_trace(svn_client__process_target_array(
+ targets_p, utf8_input_targets, known_targets, ctx,
+ keep_last_origpath_on_truepath_collision, pool));
}
Modified:
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/deprecated.c
URL:
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/deprecated.c?rev=1925865&r1=1925864&r2=1925865&view=diff
==============================================================================
---
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/deprecated.c
(original)
+++
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/deprecated.c
Tue May 27 12:14:25 2025
@@ -451,7 +451,7 @@ svn_client_args_to_target_array2(apr_arr
apr_pool_t *pool)
{
apr_array_header_t *utf8_input_targets = apr_array_make(
- pool, SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE, sizeof(const char *));
+ pool, os->argc - os->ind, sizeof(const char *));
for (; os->ind < os->argc; os->ind++)
{