Previously, certain functions would crash, or behave badly if their
argument was NULL. This change makes them do nothing, or return
default values, as appropriate. This saves callers having to always
test for NULL.
{
int i;
struct variable_node *vn = NULL;
+
+ if (NULL == cat)
+ return;
+
const double weight = cat->wv ? case_data (c, cat->wv)->f : 1.0;
assert (NULL == cat->reverse_variable_map_short);
size_t
categoricals_df_total (const struct categoricals *cat)
{
+ if (NULL == cat)
+ return 0;
+
return cat->df_sum;
}
int i;
int idx_short = 0;
int idx_long = 0;
+
+ if (NULL == cat)
+ return;
+
cat->df_sum = 0;
cat->n_cats_total = 0;