On Mon, Apr 16, 2012 at 08:52:07PM -0700, Ben Pfaff wrote:
     Also, as long as we're checking for too-big we might as well check
     for too-small too.
     ---
      src/ui/gui/psppire-dict.c |    8 ++------
      1 files changed, 2 insertions(+), 6 deletions(-)
     
     diff --git a/src/ui/gui/psppire-dict.c b/src/ui/gui/psppire-dict.c
     index 04bd3e3..32f46f2 100644
     --- a/src/ui/gui/psppire-dict.c
     +++ b/src/ui/gui/psppire-dict.c
     @@ -464,17 +464,13 @@ psppire_dict_set_name (PsppireDict* d, gint idx, 
const gchar *name)
      
     +  g_return_val_if_fail (idx < 0 || dict_get_var_cnt (d->dict) <= idx, 
NULL);

Personally I prefer assertions to be written in their separate components 
rather than ored 
together, like this:

 g_return_val_if_fail (idx < 0, NULL);
 g_return_val_if_fail (dict_get_var_cnt (d->dict) <= idx, NULL);
   
That way, when the condition fails, it's easier to find out which part of the 
condition is failing.

J'

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://keys.gnupg.net or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature

_______________________________________________
pspp-dev mailing list
pspp-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/pspp-dev

Reply via email to