X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fcase-matcher.c;h=46272bbed693011e14c4d324092932c40e053229;hb=81579d9e9f994fb2908f50af41c3eb033d216e58;hp=a1251cb74cbfd816c7dab2ed54129659a0215e0b;hpb=a1efcf97ca2f75f4be6a0389ff2372c03ed2d4e1;p=pspp-builds.git diff --git a/src/data/case-matcher.c b/src/data/case-matcher.c index a1251cb7..46272bbe 100644 --- a/src/data/case-matcher.c +++ b/src/data/case-matcher.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,16 +16,16 @@ #include -#include +#include "data/case-matcher.h" #include -#include -#include -#include -#include +#include "data/case.h" +#include "data/subcase.h" +#include "data/value.h" +#include "libpspp/assertion.h" -#include "xalloc.h" +#include "gl/xalloc.h" struct case_matcher_input { @@ -68,8 +68,11 @@ case_matcher_add_input (struct case_matcher *cm, const struct subcase *by, struct case_matcher_input *input; if (cm->n_inputs == 0) - cm->by_values = xmalloc (subcase_get_n_values (by) - * sizeof *cm->by_values); + { + cm->by_values = xmalloc (sizeof *cm->by_values + * subcase_get_n_fields (by)); + caseproto_init_values (subcase_get_proto (by), cm->by_values); + } else assert (subcase_conformable (by, &cm->inputs[0].by_vars)); @@ -90,6 +93,12 @@ case_matcher_destroy (struct case_matcher *cm) { size_t i; + if (cm->by_values != NULL) + { + caseproto_destroy_values (subcase_get_proto (&cm->inputs[0].by_vars), + cm->by_values); + free (cm->by_values); + } for (i = 0; i < cm->n_inputs; i++) { struct case_matcher_input *input = &cm->inputs[i];