.names_must_be_ids = true,
.name_map = HMAP_INITIALIZER (d->name_map),
.attributes = ATTRSET_INITIALIZER (d->attributes),
- .split_type = SPLIT_LAYERED,
+ .split_type = SPLIT_NONE,
.ref_cnt = 1,
};
}
-/* Sets N split vars SPLIT in dictionary D. */
+/* Sets N split vars SPLIT in dictionary D. N is silently capped to a maximum
+ of MAX_SPLITS. */
static void
dict_set_split_vars__ (struct dictionary *d,
struct variable *const *split, size_t n,
enum split_type type, bool skip_callbacks)
{
+ if (n > MAX_SPLITS)
+ n = MAX_SPLITS;
assert (n == 0 || split != NULL);
d->n_splits = n;
- d->split_type = type;
+ d->split_type = type == SPLIT_NONE ? SPLIT_LAYERED : type;
if (n > 0)
{
d->split = xnrealloc (d->split, n, sizeof *d->split) ;
}
}
+enum split_type
+dict_get_split_type (const struct dictionary *d)
+{
+ return d->split_type;
+}
+
/* Sets N split vars SPLIT in dictionary D. */
void
dict_set_split_vars (struct dictionary *d,
void
dict_clear_split_vars (struct dictionary *d)
{
- dict_set_split_vars (d, NULL, 0, SPLIT_LAYERED);
+ dict_set_split_vars (d, NULL, 0, SPLIT_NONE);
}
\f
invalidate_proto (d);
hmap_clear (&d->name_map);
d->next_value_idx = 0;
- dict_set_split_vars__ (d, NULL, 0, SPLIT_LAYERED, skip_callbacks);
+ dict_set_split_vars__ (d, NULL, 0, SPLIT_NONE, skip_callbacks);
if (skip_callbacks)
{