Fixed bug reporting the significance of paired value t-test.
[pspp-builds.git] / src / language / stats / freq.c
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2006 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 #include <config.h>
18 #include <data/variable.h>
19 #include <data/value.h>
20 #include <libpspp/compiler.h>
21
22 #include <stdlib.h>
23
24 #include "freq.h"
25
26 int
27 compare_freq ( const void *_f1, const void *_f2, const void *_var)
28 {
29   const struct freq *f1 = _f1;
30   const struct freq *f2 = _f2;
31   const struct variable *var = _var;
32
33   return  compare_values (f1->value, f2->value, var_get_width (var) );
34 }
35
36 unsigned int
37 hash_freq (const void *_f, const void *_var)
38 {
39   const struct freq *f = _f;
40   const struct variable *var  = _var;
41
42   return hash_value (f->value, var_get_width (var));
43 }
44
45 /* Free function to be used on FR whose value parameter has been copied */
46 void
47 free_freq_mutable_hash (void *fr, const void *var UNUSED)
48 {
49   struct freq_mutable *freq = fr;
50   free (freq->value);
51   free (freq);
52 }
53
54 void
55 free_freq_hash (void *fr, const void *var UNUSED)
56 {
57   free (fr);
58 }