From 027eba771a7ef9d25e97f0026d6469ea34c06523 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Wed, 31 Dec 2003 08:28:06 +0000 Subject: [PATCH] Fixed a bug in frequencies.q which would crash on alpha values --- src/ChangeLog | 4 ++++ src/frequencies.q | 9 ++++++--- tests/Makefile.am | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4e205f8c..4eb438ae 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +Wed Dec 31 16:27:33 WAST 2003 John Darrington + + * Fixed bug where FREQ would crash on alpha values + Tue Dec 30 22:42:57 2003 Ben Pfaff * Removed bletcherous alloca() workarounds for AIX from top of diff --git a/src/frequencies.q b/src/frequencies.q index 52f23357..a9c5850d 100644 --- a/src/frequencies.q +++ b/src/frequencies.q @@ -514,6 +514,8 @@ get_freq_comparator (int frq_sort, int var_type) case FRQ_DFREQ | (ALPHA << 16): return compare_freq_alpha_d; default: assert (0); } + + return 0; } static int @@ -831,12 +833,13 @@ hash_value_numeric (const void *value_, void *foo unused) /* Hash of string values. */ static unsigned -hash_value_alpha (const void *value_, void *len_) +hash_value_alpha (const void *value_, void *len_ unused) { const struct freq *value = value_; - int *len = len_; - return hsh_hash_bytes (value->v.s, *len); + static int len = MAX_SHORT_STRING; + + return hsh_hash_bytes (value->v.s, len); } /* Ascending numeric compare of values. */ diff --git a/tests/Makefile.am b/tests/Makefile.am index 69bbad95..721520b7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -21,6 +21,7 @@ TESTS = command/aggregate.sh \ command/tabs.sh \ command/split-file.sh \ command/weight.sh \ + bugs/alpha-freq.sh \ bugs/double-frequency.sh \ bugs/html-frequency.sh \ bugs/crosstabs.sh -- 2.30.2