You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Julian Foad <ju...@btopenworld.com> on 2003/02/03 01:10:40 UTC

[PATCH] svn_ra_svn_handle_commands should take a pointer-to-const for its command list

Would you agree with the following?  No big deal ... just seems better.

svn_ra_svn_handle_commands should be able to accept a constant list of 
commands, and so should take a pointer-to-const for its command list.

Index: subversion/include/svn_ra_svn.h
===================================================================
--- subversion/include/svn_ra_svn.h	(revision 4704)
+++ subversion/include/svn_ra_svn.h	(working copy)
@@ -223,7 +223,7 @@
   */
  svn_error_t *svn_ra_svn_handle_commands(svn_ra_svn_conn_t *conn,
                                          apr_pool_t *pool,
-                                        svn_ra_svn_cmd_entry_t *commands,
+                                        const svn_ra_svn_cmd_entry_t 
*commands,
                                          void *baton,
                                          svn_boolean_t 
pass_through_errors);

Index: subversion/libsvn_ra_svn/marshal.c
===================================================================
--- subversion/libsvn_ra_svn/marshal.c	(revision 4704)
+++ subversion/libsvn_ra_svn/marshal.c	(working copy)
@@ -627,7 +627,7 @@

  svn_error_t *svn_ra_svn_handle_commands(svn_ra_svn_conn_t *conn,
                                          apr_pool_t *pool,
-                                        svn_ra_svn_cmd_entry_t *commands,
+                                        const svn_ra_svn_cmd_entry_t 
*commands,
                                          void *baton,
                                          svn_boolean_t pass_through_errors)
  {

This would allow the command lists in subversion/svnserve/serve.c and 
subversion/libsvn_ra/editor.c to be constant.  Also, the command lists 
in serve.c should, I think, be "static".  There are no declarations or 
references to them outside that file.

Index: subversion/libsvn_ra_svn/editor.c
===================================================================
--- subversion/libsvn_ra_svn/editor.c	(revision 4704)
+++ subversion/libsvn_ra_svn/editor.c	(working copy)
@@ -659,7 +659,7 @@
    return svn_ra_svn_write_cmd_response(conn, pool, "");
  }

-static svn_ra_svn_cmd_entry_t ra_svn_edit_commands[] = {
+static const svn_ra_svn_cmd_entry_t ra_svn_edit_commands[] = {
    { "target-rev",       ra_svn_handle_target_rev },
    { "open-root",        ra_svn_handle_open_root },
    { "delete-entry",     ra_svn_handle_delete_entry },
Index: subversion/svnserve/serve.c
===================================================================
--- subversion/svnserve/serve.c	(revision 4704)
+++ subversion/svnserve/serve.c	(working copy)
@@ -144,7 +144,7 @@
    return SVN_NO_ERROR;
  }

-svn_ra_svn_cmd_entry_t report_commands[] = {
+static const svn_ra_svn_cmd_entry_t report_commands[] = {
    { "set-path",      set_path },
    { "delete-path",   delete_path },
    { "link-path",     link_path },
@@ -820,7 +820,7 @@
    return SVN_NO_ERROR;
  }

-svn_ra_svn_cmd_entry_t main_commands[] = {
+static const svn_ra_svn_cmd_entry_t main_commands[] = {
    { "get-latest-rev",  get_latest_rev },
    { "get-dated-rev",   get_dated_rev },
    { "change-rev-prop", change_rev_prop },

Revision 4704 passes "make check" with these patches applied.

- Julian

Re: [PATCH] svn_ra_svn_handle_commands should take a pointer-to-const for its command list

Posted by Julian Foad <ju...@btopenworld.com>.
Julian Foad wrote:
> svn_ra_svn_handle_commands should be able to accept a constant list of 
> commands, and so should take a pointer-to-const for its command list.
...
> This would allow the command lists in subversion/svnserve/serve.c and 
> subversion/libsvn_ra/editor.c to be constant.  Also, the command lists 
> in serve.c should, I think, be "static".  There are no declarations or 
> references to them outside that file.

The addition of "static" is not logically related to the addition of 
"const", only physically related because they appear on the same source 
lines.

Also I forgot to delete the attachment when I remembered to put the diff 
in line in the message.

- Julian


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svn_ra_svn_handle_commands should take a pointer-to-const for its command list

Posted by Julian Foad <ju...@btopenworld.com>.
Greg Hudson wrote:
> Thanks.  I committed this, along with a similar change to the command
> table in editor.c.

Thanks.  (My patches included the/a change to the command table in editor.c)


> In the future, please include log messages with your patches in the
> style documented in HACKING.  One of your later patches came with a log
> message, but it wasn't in the right style.

Sorry ... I was reading HACKING and learning as I go along.  Have read 
it all now.  Please continue to point out when I go wrong.  I must say 
the care and precision on this project is a beautiful thing to behold, 
especially compared with my day job where nobody cares and the spaghetti 
is awful.

- Julian


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svn_ra_svn_handle_commands should take a pointer-to-const for its command list

Posted by Greg Hudson <gh...@MIT.EDU>.
Thanks.  I committed this, along with a similar change to the command
table in editor.c.

In the future, please include log messages with your patches in the
style documented in HACKING.  One of your later patches came with a log
message, but it wasn't in the right style.

(For those following my schedule, I'm afraid I'm not "back"; work hasn't
really quieted down for me.  But I had time for a little bit of
housekeeping.)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org