Author: ivan
Date: Sat Sep 19 13:16:35 2026
New Revision: 1938367

Log:
Simplify code a bit by using svn_prop_get_value() instead of svn_hash_gets()
to property value from properties hash.

* subversion/libsvn_client/cat.c
* subversion/libsvn_client/diff_local.c
* subversion/libsvn_client/export.c
* subversion/libsvn_client/import.c
* subversion/libsvn_client/patch.c
  (svn_client__get_normalized_stream, svn_client_cat3, translate_if_necessary,
   export_node, send_file_contents, obtain_eol_and_keywords_for_file):
   Use svn_prop_get_value() instead of svn_hash_gets(). Do not check for
   NULL property value when calling  svn_subst_eol_style_from_value() because
   it's already handles NULL value.

Modified:
   subversion/trunk/subversion/libsvn_client/cat.c
   subversion/trunk/subversion/libsvn_client/diff_local.c
   subversion/trunk/subversion/libsvn_client/export.c
   subversion/trunk/subversion/libsvn_client/import.c
   subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/cat.c
==============================================================================
--- subversion/trunk/subversion/libsvn_client/cat.c     Sat Sep 19 11:42:05 
2026        (r1938366)
+++ subversion/trunk/subversion/libsvn_client/cat.c     Sat Sep 19 13:16:35 
2026        (r1938367)
@@ -60,7 +60,7 @@ svn_client__get_normalized_stream(svn_st
   apr_hash_t *kw = NULL;
   svn_subst_eol_style_t style;
   apr_hash_t *props;
-  svn_string_t *eol_style, *keywords, *special;
+  const char *eol_style, *keywords, *special;
   const char *eol = NULL;
   svn_boolean_t local_mod = FALSE;
   svn_stream_t *input;
@@ -110,12 +110,11 @@ svn_client__get_normalized_stream(svn_st
         local_mod = TRUE;
     }
 
-  eol_style = svn_hash_gets(props, SVN_PROP_EOL_STYLE);
-  keywords = svn_hash_gets(props, SVN_PROP_KEYWORDS);
-  special = svn_hash_gets(props, SVN_PROP_SPECIAL);
+  eol_style = svn_prop_get_value(props, SVN_PROP_EOL_STYLE);
+  keywords = svn_prop_get_value(props, SVN_PROP_KEYWORDS);
+  special = svn_prop_get_value(props, SVN_PROP_SPECIAL);
 
-  if (eol_style)
-    svn_subst_eol_style_from_value(&style, &eol, eol_style->data);
+  svn_subst_eol_style_from_value(&style, &eol, eol_style);
 
   if (keywords)
     {
@@ -158,7 +157,7 @@ svn_client__get_normalized_stream(svn_st
           rev_str = apr_psprintf(scratch_pool, "%ld", changed_rev);
         }
 
-      SVN_ERR(svn_subst_build_keywords3(&kw, keywords->data, rev_str, url,
+      SVN_ERR(svn_subst_build_keywords3(&kw, keywords, rev_str, url,
                                         repos_root_url, tm, author,
                                         scratch_pool));
     }
@@ -188,8 +187,8 @@ svn_client_cat3(apr_hash_t **returned_pr
 {
   svn_ra_session_t *ra_session;
   svn_client__pathrev_t *loc;
-  svn_string_t *eol_style;
-  svn_string_t *keywords;
+  const char *eol_style;
+  const char *keywords;
   apr_hash_t *props = NULL;
   const char *repos_root_url;
   svn_stream_t *output = out;
@@ -271,8 +270,8 @@ svn_client_cat3(apr_hash_t **returned_pr
         }
     }
 
-  eol_style = svn_hash_gets(props, SVN_PROP_EOL_STYLE);
-  keywords = svn_hash_gets(props, SVN_PROP_KEYWORDS);
+  eol_style = svn_prop_get_value(props, SVN_PROP_EOL_STYLE);
+  keywords = svn_prop_get_value(props, SVN_PROP_KEYWORDS);
 
   if (eol_style || keywords)
     {
@@ -281,31 +280,23 @@ svn_client_cat3(apr_hash_t **returned_pr
       const char *eol_str;
       apr_hash_t *kw;
 
-      if (eol_style)
-        svn_subst_eol_style_from_value(&eol, &eol_str, eol_style->data);
-      else
-        {
-          eol = svn_subst_eol_style_none;
-          eol_str = NULL;
-        }
-
+      svn_subst_eol_style_from_value(&eol, &eol_str, eol_style);
 
       if (keywords && expand_keywords)
         {
-          svn_string_t *cmt_rev, *cmt_date, *cmt_author;
+          const char *cmt_rev, *cmt_date, *cmt_author;
           apr_time_t when = 0;
 
-          cmt_rev = svn_hash_gets(props, SVN_PROP_ENTRY_COMMITTED_REV);
-          cmt_date = svn_hash_gets(props, SVN_PROP_ENTRY_COMMITTED_DATE);
-          cmt_author = svn_hash_gets(props, SVN_PROP_ENTRY_LAST_AUTHOR);
+          cmt_rev = svn_prop_get_value(props, SVN_PROP_ENTRY_COMMITTED_REV);
+          cmt_date = svn_prop_get_value(props, SVN_PROP_ENTRY_COMMITTED_DATE);
+          cmt_author = svn_prop_get_value(props, SVN_PROP_ENTRY_LAST_AUTHOR);
           if (cmt_date)
-            SVN_ERR(svn_time_from_cstring(&when, cmt_date->data, 
scratch_pool));
+            SVN_ERR(svn_time_from_cstring(&when, cmt_date, scratch_pool));
 
-          SVN_ERR(svn_subst_build_keywords3(&kw, keywords->data,
-                                            cmt_rev->data, loc->url,
+          SVN_ERR(svn_subst_build_keywords3(&kw, keywords,
+                                            cmt_rev, loc->url,
                                             repos_root_url, when,
-                                            cmt_author ?
-                                              cmt_author->data : NULL,
+                                            cmt_author,
                                             scratch_pool));
         }
       else

Modified: subversion/trunk/subversion/libsvn_client/diff_local.c
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff_local.c      Sat Sep 19 
11:42:05 2026        (r1938366)
+++ subversion/trunk/subversion/libsvn_client/diff_local.c      Sat Sep 19 
13:16:35 2026        (r1938367)
@@ -305,8 +305,8 @@ translate_if_necessary(const char **loca
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
 {
-  const svn_string_t *eol_style_val;
-  const svn_string_t *keywords_val;
+  const char *eol_style_val;
+  const char *keywords_val;
   svn_subst_eol_style_t eol_style;
   const char *eol;
   apr_hash_t *keywords;
@@ -316,19 +316,13 @@ translate_if_necessary(const char **loca
   /* if (svn_hash_gets(props, SVN_PROP_SPECIAL))
       ### TODO: Implement */
 
-  eol_style_val = svn_hash_gets(props, SVN_PROP_EOL_STYLE);
-  keywords_val = svn_hash_gets(props, SVN_PROP_KEYWORDS);
+  eol_style_val = svn_prop_get_value(props, SVN_PROP_EOL_STYLE);
+  keywords_val = svn_prop_get_value(props, SVN_PROP_KEYWORDS);
 
-  if (eol_style_val)
-    svn_subst_eol_style_from_value(&eol_style, &eol, eol_style_val->data);
-  else
-    {
-      eol = NULL;
-      eol_style = svn_subst_eol_style_none;
-    }
+  svn_subst_eol_style_from_value(&eol_style, &eol, eol_style_val);
 
   if (keywords_val)
-    SVN_ERR(svn_subst_build_keywords3(&keywords, keywords_val->data,
+    SVN_ERR(svn_subst_build_keywords3(&keywords, keywords_val,
                                       APR_STRINGIFY(SVN_INVALID_REVNUM),
                                       "", "", 0, "", scratch_pool));
   else

Modified: subversion/trunk/subversion/libsvn_client/export.c
==============================================================================
--- subversion/trunk/subversion/libsvn_client/export.c  Sat Sep 19 11:42:05 
2026        (r1938366)
+++ subversion/trunk/subversion/libsvn_client/export.c  Sat Sep 19 13:16:35 
2026        (r1938367)
@@ -185,8 +185,7 @@ export_node(void *baton,
   apr_hash_t *kw;
   svn_subst_eol_style_t style;
   apr_hash_t *props;
-  svn_string_t *eol_style, *keywords, *executable, *special;
-  const char *eol_style_val;
+  const char *eol_style, *keywords, *executable, *special;
   const char *eol;
   svn_boolean_t local_mod = FALSE;
   apr_time_t tm;
@@ -342,17 +341,12 @@ export_node(void *baton,
         local_mod = TRUE;
     }
 
-  special = svn_hash_gets(props, SVN_PROP_SPECIAL);
-  eol_style = svn_hash_gets(props, SVN_PROP_EOL_STYLE);
-  keywords = svn_hash_gets(props, SVN_PROP_KEYWORDS);
-  executable = svn_hash_gets(props, SVN_PROP_EXECUTABLE);
+  special = svn_prop_get_value(props, SVN_PROP_SPECIAL);
+  eol_style = svn_prop_get_value(props, SVN_PROP_EOL_STYLE);
+  keywords = svn_prop_get_value(props, SVN_PROP_KEYWORDS);
+  executable = svn_prop_get_value(props, SVN_PROP_EXECUTABLE);
 
-  if (eol_style)
-    eol_style_val = eol_style->data;
-  else
-    eol_style_val = NULL;
-
-  SVN_ERR(get_eol_style(&style, &eol, eol_style_val, eib->native_eol));
+  SVN_ERR(get_eol_style(&style, &eol, eol_style, eib->native_eol));
 
   if (local_mod)
     {
@@ -387,7 +381,7 @@ export_node(void *baton,
           suffix = "";
         }
 
-      SVN_ERR(svn_subst_build_keywords3(&kw, keywords->data,
+      SVN_ERR(svn_subst_build_keywords3(&kw, keywords,
                                         apr_psprintf(scratch_pool, "%ld%s",
                                                      changed_rev, suffix),
                                         url, status->repos_root_url, tm,

Modified: subversion/trunk/subversion/libsvn_client/import.c
==============================================================================
--- subversion/trunk/subversion/libsvn_client/import.c  Sat Sep 19 11:42:05 
2026        (r1938366)
+++ subversion/trunk/subversion/libsvn_client/import.c  Sat Sep 19 13:16:35 
2026        (r1938367)
@@ -120,7 +120,7 @@ send_file_contents(svn_checksum_t **resu
                    apr_pool_t *pool)
 {
   svn_stream_t *contents;
-  const svn_string_t *eol_style_val = NULL, *keywords_val = NULL;
+  const char *eol_style_val, *keywords_val;
   svn_boolean_t special = FALSE;
   svn_subst_eol_style_t eol_style;
   const char *eol;
@@ -128,26 +128,15 @@ send_file_contents(svn_checksum_t **resu
   open_txdelta_stream_baton_t baton = { 0 };
 
   /* If there are properties, look for EOL-style and keywords ones. */
-  if (properties)
-    {
-      eol_style_val = apr_hash_get(properties, SVN_PROP_EOL_STYLE,
-                                   sizeof(SVN_PROP_EOL_STYLE) - 1);
-      keywords_val = apr_hash_get(properties, SVN_PROP_KEYWORDS,
-                                  sizeof(SVN_PROP_KEYWORDS) - 1);
-      if (svn_hash_gets(properties, SVN_PROP_SPECIAL))
-        special = TRUE;
-    }
-
-  if (eol_style_val)
-    svn_subst_eol_style_from_value(&eol_style, &eol, eol_style_val->data);
-  else
-    {
-      eol = NULL;
-      eol_style = svn_subst_eol_style_none;
-    }
+  eol_style_val = svn_prop_get_value(properties, SVN_PROP_EOL_STYLE);
+  keywords_val = svn_prop_get_value(properties, SVN_PROP_KEYWORDS);
+  if (svn_prop_get_value(properties, SVN_PROP_SPECIAL))
+    special = TRUE;
+ 
+  svn_subst_eol_style_from_value(&eol_style, &eol, eol_style_val);
 
   if (keywords_val)
-    SVN_ERR(svn_subst_build_keywords3(&keywords, keywords_val->data,
+    SVN_ERR(svn_subst_build_keywords3(&keywords, keywords_val,
                                       APR_STRINGIFY(SVN_INVALID_REVNUM),
                                       "", "", 0, "", pool));
   else
@@ -174,7 +163,7 @@ send_file_contents(svn_checksum_t **resu
                                     SVN_PROP_EOL_STYLE,
                                     svn_dirent_local_style(local_abspath,
                                                            pool),
-                                    eol_style_val->data);
+                                    eol_style_val);
 
           /* We're importing, so translate files with 'native' eol-style to
            * repository-normal form, not to this platform's native EOL. */

Modified: subversion/trunk/subversion/libsvn_client/patch.c
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c   Sat Sep 19 11:42:05 
2026        (r1938366)
+++ subversion/trunk/subversion/libsvn_client/patch.c   Sat Sep 19 13:16:35 
2026        (r1938367)
@@ -378,11 +378,11 @@ obtain_eol_and_keywords_for_file(apr_has
                                  apr_pool_t *scratch_pool)
 {
   apr_hash_t *props;
-  svn_string_t *keywords_val, *eol_style_val;
+  const char *keywords_val, *eol_style_val;
 
   SVN_ERR(svn_wc_prop_list2(&props, wc_ctx, local_abspath,
                             scratch_pool, scratch_pool));
-  keywords_val = svn_hash_gets(props, SVN_PROP_KEYWORDS);
+  keywords_val = svn_prop_get_value(props, SVN_PROP_KEYWORDS);
   if (keywords_val)
     {
       svn_revnum_t changed_rev;
@@ -408,19 +408,14 @@ obtain_eol_and_keywords_for_file(apr_has
                                         scratch_pool);
 
       SVN_ERR(svn_subst_build_keywords3(keywords,
-                                        keywords_val->data,
+                                        keywords_val,
                                         rev_str, url, repos_root_url,
                                         changed_date,
                                         author, result_pool));
     }
 
-  eol_style_val = svn_hash_gets(props, SVN_PROP_EOL_STYLE);
-  if (eol_style_val)
-    {
-      svn_subst_eol_style_from_value(eol_style,
-                                     eol_str,
-                                     eol_style_val->data);
-    }
+  eol_style_val = svn_prop_get_value(props, SVN_PROP_EOL_STYLE);
+  svn_subst_eol_style_from_value(eol_style, eol_str, eol_style_val);
 
   return SVN_NO_ERROR;
 }

Reply via email to