[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn_repos.h: Typo in definition of svn_repos_parser_fns2_t?

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-07-26 15:05:40 CEST

David James wrote:
> On 7/25/05, David James <james82@gmail.com> wrote:
>
>>>The API guidelines allow you to add to the existing names:
>>>
>>>typedef svn_repos_parser_fns2_t svn_repos_parse_fns2_t;
>>>
>>>if that helps.
>>
>>No need for that -- I can work around this problem in the SWIG
>>interface file by renaming the struct inside SWIG.
>
> Actually, could I add in that typedef? It'd be helpful, cause a SWIG
> rename would be an ugly workaround, and an extra typedef for the
> svn_repos_parse_fns2_t structure would help everybody.

I don't see what you mean by "would help everybody". The Subversion code base
doesn't refer to that (struct) name "svn_repos_parse_fns2_t", only to the
existing typedef name "svn_repos_parser_fns2_t". Perhaps you just mean that it
would restore consistency which is potentially helpful to users of various tools.

Anyway, I agree that we ought to fix it; I had it noted from the 1.2 API review
but was going to wait for the next time it was revved before doing anything
about it.

I suppose we should deprecate the existing typedef name and change our code to
use the new one which matches the struct name. (The alternative, fixing the
struct name, could only be done by duplicating its contents which would have to
be done with a macro to be acceptable, and that would be ugly.)

How about the attached patch, folks?

- Julian

[[[
Fix a mismatch between a struct name and its typedef by deprecating and
replacing the latter.

* subversion/include/svn_repos.h
  (svn_repos_parse_fns2_t): New typedef.
  (svn_repos_parser_fns2_t): Deprecate.

* subversion/libsvn_repos/load.c
  Update all uses.
]]]

Index: subversion/include/svn_repos.h
===================================================================
--- subversion/include/svn_repos.h (revision 15421)
+++ subversion/include/svn_repos.h (working copy)
@@ -1527,8 +1527,10 @@ typedef struct svn_repos_parse_fns2_t
    */
   svn_error_t *(*close_revision) (void *revision_baton);
 
-} svn_repos_parser_fns2_t;
+} svn_repos_parse_fns2_t;
 
+/** @deprecated Provided for backward compatibility with the 1.2 API. */
+typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t;
 
 
 /**
@@ -1558,7 +1560,7 @@ typedef struct svn_repos_parse_fns2_t
  */
 svn_error_t *
 svn_repos_parse_dumpstream2 (svn_stream_t *stream,
- const svn_repos_parser_fns2_t *parse_fns,
+ const svn_repos_parse_fns2_t *parse_fns,
                              void *parse_baton,
                              svn_cancel_func_t cancel_func,
                              void *cancel_baton,
@@ -1585,7 +1587,7 @@ svn_repos_parse_dumpstream2 (svn_stream_
  * @since New in 1.1.
  */
 svn_error_t *
-svn_repos_get_fs_build_parser2 (const svn_repos_parser_fns2_t **parser,
+svn_repos_get_fs_build_parser2 (const svn_repos_parse_fns2_t **parser,
                                 void **parse_baton,
                                 svn_repos_t *repos,
                                 svn_boolean_t use_history,
@@ -1597,7 +1599,7 @@ svn_repos_get_fs_build_parser2 (const sv
 
 /**
  * A vtable that is driven by svn_repos_parse_dumpstream().
- * Similar to svn_repos_parser_fns2_t except that it lacks
+ * Similar to svn_repos_parse_fns2_t except that it lacks
  * the delete_node_property and apply_textdelta callbacks.
  *
  * @deprecated Provided for backward compatibility with the 1.0 API.
Index: subversion/libsvn_repos/load.c
===================================================================
--- subversion/libsvn_repos/load.c (revision 15421)
+++ subversion/libsvn_repos/load.c (working copy)
@@ -84,10 +84,10 @@ struct node_baton
 
 /** A conversion function between the two vtable types. **/
 static
-svn_repos_parser_fns2_t *fns2_from_fns (const svn_repos_parser_fns_t *fns,
+svn_repos_parse_fns2_t *fns2_from_fns (const svn_repos_parser_fns_t *fns,
                                         apr_pool_t *pool)
 {
- svn_repos_parser_fns2_t *fns2;
+ svn_repos_parse_fns2_t *fns2;
 
   fns2 = apr_palloc (pool, sizeof (*fns2));
   fns2->new_revision_record = fns->new_revision_record;
@@ -206,7 +206,7 @@ stream_malformed (void)
 static svn_error_t *
 parse_property_block (svn_stream_t *stream,
                       svn_filesize_t content_length,
- const svn_repos_parser_fns2_t *parse_fns,
+ const svn_repos_parse_fns2_t *parse_fns,
                       void *record_baton,
                       svn_boolean_t is_node,
                       svn_filesize_t *actual_length,
@@ -365,7 +365,7 @@ static svn_error_t *
 parse_text_block (svn_stream_t *stream,
                   svn_filesize_t content_length,
                   svn_boolean_t is_delta,
- const svn_repos_parser_fns2_t *parse_fns,
+ const svn_repos_parse_fns2_t *parse_fns,
                   void *record_baton,
                   char *buffer,
                   apr_size_t buflen,
@@ -469,7 +469,7 @@ parse_format_version (const char *versio
 /* The Main Parser Logic */
 svn_error_t *
 svn_repos_parse_dumpstream2 (svn_stream_t *stream,
- const svn_repos_parser_fns2_t *parse_fns,
+ const svn_repos_parse_fns2_t *parse_fns,
                              void *parse_baton,
                              svn_cancel_func_t cancel_func,
                              void *cancel_baton,
@@ -759,7 +759,7 @@ svn_repos_parse_dumpstream (svn_stream_t
                             void *cancel_baton,
                             apr_pool_t *pool)
 {
- svn_repos_parser_fns2_t *fns2 = fns2_from_fns (parse_fns, pool);
+ svn_repos_parse_fns2_t *fns2 = fns2_from_fns (parse_fns, pool);
 
   return svn_repos_parse_dumpstream2 (stream, fns2, parse_baton,
                                       cancel_func, cancel_baton, pool);
@@ -1258,7 +1258,7 @@ close_revision (void *baton)
 
 
 svn_error_t *
-svn_repos_get_fs_build_parser2 (const svn_repos_parser_fns2_t **callbacks,
+svn_repos_get_fs_build_parser2 (const svn_repos_parse_fns2_t **callbacks,
                                 void **parse_baton,
                                 svn_repos_t *repos,
                                 svn_boolean_t use_history,
@@ -1268,7 +1268,7 @@ svn_repos_get_fs_build_parser2 (const sv
                                 apr_pool_t *pool)
 {
   const svn_repos_parser_fns_t *fns;
- svn_repos_parser_fns2_t *parser;
+ svn_repos_parse_fns2_t *parser;
 
   /* Fetch the old-style vtable and baton, convert the vtable to a
    * new-style vtable, and set the new callbacks. */
@@ -1335,7 +1335,7 @@ svn_repos_load_fs2 (svn_repos_t *repos,
                     void *cancel_baton,
                     apr_pool_t *pool)
 {
- const svn_repos_parser_fns2_t *parser;
+ const svn_repos_parse_fns2_t *parser;
   void *parse_baton;
   struct parse_baton *pb;
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jul 26 15:06:34 2005

This is an archived mail posted to the Subversion Dev mailing list.