projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rewrote categorical value-handling
[pspp]
/
src
/
group.c
diff --git
a/src/group.c
b/src/group.c
index fb86295ba34748adf423db756d43e251ac797a38..25459edaae91c6ffc6253f5aff13c8c3df4fd6bb 100644
(file)
--- a/
src/group.c
+++ b/
src/group.c
@@
-14,12
+14,18
@@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 5
9 Temple Place - Suite 330
, Boston, MA
- 0211
1-1307
, USA. */
+ Foundation, Inc., 5
1 Franklin Street, Fifth Floor
, Boston, MA
+ 0211
0-1301
, USA. */
+#include <config.h>
+#include <stdlib.h>
+#include "alloc.h"
#include "hash.h"
#include "group.h"
#include "hash.h"
#include "group.h"
-#include <string.h>
+#include "group_proc.h"
+#include "str.h"
+#include "var.h"
+#include "misc.h"
/* Return -1 if the id of a is less than b; +1 if greater than and
/* Return -1 if the id of a is less than b; +1 if greater than and
@@
-29,35
+35,34
@@
compare_group(const struct group_statistics *a,
const struct group_statistics *b,
int width)
{
const struct group_statistics *b,
int width)
{
- int id_cmp = compare_values(&a->id, &b->id, width);
-
- if (id_cmp == 0 )
- {
- int c;
- c= memcmp(&a->criterion,&b->criterion,sizeof(enum comparison));
- return c;
- }
- else
- return id_cmp;
+ return compare_values(&a->id, &b->id, width);
}
}
+
unsigned
hash_group(const struct group_statistics *g, int width)
{
unsigned id_hash;
unsigned
hash_group(const struct group_statistics *g, int width)
{
unsigned id_hash;
- if ( 0 == width )
- id_hash = hsh_hash_double (g->id.f);
- else
- id_hash = hsh_hash_bytes (g->id.s, width);
+ id_hash = hash_value(&g->id, width);
return id_hash;
}
void
return id_hash;
}
void
-free_group(struct group_statistics *v, void *aux)
+free_group(struct group_statistics *v, void *aux
UNUSED
)
{
free(v);
}
{
free(v);
}
+
+
+struct group_proc *
+group_proc_get (struct variable *v)
+{
+ /* This is not ideal, obviously. */
+ if (v->aux == NULL)
+ var_attach_aux (v, xmalloc (sizeof (struct group_proc)), var_dtor_free);
+ return v->aux;
+}