Make casewriters keep track of the number of `union value's in each
[pspp-builds.git] / src / language / data-io / get.c
index dbda3662372b9a8a3f3d016a119a7fbab84c0988..383513e632f0aadb5640d17e4cb81411fd312711 100644 (file)
@@ -54,6 +54,7 @@ static struct case_map *finish_case_map (struct dictionary *);
 static void map_case (const struct case_map *,
                       const struct ccase *, struct ccase *);
 static void destroy_case_map (struct case_map *);
+static size_t case_map_get_value_cnt (const struct case_map *);
 
 static bool parse_dict_trim (struct lexer *, struct dictionary *);
 \f
@@ -358,6 +359,7 @@ parse_write_command (struct lexer *lexer, struct dataset *ds,
   map = finish_case_map (dict);
   if (map != NULL)
     writer = casewriter_create_translator (writer,
+                                           case_map_get_value_cnt (map),
                                            get_translate_case,
                                            get_destroy_case_map,
                                            map);
@@ -1442,3 +1444,11 @@ destroy_case_map (struct case_map *map)
       free (map);
     }
 }
+
+/* Returns the number of `union value's in cases created by
+   MAP. */
+static size_t
+case_map_get_value_cnt (const struct case_map *map)
+{
+  return map->value_cnt;
+}