You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David James <ja...@gmail.com> on 2005/09/28 17:09:57 UTC

[PATCH] Add necessary copy constructors to libsvn_subr, libsvn_delta (1.3.x, Issue #2172)

[[[

Create copy constructors for svn_txdelta_window_t,
svn_log_changed_path_t, and svn_auth_ssl_server_cert_info_t.
(These copy constructors are needed to solve the segfaults
 in the Python bindings caused by issue 2172.)

* subversion/include/svn_delta.h
  (svn_txdelta_window_dup): New function.
* subversion/include/svn_types.h
  (svn_log_changed_path_dup): New function.
* subversion/include/svn_auth.h
  (svn_auth_ssl_server_cert_info_dup): New function.
* subversion/libsvn_subr/constructors.c
  (svn_log_changed_path_dup,
  svn_auth_ssl_server_cert_info_dup): New functions.
* subversion/libsvn_delta/delta.h
  (svn_txdelta__copy_window): Remove function.
* subversion/libsvn_delta/text_delta.c
  (svn_txdelta__copy_window): Rename function to svn_txdelta_window_dup.
* subversion/bindings/libsvn_fs_base
  (compose_handler): Use svn_txdelta_window_dup instead of
  svn_txdelta__copy_window.

]]]


--
David James -- http://www.cs.toronto.edu/~james

Re: [PATCH] Add necessary copy constructors to libsvn_subr, libsvn_delta (1.3.x, Issue #2172)

Posted by Julian Foad <ju...@btopenworld.com>.
Julian Foad wrote:
> I trust this provision of copy functions is the best way to solve the 
> problems that the bindings are having?  Can anyone see these functions 
> being useful in general, or just for this particular case?

Sorry - that probably sounds awfully cynical or something.  To explain myself: 
I have not followed any discussion on the bindings, and so was not even aware 
that there was a problem, so I don't know why this patch is useful.  All I 
meant is that I trust someone else has verified or will verify that this patch 
is appropriate.  I didn't really need to ask.  Of course they have/will.

- Julian

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

Re: [PATCH] Add necessary copy constructors to libsvn_subr, libsvn_delta (1.3.x, Issue #2172)

Posted by David James <ja...@gmail.com>.
Julian, thanks for the thorough review! I can see you took a close
look at my patch. This is much appreciated, thanks.

On 9/28/05, Julian Foad <ju...@btopenworld.com> wrote:
> Naming:
> [...]
> I think these new names are OK (ending in "_dup").
Great!

> Which source file:
>
> I think "libsvn_subr/constructors.c" is only appropriate for constructors that
> don't have a better home.  That includes svn_log_changed_path_dup(), but I
> think svn_auth_ssl_server_cert_info_dup() should go in auth.c.
Agreed. I'll fix this.

> Some source formatting style nits which we could easily fix up while committing
> the patch:
> [...]
> > Index: subversion/libsvn_subr/constructors.c
> [...]
> > +  svn_auth_ssl_server_cert_info_t *new_info =
> > +    apr_palloc (pool, sizeof (*new_info));
>
> We tend not to leave an operator (like "=" or "+") on the end of a line; move
> it to the beginning of the next line (indented by two spaces).  (Here and in
> two more places.)
Agreed. I'll fix this.

Cheers,

David

--
David James -- http://www.cs.toronto.edu/~james

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


Re: [PATCH] Add necessary copy constructors to libsvn_subr, libsvn_delta (1.3.x, Issue #2172)

Posted by Philip Martin <ph...@codematters.co.uk>.
Branko Čibej <br...@xbc.nu> writes:

> Julian Foad wrote:
>
>>> +svn_txdelta_window_t *svn_txdelta_window_dup (
>>> +    const svn_txdelta_window_t *window, apr_pool_t *pool);
>>
>> This would be better if you start the function name on a new line,
>> as we often do especially when the return type is long, like this:
>>
>> svn_txdelta_window_t *
>> svn_txdelta_window_dup (const svn_txdelta_window_t *window,
>>                         apr_pool_t *pool);
>
> No, we don't. We have the return type and function name on the same
> line in headers, and on separate lines in implementation files. Always.

That's not true, most header files have a mixture of both styles and
svn_delta.h is no exception.

-- 
Philip Martin

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


Re: [PATCH] Add necessary copy constructors to libsvn_subr, libsvn_delta (1.3.x, Issue #2172)

Posted by David James <ja...@gmail.com>.
On 9/28/05, Branko Čibej <br...@xbc.nu> wrote:
> Julian Foad wrote:
>
> >> +svn_txdelta_window_t *svn_txdelta_window_dup (
> >> +    const svn_txdelta_window_t *window, apr_pool_t *pool);
> >
> >
> > This would be better if you start the function name on a new line, as
> > we often do especially when the return type is long, like this:
> >
> > svn_txdelta_window_t *
> > svn_txdelta_window_dup (const svn_txdelta_window_t *window,
> >                         apr_pool_t *pool);
>
> No, we don't. We have the return type and function name on the same line
> in headers, and on separate lines in implementation files. Always.
Thanks for clearing this up. Okay, I'll keep the return type and
function name on the same line.

Cheers,

David

--
David James -- http://www.cs.toronto.edu/~james

Re: [PATCH] Add necessary copy constructors to libsvn_subr, libsvn_delta (1.3.x, Issue #2172)

Posted by Branko Čibej <br...@xbc.nu>.
Julian Foad wrote:

>> +svn_txdelta_window_t *svn_txdelta_window_dup (
>> +    const svn_txdelta_window_t *window, apr_pool_t *pool);
>
>
> This would be better if you start the function name on a new line, as 
> we often do especially when the return type is long, like this:
>
> svn_txdelta_window_t *
> svn_txdelta_window_dup (const svn_txdelta_window_t *window,
>                         apr_pool_t *pool);

No, we don't. We have the return type and function name on the same line 
in headers, and on separate lines in implementation files. Always.

>> +  svn_auth_ssl_server_cert_info_t *new_info =
>> +    apr_palloc (pool, sizeof (*new_info));
>
>
> We tend not to leave an operator (like "=" or "+") on the end of a 
> line; move it to the beginning of the next line (indented by two 
> spaces).  (Here and in two more places.)

Well actually we do leave "=" at the end of the previous line.

-- Brane


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

Re: [PATCH] Add necessary copy constructors to libsvn_subr, libsvn_delta (1.3.x, Issue #2172)

Posted by Julian Foad <ju...@btopenworld.com>.
I trust this provision of copy functions is the best way to solve the problems 
that the bindings are having?  Can anyone see these functions being useful in 
general, or just for this particular case?

Please excuse the long-windedness of the rest of this message.  Essentially the 
patch looks fine.  I have only stylistic requests, and the most significant of 
those is moving one function to a different file.


Naming:

We have svn_create_commit_info(), so shouldn't we have "svn_dup_commit_info()" 
etc.?  I think not: I think that names beginning with a prefix that identifies 
the library they belong to are good, and the name starting "svn_create" is bad. 
  (It's a funny one, the only one like it, and one that doesn't seem to belong 
to a particular library.)

We also have:
svn_xml_parser_t *       svn_xml_make_parser
svn_wc_traversal_info_t *svn_wc_init_traversal_info
svn_string[buf]_t *      svn_string[buf]_create
svn_ra_svn_conn_t *      svn_ra_svn_create_conn
svn_fs_t *               svn_fs_new
svn_wc_notify_t *        svn_wc_create_notify

svn_wc_notify_t *        svn_wc_dup_notify
svn_wc_status2_t *       svn_wc_dup_status2
svn_wc_entry_t *         svn_wc_entry_dup
svn_error_t *            svn_error_dup
svn_string[buf]_t *      svn_string[buf]_dup
svn_lock_t *             svn_lock_dup

So, only a little consistency to guide us.

I think these new names are OK (ending in "_dup").


Which source file:

I think "libsvn_subr/constructors.c" is only appropriate for constructors that 
don't have a better home.  That includes svn_log_changed_path_dup(), but I 
think svn_auth_ssl_server_cert_info_dup() should go in auth.c.


C. Michael Pilato wrote:
> David James <ja...@gmail.com> writes:
>>Create copy constructors for svn_txdelta_window_t,
>>svn_log_changed_path_t, and svn_auth_ssl_server_cert_info_t.
>>(These copy constructors are needed to solve the segfaults
>> in the Python bindings caused by issue 2172.)
[...]
> [...] Something like:
> 
>    Fix segfaults in the Python bindings caused by pool lifetime
>    problems by creating/exposing deep-copy utilities for various
>    structure types.  This is a followup to the work done for issue
>    #2172.

Except that this patch doesn't fix anything in the Python bindings. :-)

David's summary was well written, emphasising what the patch does, with a 
parenthetical note about why it was done.  Certainly "Create" would be more 
accurate as "Create or expose", and replacing the C++ language "copy 
constructors" with a more universal phrase like "deep-copy utilities" is also 
fine, and the other changes C-Mike mentioned.


Some source formatting style nits which we could easily fix up while committing 
the patch:

> Index: subversion/include/svn_delta.h
[...]
> +svn_txdelta_window_t *svn_txdelta_window_dup (
> +    const svn_txdelta_window_t *window, apr_pool_t *pool);

This would be better if you start the function name on a new line, as we often 
do especially when the return type is long, like this:

svn_txdelta_window_t *
svn_txdelta_window_dup (const svn_txdelta_window_t *window,
                         apr_pool_t *pool);

> Index: subversion/include/svn_auth.h
[...]
> +svn_auth_ssl_server_cert_info_t *svn_auth_ssl_server_cert_info_dup (
> +    const svn_auth_ssl_server_cert_info_t *info, apr_pool_t *pool);

And here.

> Index: subversion/libsvn_subr/constructors.c
[...]
> +  svn_auth_ssl_server_cert_info_t *new_info =
> +    apr_palloc (pool, sizeof (*new_info));

We tend not to leave an operator (like "=" or "+") on the end of a line; move 
it to the beginning of the next line (indented by two spaces).  (Here and in 
two more places.)


- Julian

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

Re: [PATCH] Add necessary copy constructors to libsvn_subr, libsvn_delta (1.3.x, Issue #2172)

Posted by David James <ja...@gmail.com>.
On 28 Sep 2005 13:27:46 -0400, C. Michael Pilato <cm...@collab.net> wrote:
> David James <ja...@gmail.com> writes:
>
> > [[[
> >
> > Create copy constructors for svn_txdelta_window_t,
> > svn_log_changed_path_t, and svn_auth_ssl_server_cert_info_t.
> > (These copy constructors are needed to solve the segfaults
> >  in the Python bindings caused by issue 2172.)
> >
> > * subversion/include/svn_delta.h
> >   (svn_txdelta_window_dup): New function.
> > * subversion/include/svn_types.h
> >   (svn_log_changed_path_dup): New function.
> > * subversion/include/svn_auth.h
> >   (svn_auth_ssl_server_cert_info_dup): New function.
> > * subversion/libsvn_subr/constructors.c
> >   (svn_log_changed_path_dup,
> >   svn_auth_ssl_server_cert_info_dup): New functions.
> > * subversion/libsvn_delta/delta.h
> >   (svn_txdelta__copy_window): Remove function.
> > * subversion/libsvn_delta/text_delta.c
> >   (svn_txdelta__copy_window): Rename function to svn_txdelta_window_dup.
> > * subversion/bindings/libsvn_fs_base
> >   (compose_handler): Use svn_txdelta_window_dup instead of
> >   svn_txdelta__copy_window.
> >
> > ]]]
>
> I find log messages without empty lines between modification groups
> really hard to parse.
>
> Also, I think it's more useful to refer to svn_txdelta_window_dup()
> not as a new function, but as a renamed function (renamed from
> svn_txdelta__copy_window(), and make public).  You know, tie the
> history of these two functions together.  Something like:
>
>    Fix segfaults in the Python bindings caused by pool lifetime
>    problems by creating/exposing deep-copy utilities for various
>    structure types.  This is a followup to the work done for issue
>    #2172.
>
>    * subversion/include/svn_delta.h
>      (svn_txdelta_window_dup): Rename from svn_txdelta__copy_window(),
>        and publicize.
>
>    * subversion/include/svn_types.h
>      (svn_log_changed_path_dup): New.
>
>    * subversion/include/svn_auth.h
>      (svn_auth_ssl_server_cert_info_dup): New.
>
>    * subversion/libsvn_subr/constructors.c
>      (svn_log_changed_path_dup, svn_auth_ssl_server_cert_info_dup): New.
>
>    * subversion/libsvn_delta/delta.h
>      (svn_txdelta__copy_window): Remove.
>
>    * subversion/libsvn_delta/text_delta.c
>      (svn_txdelta__copy_window): Rename to svn_txdelta_window_dup().
>
>    * subversion/bindings/libsvn_fs_base
>      (compose_handler): Use svn_txdelta_window_dup instead of
>        svn_txdelta__copy_window.
Ah, that's much better. I'll use your log message as the basis for my
next patch, which will also fix the Python bindings as well.

> Other than that, +1 on the change (which I've only visually reviewed,
> not applied/tested).
Great!

Cheers,

David

-
David James -- http://www.cs.toronto.edu/~james

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


Re: [PATCH] Add necessary copy constructors to libsvn_subr, libsvn_delta (1.3.x, Issue #2172)

Posted by "C. Michael Pilato" <cm...@collab.net>.
David James <ja...@gmail.com> writes:

> [[[
> 
> Create copy constructors for svn_txdelta_window_t,
> svn_log_changed_path_t, and svn_auth_ssl_server_cert_info_t.
> (These copy constructors are needed to solve the segfaults
>  in the Python bindings caused by issue 2172.)
> 
> * subversion/include/svn_delta.h
>   (svn_txdelta_window_dup): New function.
> * subversion/include/svn_types.h
>   (svn_log_changed_path_dup): New function.
> * subversion/include/svn_auth.h
>   (svn_auth_ssl_server_cert_info_dup): New function.
> * subversion/libsvn_subr/constructors.c
>   (svn_log_changed_path_dup,
>   svn_auth_ssl_server_cert_info_dup): New functions.
> * subversion/libsvn_delta/delta.h
>   (svn_txdelta__copy_window): Remove function.
> * subversion/libsvn_delta/text_delta.c
>   (svn_txdelta__copy_window): Rename function to svn_txdelta_window_dup.
> * subversion/bindings/libsvn_fs_base
>   (compose_handler): Use svn_txdelta_window_dup instead of
>   svn_txdelta__copy_window.
> 
> ]]]

I find log messages without empty lines between modification groups
really hard to parse.  

Also, I think it's more useful to refer to svn_txdelta_window_dup()
not as a new function, but as a renamed function (renamed from
svn_txdelta__copy_window(), and make public).  You know, tie the
history of these two functions together.  Something like:

   Fix segfaults in the Python bindings caused by pool lifetime
   problems by creating/exposing deep-copy utilities for various
   structure types.  This is a followup to the work done for issue
   #2172.
   
   * subversion/include/svn_delta.h
     (svn_txdelta_window_dup): Rename from svn_txdelta__copy_window(),
       and publicize.

   * subversion/include/svn_types.h
     (svn_log_changed_path_dup): New.

   * subversion/include/svn_auth.h
     (svn_auth_ssl_server_cert_info_dup): New.

   * subversion/libsvn_subr/constructors.c
     (svn_log_changed_path_dup, svn_auth_ssl_server_cert_info_dup): New.

   * subversion/libsvn_delta/delta.h
     (svn_txdelta__copy_window): Remove.

   * subversion/libsvn_delta/text_delta.c
     (svn_txdelta__copy_window): Rename to svn_txdelta_window_dup().

   * subversion/bindings/libsvn_fs_base
     (compose_handler): Use svn_txdelta_window_dup instead of
       svn_txdelta__copy_window.

Other than that, +1 on the change (which I've only visually reviewed,
not applied/tested).


-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

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