X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fdata%2Fcase.c;h=20ed8bae2810ac6bbf8b2a3766358a776598a8c4;hb=4196dc548eca5925571a9f61fbb1008646f3a09d;hp=9c42107de226dc76bc5c21e6f149ee35892f6db4;hpb=c708736bdd0fea4b79f3ee4a10e00c3abb95d9e3;p=pspp diff --git a/src/data/case.c b/src/data/case.c index 9c42107de2..20ed8bae28 100644 --- a/src/data/case.c +++ b/src/data/case.c @@ -255,7 +255,7 @@ case_from_values (struct ccase *c, const union value *input, element of C numbered IDX. The caller must not modify the returned data. */ const union value * -case_data (const struct ccase *c, size_t idx) +case_data_idx (const struct ccase *c, size_t idx) { assert (c != NULL); assert (c->case_data != NULL); @@ -270,7 +270,7 @@ case_data (const struct ccase *c, size_t idx) /* Returns the numeric value of the `union value' in C numbered IDX. */ double -case_num (const struct ccase *c, size_t idx) +case_num_idx (const struct ccase *c, size_t idx) { assert (c != NULL); assert (c->case_data != NULL); @@ -287,7 +287,7 @@ case_num (const struct ccase *c, size_t idx) (Note that the value is not null-terminated.) The caller must not modify the return value. */ const char * -case_str (const struct ccase *c, size_t idx) +case_str_idx (const struct ccase *c, size_t idx) { assert (c != NULL); assert (c->case_data != NULL); @@ -303,7 +303,7 @@ case_str (const struct ccase *c, size_t idx) element of C numbered IDX. The caller is allowed to modify the returned data. */ union value * -case_data_rw (struct ccase *c, size_t idx) +case_data_rw_idx (struct ccase *c, size_t idx) { assert (c != NULL); assert (c->case_data != NULL); @@ -338,22 +338,21 @@ case_compare_2dict (const struct ccase *ca, const struct ccase *cb, const struct variable *va = *vap; const struct variable *vb = *vbp; - assert (va->type == vb->type); - assert (va->width == vb->width); + assert (var_get_width (va) == var_get_width (vb)); - if (va->width == 0) + if (var_get_width (va) == 0) { - double af = case_num (ca, va->fv); - double bf = case_num (cb, vb->fv); + double af = case_num (ca, va); + double bf = case_num (cb, vb); if (af != bf) return af > bf ? 1 : -1; } else { - const char *as = case_str (ca, va->fv); - const char *bs = case_str (cb, vb->fv); - int cmp = memcmp (as, bs, va->width); + const char *as = case_str (ca, va); + const char *bs = case_str (cb, vb); + int cmp = memcmp (as, bs, var_get_width (va)); if (cmp != 0) return cmp;