X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Frank.q;h=3f1dd3a9e92c6eb7fcb159eff15846e4cb7c16b3;hb=9105b67fe006fe41c044e3659325594a52d0c899;hp=f5be9e9a24405bb4351ea8676f52fa7bee033c22;hpb=4517b68e7248f22e7b7ed81f0d73179351a53047;p=pspp diff --git a/src/language/stats/rank.q b/src/language/stats/rank.q index f5be9e9a24..3f1dd3a9e9 100644 --- a/src/language/stats/rank.q +++ b/src/language/stats/rank.q @@ -154,10 +154,10 @@ static size_t n_rank_specs; static struct sort_criteria *sc; -static struct variable **group_vars; +static const struct variable **group_vars; static size_t n_group_vars; -static struct variable **src_vars; +static const struct variable **src_vars; static size_t n_src_vars; @@ -245,7 +245,7 @@ rank_cmd (struct dataset *ds, const struct sort_criteria *sc, criteria.crits = xnmalloc (criteria.crit_cnt, sizeof *criteria.crits); for (i = 0; i < n_splits ; i++) { - struct variable *v = dict_get_split_vars (dataset_dict (ds))[i]; + const struct variable *v = dict_get_split_vars (dataset_dict (ds))[i]; criteria.crits[i].fv = var_get_case_index (v); criteria.crits[i].width = var_get_width (v); criteria.crits[i].dir = SRT_ASCEND; @@ -510,6 +510,7 @@ rank_cases (struct casereader *cr, { struct casereader *lookahead; const union value *this_value; + bool this_value_is_missing; struct ccase this_case, lookahead_case; double c; int i; @@ -519,6 +520,8 @@ rank_cases (struct casereader *cr, break; this_value = case_data_idx (&this_case, fv); + this_value_is_missing = mv_is_value_missing (mv, this_value, + exclude_values); c = dict_get_case_weight (dict, &this_case, &warn); lookahead = casereader_clone (cr); @@ -545,7 +548,7 @@ rank_cases (struct casereader *cr, casereader_destroy (lookahead); cc_1 = cc; - if ( !mv_is_value_missing (mv, this_value, exclude_values) ) + if ( !this_value_is_missing ) cc += c; do @@ -554,7 +557,7 @@ rank_cases (struct casereader *cr, { const struct variable *dst_var = rs[i].destvars[dest_var_index]; - if ( mv_is_value_missing (mv, this_value, exclude_values) ) + if (this_value_is_missing) case_data_rw (&this_case, dst_var)->f = SYSMIS; else case_data_rw (&this_case, dst_var)->f = @@ -564,7 +567,7 @@ rank_cases (struct casereader *cr, } while (n-- > 0 && casereader_read_xfer (cr, &this_case)); - if ( !mv_is_value_missing (mv, this_value, exclude_values) ) + if ( !this_value_is_missing ) iter++; } @@ -943,7 +946,7 @@ rank_custom_variables (struct lexer *lexer, struct dataset *ds, struct cmd_rank return 2; } - if (!parse_variables (lexer, dataset_dict (ds), + if (!parse_variables_const (lexer, dataset_dict (ds), &group_vars, &n_group_vars, PV_NO_DUPLICATE | PV_NO_SCRATCH) ) {