From: John Darrington Date: Thu, 29 May 2008 11:07:28 +0000 (+0000) Subject: Fixed bugs which manifested themselves as bus errors on solaris. X-Git-Tag: v0.6.0~3 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2f24e20cafce5616db69902a1594911ab026978;p=pspp-builds.git Fixed bugs which manifested themselves as bus errors on solaris. --- diff --git a/src/data/value.c b/src/data/value.c index 34e3fe58..49555d9a 100644 --- a/src/data/value.c +++ b/src/data/value.c @@ -63,6 +63,20 @@ hash_value (const union value *v, int width) : hsh_hash_bytes (v->s, MIN (MAX_SHORT_STRING, width))); } + +int +compare_ptr_values (const union value **v1, const union value **v2, int width) +{ + return compare_values (*v1, *v2, width); +} + +unsigned +hash_ptr_value (const union value **v, int width) +{ + return hash_value (*v, width); +} + + /* Copies SRC to DST, given that they both contain data of the given WIDTH. */ void diff --git a/src/data/value.h b/src/data/value.h index 612ec114..4554a366 100644 --- a/src/data/value.h +++ b/src/data/value.h @@ -40,7 +40,11 @@ union value *value_dup (const union value *, int width); union value *value_create (int width); int compare_values (const union value *, const union value *, int width); -unsigned hash_value (const union value *, int width); +unsigned hash_value (const union value *, int width); + +int compare_ptr_values (const union value **, const union value **, int width); +unsigned hash_ptr_value (const union value **, int width); + static inline size_t value_cnt_from_width (int width); void value_copy (union value *, const union value *, int width); diff --git a/src/language/stats/ChangeLog b/src/language/stats/ChangeLog index 13bba3dd..e5b7b64c 100644 --- a/src/language/stats/ChangeLog +++ b/src/language/stats/ChangeLog @@ -1,3 +1,8 @@ +2008-05-29 John Darrington + + * examine.q: Fixed bug where incorrect levels of dereferencing + were applied to pointers. + 2008-04-09 John Darrington * regression.q: Fix display of degrees of freedom. diff --git a/src/language/stats/examine.q b/src/language/stats/examine.q index 4fccd83b..9315e7e8 100644 --- a/src/language/stats/examine.q +++ b/src/language/stats/examine.q @@ -835,17 +835,17 @@ run_examine (struct cmd_examine *cmd, struct casereader *input, struct hsh_iterator hi1; struct factor_statistics *fs; - struct hsh_table *idh0=0; - struct hsh_table *idh1=0; - union value *val0; - union value *val1; + struct hsh_table *idh0 = NULL; + struct hsh_table *idh1 = NULL; + union value **val0; + union value **val1; - idh0 = hsh_create (4, (hsh_compare_func *) compare_values, - (hsh_hash_func *) hash_value, + idh0 = hsh_create (4, (hsh_compare_func *) compare_ptr_values, + (hsh_hash_func *) hash_ptr_value, 0,0); - idh1 = hsh_create (4, (hsh_compare_func *) compare_values, - (hsh_hash_func *) hash_value, + idh1 = hsh_create (4, (hsh_compare_func *) compare_ptr_values, + (hsh_hash_func *) hash_ptr_value, 0,0); @@ -853,8 +853,8 @@ run_examine (struct cmd_examine *cmd, struct casereader *input, fs != 0 ; fs = hsh_next (fctr->fstats, &hi)) { - hsh_insert (idh0, (void *) &fs->id[0]); - hsh_insert (idh1, (void *) &fs->id[1]); + hsh_insert (idh0, &fs->id[0]); + hsh_insert (idh1, &fs->id[1]); } /* Ensure that the factors combination is complete */ @@ -867,17 +867,17 @@ run_examine (struct cmd_examine *cmd, struct casereader *input, val1 = hsh_next (idh1, &hi1)) { struct factor_statistics **ffs; - union value key[2]; + union value *key[2]; key[0] = *val0; key[1] = *val1; ffs = (struct factor_statistics **) - hsh_probe (fctr->fstats, (void *) &key ); + hsh_probe (fctr->fstats, &key ); if ( !*ffs ) { size_t i; (*ffs) = create_factor_statistics (n_dependent_vars, - &key[0], &key[1]); + key[0], key[1]); for ( i = 0 ; i < n_dependent_vars ; ++i ) metrics_precalc ( & (*ffs)->m[i]); }