/* 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
#include <config.h>
-#include <data/case-matcher.h>
+#include "data/case-matcher.h"
#include <stdlib.h>
-#include <data/case.h>
-#include <data/subcase.h>
-#include <data/value.h>
-#include <libpspp/assertion.h>
+#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
{
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));
{
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];