You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Danny Trebbien <dt...@gmail.com> on 2011/02/13 20:59:30 UTC

[PATCH] extend the SVN_ERR macro with a cleanup statement parameter

Attached is a small patch to extend the SVN_ERR macro with another
parameter, a cleanup statement, that is executed before the error
generated by EXPR (if not SVN_NO_ERROR) is returned.  Also attached is
a log message.

I plan on using this in a test of svn_subst_translate_string2() in
which I need to reset the locale to whatever it was before the test
began.  See:  http://thread.gmane.org/gmane.comp.version-control.subversion.devel/125782

Re: [PATCH] extend the SVN_ERR macro with a cleanup statement parameter

Posted by Danny Trebbien <dt...@gmail.com>.
On Sun, Feb 27, 2011 at 3:45 AM, Gavin Beau Baumanis
<ga...@thespidernet.com> wrote:
> Hi Danny,
>
> Just thought I would give you a gentle "poke" and see if you were still pursuing this submission, or not?

Oh, no.  I ended up using Brane's suggestion of writing a wrapper
function (https://github.com/dtrebbien/subversion/commit/edc2dd1e9e94709e179f43e5f0948cb27433a908).

Re: [PATCH] extend the SVN_ERR macro with a cleanup statement parameter

Posted by Gavin Beau Baumanis <ga...@thespidernet.com>.
Hi Danny,

Just thought I would give you a gentle "poke" and see if you were still pursuing this submission, or not?



On 14/02/2011, at 7:37 AM, Branko Čibej wrote:

> On 13.02.2011 21:28, Bert Huijben wrote:
>> 
>>> -----Original Message-----
>>> From: Danny Trebbien [mailto:dtrebbien@gmail.com]
>>> Sent: zondag 13 februari 2011 21:00
>>> To: Subversion Development
>>> Subject: [PATCH] extend the SVN_ERR macro with a cleanup statement
>>> parameter
>>> 
>>> Attached is a small patch to extend the SVN_ERR macro with another
>>> parameter, a cleanup statement, that is executed before the error
>>> generated by EXPR (if not SVN_NO_ERROR) is returned.  Also attached is
>>> a log message.
>>> 
>>> I plan on using this in a test of svn_subst_translate_string2() in
>>> which I need to reset the locale to whatever it was before the test
>>> began.  See:  http://thread.gmane.org/gmane.comp.version-
>>> control.subversion.devel/125782
>> It's much easier to use a helper function or (if that is impossible) a goto to get specialized error handling.
>> 
>> This macro is in use everywhere inside Subversion and in many third party tools using our libraries so I would recommend to not change it.
>> 
>> Another option is a file local macro that performs your specialized cleanup.
>> 
>> All those options are used in multiple places in our codebase.
> 
> Just write your test as a wrapper around the real test functionality,
> set and reset the locale in the wrapper and pass through whatever error
> code you receive. Don't change the semantics of a public macro,
> especialy not in a backwards-incompatible way.
> 
> -- Brane


Re: [PATCH] extend the SVN_ERR macro with a cleanup statement parameter

Posted by Branko Čibej <br...@e-reka.si>.
On 13.02.2011 21:28, Bert Huijben wrote:
>
>> -----Original Message-----
>> From: Danny Trebbien [mailto:dtrebbien@gmail.com]
>> Sent: zondag 13 februari 2011 21:00
>> To: Subversion Development
>> Subject: [PATCH] extend the SVN_ERR macro with a cleanup statement
>> parameter
>>
>> Attached is a small patch to extend the SVN_ERR macro with another
>> parameter, a cleanup statement, that is executed before the error
>> generated by EXPR (if not SVN_NO_ERROR) is returned.  Also attached is
>> a log message.
>>
>> I plan on using this in a test of svn_subst_translate_string2() in
>> which I need to reset the locale to whatever it was before the test
>> began.  See:  http://thread.gmane.org/gmane.comp.version-
>> control.subversion.devel/125782
> It's much easier to use a helper function or (if that is impossible) a goto to get specialized error handling.
>
> This macro is in use everywhere inside Subversion and in many third party tools using our libraries so I would recommend to not change it.
>
> Another option is a file local macro that performs your specialized cleanup.
>
> All those options are used in multiple places in our codebase.

Just write your test as a wrapper around the real test functionality,
set and reset the locale in the wrapper and pass through whatever error
code you receive. Don't change the semantics of a public macro,
especialy not in a backwards-incompatible way.

-- Brane

RE: [PATCH] extend the SVN_ERR macro with a cleanup statement parameter

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: Danny Trebbien [mailto:dtrebbien@gmail.com]
> Sent: zondag 13 februari 2011 21:00
> To: Subversion Development
> Subject: [PATCH] extend the SVN_ERR macro with a cleanup statement
> parameter
> 
> Attached is a small patch to extend the SVN_ERR macro with another
> parameter, a cleanup statement, that is executed before the error
> generated by EXPR (if not SVN_NO_ERROR) is returned.  Also attached is
> a log message.
> 
> I plan on using this in a test of svn_subst_translate_string2() in
> which I need to reset the locale to whatever it was before the test
> began.  See:  http://thread.gmane.org/gmane.comp.version-
> control.subversion.devel/125782

It's much easier to use a helper function or (if that is impossible) a goto to get specialized error handling.

This macro is in use everywhere inside Subversion and in many third party tools using our libraries so I would recommend to not change it.

Another option is a file local macro that performs your specialized cleanup.

All those options are used in multiple places in our codebase.

	Bert