}
static void
-add_field (struct data_parser *p, const struct fmt_spec *format, int case_idx,
+add_field (struct data_parser *p, struct fmt_spec format, int case_idx,
const char *name, int record, int first_column)
{
struct field *field;
if (p->n_fields == p->field_allocated)
p->fields = x2nrealloc (p->fields, &p->field_allocated, sizeof *p->fields);
field = &p->fields[p->n_fields++];
- field->format = *format;
- field->case_idx = case_idx;
- field->name = xstrdup (name);
- field->record = record;
- field->first_column = first_column;
+ *field = (struct field) {
+ .format = format,
+ .case_idx = case_idx,
+ .name = xstrdup (name),
+ .record = record,
+ .first_column = first_column,
+ };
}
/* Adds a delimited field to the field parsed by PARSER, which
against variable NAME. */
void
data_parser_add_delimited_field (struct data_parser *parser,
- const struct fmt_spec *format, int case_idx,
+ struct fmt_spec format, int case_idx,
const char *name)
{
assert (parser->type == DP_DELIMITED);
increased as needed. */
void
data_parser_add_fixed_field (struct data_parser *parser,
- const struct fmt_spec *format, int case_idx,
+ struct fmt_spec format, int case_idx,
const char *name,
int record, int first_column)
{
union value *value = case_data_rw_idx (c, f->case_idx);
char *error = data_in (s, input_encoding, f->format.type,
settings_get_fmt_settings (),
- value, fmt_var_width (&f->format),
+ value, fmt_var_width (f->format),
output_encoding);
if (error == NULL)
error = data_in (s, input_encoding, f->format.type,
settings_get_fmt_settings (),
case_data_rw_idx (c, f->case_idx),
- fmt_var_width (&f->format), output_encoding);
+ fmt_var_width (f->format), output_encoding);
if (error != NULL)
parse_error (reader, f, first_column, last_column, error);
}
f->name);
for (; f < end; f++)
value_set_missing (case_data_rw_idx (c, f->case_idx),
- fmt_var_width (&f->format));
+ fmt_var_width (f->format));
goto exit;
}
error = data_in (s, input_encoding, f->format.type,
settings_get_fmt_settings (),
case_data_rw_idx (c, f->case_idx),
- fmt_var_width (&f->format), output_encoding);
+ fmt_var_width (f->format), output_encoding);
if (error != NULL)
parse_error (reader, f, first_column, last_column, error);
}
char str[FMT_STRING_LEN_MAX + 1];
pivot_table_put2 (table, 2, variable_idx,
pivot_value_new_user_text (
- fmt_to_string (&f->format, str), -1));
+ fmt_to_string (f->format, str), -1));
}
char str[FMT_STRING_LEN_MAX + 1];
pivot_table_put2 (table, 0, variable_idx,
pivot_value_new_user_text (
- fmt_to_string (&f->format, str), -1));
+ fmt_to_string (f->format, str), -1));
}
pivot_table_submit (table);