Instead of checking for NULL before calling val_labs_equal, put the onus
on the function itself to deal with null pointers and behave appropriately.
{
const struct val_lab *label;
- if (val_labs_count (a) != val_labs_count (b) || a->width != b->width)
+ 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;
HMAP_FOR_EACH (label, struct val_lab, node, &a->labels)
psppire_value_entry_set_value_labels (PsppireValueEntry *obj,
const struct val_labs *val_labs)
{
- if (val_labs != NULL
- ? obj->val_labs == NULL || !val_labs_equal (obj->val_labs, val_labs)
- : obj->val_labs != NULL)
+ if (!val_labs_equal (obj->val_labs, val_labs))
{
obj->cur_value = NULL;