X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fcasereader-filter.c;h=f4ad7e625a3e7ea79dfc91c4e93864eac78394d1;hb=4bc96629da7d8f0354d8ebf297052e881f936d83;hp=a5a2dd5476d52ab76ee89ebbfb4f45f60a477521;hpb=96994a54e60e9c95b8bba54c2281acf7059b1203;p=pspp diff --git a/src/data/casereader-filter.c b/src/data/casereader-filter.c index a5a2dd5476..f4ad7e625a 100644 --- a/src/data/casereader-filter.c +++ b/src/data/casereader-filter.c @@ -212,7 +212,7 @@ casereader_filter_weight_include (const struct ccase *c, void *cfw_) { struct casereader_filter_weight *cfw = cfw_; double value = case_num (c, cfw->weight_var); - if (value >= 0.0 && !var_is_num_missing (cfw->weight_var, value, MV_ANY)) + if (value >= 0.0 && !var_is_num_missing (cfw->weight_var, value)) return true; else { @@ -243,7 +243,7 @@ casereader_filter_weight_destroy (void *cfw_) struct casereader_filter_missing { struct variable **vars; /* Variables whose values to filter. */ - size_t var_cnt; /* Number of variables. */ + size_t n_vars; /* Number of variables. */ enum mv_class class; /* Types of missing values to filter. */ casenumber *n_missing; }; @@ -253,7 +253,7 @@ static bool casereader_filter_missing_destroy (void *); /* Creates and returns a casereader that filters out cases from READER that have a missing value in the given CLASS for any of - the VAR_CNT variables in VARS. Only cases that have + the N_VARS variables in VARS. Only cases that have non-missing values for all of these variables are passed through. @@ -273,16 +273,16 @@ static bool casereader_filter_missing_destroy (void *); when the filtering casereader is destroyed. */ struct casereader * casereader_create_filter_missing (struct casereader *reader, - const struct variable *const*vars, size_t var_cnt, + const struct variable *const *vars, size_t n_vars, enum mv_class class, casenumber *n_missing, struct casewriter *exclude) { - if (var_cnt > 0 && class != MV_NEVER) + if (n_vars > 0 && class) { struct casereader_filter_missing *cfm = xmalloc (sizeof *cfm); - cfm->vars = xmemdup (vars, sizeof *vars * var_cnt); - cfm->var_cnt = var_cnt; + cfm->vars = xmemdup (vars, sizeof *vars * n_vars); + cfm->n_vars = n_vars; cfm->class = class; cfm->n_missing = n_missing; if (n_missing) *n_missing = 0; @@ -304,11 +304,11 @@ casereader_filter_missing_include (const struct ccase *c, void *cfm_) const struct casereader_filter_missing *cfm = cfm_; size_t i; - for (i = 0; i < cfm->var_cnt; i++) + for (i = 0; i < cfm->n_vars; i++) { struct variable *var = cfm->vars[i]; const union value *value = case_data (c, var); - if (var_is_value_missing (var, value, cfm->class)) + if (var_is_value_missing (var, value) & cfm->class) { if (cfm->n_missing) (*cfm->n_missing)++;