projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'rewrite-sheet' of ssh://jmd@git.sv.gnu.org/srv/git/pspp into rewrite...
[pspp-builds.git]
/
src
/
data
/
value.c
diff --git
a/src/data/value.c
b/src/data/value.c
index 34e3fe58bb37bf40d80943d38fc4d5ecafdc76d2..9fcf1cbb9b8fa0a97cb4e75544a9a6892879ab68 100644
(file)
--- a/
src/data/value.c
+++ b/
src/data/value.c
@@
-20,6
+20,7
@@
#include <data/val-type.h>
#include <libpspp/hash.h>
#include <libpspp/str.h>
#include <data/val-type.h>
#include <libpspp/hash.h>
#include <libpspp/str.h>
+#include "variable.h"
#include "xalloc.h"
#include "xalloc.h"
@@
-46,8
+47,12
@@
value_create (int width)
Only the short string portion of longer strings are
compared. */
int
Only the short string portion of longer strings are
compared. */
int
-compare_values (const
union value *a, const union value *b, int width
)
+compare_values (const
void *a_, const void *b_, const void *var_
)
{
{
+ const union value *a = a_;
+ const union value *b = b_;
+ const struct variable *var = var_;
+ int width = var_get_width (var);
return (width == 0
? (a->f < b->f ? -1 : a->f > b->f)
: memcmp (a->s, b->s, MIN (MAX_SHORT_STRING, width)));
return (width == 0
? (a->f < b->f ? -1 : a->f > b->f)
: memcmp (a->s, b->s, MIN (MAX_SHORT_STRING, width)));
@@
-56,13
+61,17
@@
compare_values (const union value *a, const union value *b, int width)
/* Create a hash of V, which has the given WIDTH.
Only the short string portion of a longer string is hashed. */
unsigned
/* Create a hash of V, which has the given WIDTH.
Only the short string portion of a longer string is hashed. */
unsigned
-hash_value (const
union value *v, int width
)
+hash_value (const
void *v_, const void *var_
)
{
{
+ const union value *v = v_;
+ const struct variable *var = var_;
+ int width = var_get_width (var);
return (width == 0
? hsh_hash_double (v->f)
return (width == 0
? hsh_hash_double (v->f)
-
: hsh_hash_bytes (v->s, MIN (MAX_SHORT_STRING, width)
));
+
: hsh_hash_bytes (v->s, width
));
}
}
+
/* Copies SRC to DST, given that they both contain data of the
given WIDTH. */
void
/* Copies SRC to DST, given that they both contain data of the
given WIDTH. */
void