svn commit: r1932158 - in subversion/trunk/subversion: libsvn_fs libsvn_fs_fs libsvn_subr

[email protected]
Newsgroups gmane.comp.version-control.subversion.svn
Message-ID <177263737078.3836192.16333077688770274182@svn02-us-east.apache.org>
Author: rinrab
Date: Wed Mar  4 15:16:10 2026
New Revision: 1932158

Log:
Fix misusing of 'const' pointers.

These are a few obvious places of some that were discovered by compiler with
C23 checks when a pointer is assigned to result of functions like strchr() and
the arguments are const. In such case, it essentially works as something like
'char non_const = (char *)constant'. Please refer to discussion on dev: [1].

* subversion/libsvn_fs/fs-loader.c
  (svn_fs__path_valid): Remove const from declration of 'c'.
* subversion/libsvn_fs_fs/tree.c
  (check_newline): Remove const from declration of 'c'.
* subversion/libsvn_subr/gpg_agent.c
  (find_running_gpg_agent): Remove const from declration of 'p'.

[1] https://lists.apache.org/thread/855lf41fz1ks3fng2m6b7wp2sdr6ly2s

Modified:
   subversion/trunk/subversion/libsvn_fs/fs-loader.c
   subversion/trunk/subversion/libsvn_fs_fs/tree.c
   subversion/trunk/subversion/libsvn_subr/gpg_agent.c

Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.c
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/fs-loader.c	Wed Mar  4 15:07:04 2026	(r1932157)
+++ subversion/trunk/subversion/libsvn_fs/fs-loader.c	Wed Mar  4 15:16:10 2026	(r1932158)
@@ -468,7 +468,7 @@ default_warning_func(void *baton, svn_er
 svn_error_t *
 svn_fs__path_valid(const char *path, apr_pool_t *pool)
 {
-  char *c;
+  const char *c;
 
   /* UTF-8 encoded string without NULs. */
   if (! svn_utf__cstring_is_valid(path))

Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c	Wed Mar  4 15:07:04 2026	(r1932157)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c	Wed Mar  4 15:16:10 2026	(r1932158)
@@ -2485,7 +2485,7 @@ fs_dir_optimal_order(apr_array_header_t
 static svn_error_t *
 check_newline(const char *path, apr_pool_t *pool)
 {
-  char *c = strchr(path, '\n');
+  const char *c = strchr(path, '\n');
 
   if (c)
     return svn_error_createf(SVN_ERR_FS_PATH_SYNTAX, NULL,

Modified: subversion/trunk/subversion/libsvn_subr/gpg_agent.c
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/gpg_agent.c	Wed Mar  4 15:07:04 2026	(r1932157)
+++ subversion/trunk/subversion/libsvn_subr/gpg_agent.c	Wed Mar  4 15:16:10 2026	(r1932158)
@@ -326,7 +326,7 @@ find_running_gpg_agent(int *new_sd, apr_
   char *buffer;
   const char *socket_name = find_gpg_agent_socket(pool, pool);
   const char *request = NULL;
-  const char *p = NULL;
+  char *p = NULL;
   char *ep = NULL;
   int sd;
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.