John Darrington <j...@darrington.wattle.id.au> writes:

> diff --git a/src/data/value-labels.c b/src/data/value-labels.c
> index 0b2ae3f..679f4d1 100644
> --- a/src/data/value-labels.c
> +++ b/src/data/value-labels.c
> @@ -362,6 +362,12 @@ val_labs_equal (const struct val_labs *a, const struct 
> val_labs *b)
>  {
>    const struct val_lab *label;
>  
> +  if (a == b)
> +    return true;
> +
> +  if ( ( a == NULL && b != NULL) || (b == NULL && a != NULL))
> +    return false;
> +
>    if (val_labs_count (a) != val_labs_count (b) || a->width != b->width)
>      return false;

This isn't right, because a null val_labs can equal a nonnull
one, if the nonnull one doesn't have any labels.

How about this instead:

  if (val_labs_count (a) != val_labs_count (b))
    return false;

  if (a == NULL || b == NULL)
    return true;

  if (a->width != b->width)
    return false;

The update to psppire_value_entry_set_value_labels() looks good
to me.

Thanks,

Ben.

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

Reply via email to