X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fcategory.c;h=6771b5836f85d4aa29aa5e9ec0561a11a1aa628f;hb=07006e3b80d88f60f3a2af10a805d8bca847a0ef;hp=33078ce2b45528c1cd518e89fb7c798ae44334b6;hpb=685407ad62911e5edb1ec093a01ec9e46563af44;p=pspp diff --git a/src/data/category.c b/src/data/category.c index 33078ce2b4..6771b5836f 100644 --- a/src/data/category.c +++ b/src/data/category.c @@ -108,7 +108,7 @@ cat_value_find (const struct variable *v, const union value *val) { candidate = obs_vals->vals + i; assert (candidate != NULL); - if (!compare_values (candidate, val, var_get_width (v))) + if (!compare_values_short (candidate, val, v)) { return i; } @@ -148,6 +148,23 @@ cat_value_update (const struct variable *v, const union value *val) } } } +/* + Return the count for the sth category. + */ +size_t +cat_get_category_count (const size_t s, const struct variable *v) +{ + struct cat_vals *tmp; + size_t n_categories; + + tmp = var_get_obs_vals (v); + n_categories = cat_get_n_categories (v); + if (s < n_categories) + { + return tmp->value_counts[s]; + } + return CAT_VALUE_NOT_FOUND; +} const union value * cat_subscript_to_value (const size_t s, const struct variable *v)