X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdata-io%2Fcombine-files.c;h=27e511595e04f205ce4a4abef7063260ce822d8e;hb=b051ed08f170d5211f47491da71539f996ee5655;hp=6d9ed5d43b0d628ca41390121837eaf9c2a38f7a;hpb=63c7521729b947ace9e192dff9330813ecfb5812;p=pspp diff --git a/src/language/data-io/combine-files.c b/src/language/data-io/combine-files.c index 6d9ed5d43b..27e511595e 100644 --- a/src/language/data-io/combine-files.c +++ b/src/language/data-io/combine-files.c @@ -238,7 +238,7 @@ combine_files (enum comb_command_type command, while (lex_match (lexer, T_SLASH)) if (lex_match_id (lexer, "RENAME")) { - if (!parse_dict_rename (lexer, file->dict)) + if (!parse_dict_rename (lexer, file->dict, false)) goto error; } else if (lex_match_id (lexer, "IN")) @@ -414,11 +414,11 @@ combine_files (enum comb_command_type command, for (i = 0; i < proc.n_files; i++) { struct comb_file *file = &proc.files[i]; - size_t src_var_cnt = dict_get_var_cnt (file->dict); + size_t src_n_vars = dict_get_n_vars (file->dict); size_t j; - file->mv = xnmalloc (src_var_cnt, sizeof *file->mv); - for (j = 0; j < src_var_cnt; j++) + file->mv = xnmalloc (src_n_vars, sizeof *file->mv); + for (j = 0; j < src_n_vars; j++) { struct variable *src_var = dict_get_var (file->dict, j); struct variable *dst_var = dict_lookup_var (proc.dict, @@ -517,7 +517,7 @@ merge_dictionary (struct dictionary *const m, struct comb_file *f) The correct thing to do would be to convert to an encoding which can cope with all the input files (eg UTF-8). */ - if ( 0 != strcmp (dict_get_encoding (f->dict), dict_get_encoding (m))) + if (0 != strcmp (dict_get_encoding (f->dict), dict_get_encoding (m))) msg (MW, _("Combining files with incompatible encodings. String data may " "not be represented correctly.")); @@ -543,7 +543,7 @@ merge_dictionary (struct dictionary *const m, struct comb_file *f) } } - for (i = 0; i < dict_get_var_cnt (d); i++) + for (i = 0; i < dict_get_n_vars (d); i++) { struct variable *dv = dict_get_var (d, i); struct variable *mv = dict_lookup_var (m, var_get_name (dv)); @@ -639,12 +639,12 @@ close_all_comb_files (struct comb_proc *proc) for (i = 0; i < proc->n_files; i++) { struct comb_file *file = &proc->files[i]; - subcase_destroy (&file->by_vars); - subcase_destroy (&file->src); - subcase_destroy (&file->dst); + subcase_uninit (&file->by_vars); + subcase_uninit (&file->src); + subcase_uninit (&file->dst); free (file->mv); fh_unref (file->handle); - dict_destroy (file->dict); + dict_unref (file->dict); casereader_destroy (file->reader); case_unref (file->data); free (file->in_name); @@ -659,7 +659,7 @@ static void free_comb_proc (struct comb_proc *proc) { close_all_comb_files (proc); - dict_destroy (proc->dict); + dict_unref (proc->dict); casewriter_destroy (proc->output); case_matcher_destroy (proc->matcher); if (proc->prev_BY) @@ -668,7 +668,7 @@ free_comb_proc (struct comb_proc *proc) proc->prev_BY); free (proc->prev_BY); } - subcase_destroy (&proc->by_vars); + subcase_uninit (&proc->by_vars); case_unref (proc->buffered_case); } @@ -717,7 +717,7 @@ execute_match_files (struct comb_proc *proc) size_t i; output = create_output_case (proc); - for (i = proc->n_files; i-- > 0; ) + for (i = proc->n_files; i-- > 0;) { struct comb_file *file = &proc->files[i]; if (file->type == COMB_FILE) @@ -821,7 +821,7 @@ scan_table (struct comb_file *file, union value by[]) static struct ccase * create_output_case (const struct comb_proc *proc) { - size_t n_vars = dict_get_var_cnt (proc->dict); + size_t n_vars = dict_get_n_vars (proc->dict); struct ccase *output; size_t i; @@ -835,7 +835,7 @@ create_output_case (const struct comb_proc *proc) { struct comb_file *file = &proc->files[i]; if (file->in_var != NULL) - case_data_rw (output, file->in_var)->f = false; + *case_num_rw (output, file->in_var) = false; } return output; } @@ -844,7 +844,7 @@ static void mark_file_used (const struct comb_file *file, struct ccase *output) { if (file->in_var != NULL) - case_data_rw (output, file->in_var)->f = true; + *case_num_rw (output, file->in_var) = true; } /* Copies the data from FILE's case into output case OUTPUT. @@ -873,7 +873,7 @@ apply_nonmissing_case (const struct comb_file *file, struct ccase *output) = case_data_idx (file->data, src_field->case_index); int width = src_field->width; - if (!mv_is_value_missing (file->mv[i], src_value, MV_ANY) + if (!mv_is_value_missing (file->mv[i], src_value) && !(width > 0 && value_is_spaces (src_value, width))) value_copy (case_data_rw_idx (output, dst_field->case_index), src_value, width); @@ -913,7 +913,7 @@ output_case (struct comb_proc *proc, struct ccase *output, union value by[]) { new_BY = !subcase_equal_xx (&proc->by_vars, proc->prev_BY, by); if (proc->last != NULL) - case_data_rw (proc->buffered_case, proc->last)->f = new_BY; + *case_num_rw (proc->buffered_case, proc->last) = new_BY; casewriter_write (proc->output, proc->buffered_case); } else @@ -921,7 +921,7 @@ output_case (struct comb_proc *proc, struct ccase *output, union value by[]) proc->buffered_case = output; if (proc->first != NULL) - case_data_rw (proc->buffered_case, proc->first)->f = new_BY; + *case_num_rw (proc->buffered_case, proc->first) = new_BY; if (new_BY) { @@ -946,7 +946,7 @@ output_buffered_case (struct comb_proc *proc) if (proc->prev_BY != NULL) { if (proc->last != NULL) - case_data_rw (proc->buffered_case, proc->last)->f = 1.0; + *case_num_rw (proc->buffered_case, proc->last) = 1.0; casewriter_write (proc->output, proc->buffered_case); proc->buffered_case = NULL; }