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

Re: Questions about svn_error_clear().

From: Greg Hudson <ghudson_at_MIT.EDU>
Date: 2004-12-16 01:29:38 CET

On Wed, 2004-12-15 at 19:08, kfogel@collab.net wrote:
> 2. Make it project policy to always put 'err = NULL' after
> svn_error_clear(err), and do that everywhere right now.

Yech. This would be like setting pointers to NULL every time you free
them, even if you never use the variable again, in a project which
doesn't use pools.

> 3. Make svn_error_clear() a macro like this:

Still yech, in my opinion. And it would violate our API compatibility
rules, unless we gave it a new name.

In my opinion, code at the end of a function to "clean up the error we
might have encountered at some undefine point earlier on" is inelegant
and error-prone with or without safeties like this. It's not always
100% clear how to avoid that sort of construct without duplicating a lot
of code. But I don't think we should be making project-wide allowances
for the sake of the few places we have that construct.

> 4. Mike's interesting idea: Have svn_error_clear set all the fields
> in the error to zero, so that if we try anything at all with the
> error later, we'll get a quick seg fault.

That's fine with me.

> But it looks like if SVN_DEBUG_ERROR() is defined, then we first cdr
> down to the end of the error chain, and only clear that last error.
> All the ones preceding it will not be touched.

All of the errors in a chain live in the same pool.

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Dec 16 01:31:15 2004

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.