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

Re: Validating svn_wc_entry_t fields in write_entry()?

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Fri, 13 Jun 2008 17:23:02 +0100

On Fri, 2008-06-13 at 08:25 -0700, Blair Zajac wrote:
> I decided that I wasn't happy ignoring errors here, even if consistency checks
> can be made earlier: r31729.
>
> With this change, I can also remove an assert(): r31730.

- assert(name);
+ if (! name)
+ return svn_error_createf
+ (SVN_ERR_INCORRECT_PARAMS, NULL,
+ _("write_entry() cannot be called with a NULL name argument"));

This change implies that returning an svn_error_t with a localisable
message is inherently "better" than an assertion, but it trades a
potential behavioural improvement (if such a bug exists in our library,
a program using it can trap it cleanly rather than aborting) for a
decrease in readability (4 lines just to indicate one simple fact) and
an increase in translator effort.

I can't single out and complain against this particular case: it's a
dilemma we've always had. However, this has prompted me into proposing a
solution. See the new thread entitled "[RFC] Replacement for "assert" in
the libraries".

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-06-13 18:23:25 CEST

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.