From e0589f0f27cbcd2b109bf9970b59046345f28c03 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 6 Aug 2022 10:55:12 -0700 Subject: [PATCH] dictionary: Introduce SPLIT_NONE for dictionaries without split variables. --- src/data/dictionary.c | 8 ++++---- src/data/dictionary.h | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/data/dictionary.c b/src/data/dictionary.c index c331ea2345..750d785800 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -259,7 +259,7 @@ dict_create (const char *encoding) .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, }; @@ -393,7 +393,7 @@ dict_set_split_vars__ (struct dictionary *d, 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) ; @@ -425,7 +425,7 @@ 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); } @@ -623,7 +623,7 @@ dict_clear__ (struct dictionary *d, bool skip_callbacks) 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) { diff --git a/src/data/dictionary.h b/src/data/dictionary.h index 067142cfd0..050b4a8c4d 100644 --- a/src/data/dictionary.h +++ b/src/data/dictionary.h @@ -123,9 +123,12 @@ void dict_compact_values (struct dictionary *); struct caseproto *dict_get_compacted_proto (const struct dictionary *, unsigned int exclude_classes); -/* SPLIT FILE variables. */ +/* SPLIT FILE variables. + + SPLIT_NONE is used if and only if there are no split file variables. */ enum split_type { + SPLIT_NONE, /* No split file variables. */ SPLIT_SEPARATE, /* Produce separate output for each split. */ SPLIT_LAYERED, /* Output splits in same table. */ }; -- 2.30.2