Author: rinrab
Date: Fri Jun 27 21:18:51 2025
New Revision: 1926778

URL: http://svn.apache.org/viewvc?rev=1926778&view=rev
Log:
On the 'utf8-cmdline-prototype' branch: Recover usage of a constant for
allocating arrays in argument conversion functions, since it could
potentially be considered as an unrelated change.

Note: it's much better to use either known length (if available), or
allocating an array for a single element (with length of '1'), but not
'5' as it is right now. This should all be done in trunk.

* subversion/libsvn_client/cmdline.c
  (DEFAULT_ARRAY_SIZE): Recover constant.
  (svn_client__process_target_array): Use the constant to allocating
   input_targets, output_targets, reserved_names arrays.

Modified:
    
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c

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=1926778&r1=1926777&r2=1926778&view=diff
==============================================================================
--- 
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c 
(original)
+++ 
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c 
Fri Jun 27 21:18:51 2025
@@ -41,6 +41,8 @@
 
 /*** Code. ***/
 
+#define DEFAULT_ARRAY_SIZE 5
+
 
 /* Attempt to find the repository root url for TARGET, possibly using CTX for
  * authentication.  If one is found and *ROOT_URL is not NULL, then just check
@@ -122,9 +124,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, utf8_targets->nelts, sizeof(const char *));
+    pool, DEFAULT_ARRAY_SIZE, sizeof(const char *));
   apr_array_header_t *output_targets = apr_array_make(
-    pool, utf8_targets->nelts, sizeof(const char *));
+    pool, DEFAULT_ARRAY_SIZE, sizeof(const char *));
   apr_array_header_t *reserved_names = NULL;
 
   /* Step 1:  create a master array of targets that are in UTF-8
@@ -271,7 +273,7 @@ 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, 1,
+                    reserved_names = apr_array_make(pool, DEFAULT_ARRAY_SIZE,
                                                     sizeof(const char *));
 
                   APR_ARRAY_PUSH(reserved_names, const char *) = utf8_target;


Reply via email to