diff options
author | Bruno Haible <bruno@clisp.org> | 2003-04-07 09:50:11 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2003-04-07 09:50:11 +0000 |
commit | 2535f34494011d57d9603d6e44604d357f83a4b0 (patch) | |
tree | b64db3a05de58cdd2af82157b5218a13fd318b83 /src/output.cc | |
parent | ec3d1127fa7742bd291bfe039fd76b4d2381da6f (diff) | |
download | gperf-2535f34494011d57d9603d6e44604d357f83a4b0.tar.gz |
Move the handling of ALLCHARS (-k'*') into the Positions class.
Diffstat (limited to 'src/output.cc')
-rw-r--r-- | src/output.cc | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/src/output.cc b/src/output.cc index 05ac35a..94e5952 100644 --- a/src/output.cc +++ b/src/output.cc @@ -606,7 +606,7 @@ Output::output_hash_function () const printf ("{\n"); /* First the asso_values array. */ - if (option[ALLCHARS] || _key_positions.get_size() > 0) + if (_key_positions.get_size() > 0) { printf (" static %s%s asso_values[] =\n" " {", @@ -633,31 +633,7 @@ Output::output_hash_function () const " };\n"); } - if (option[ALLCHARS]) - { - /* User wants *all* characters considered in hash. */ - printf (" register int hval = %s;\n\n" - " switch (%s)\n" - " {\n" - " default:\n", - option[NOLENGTH] ? "0" : "len", - option[NOLENGTH] ? "len" : "hval"); - - for (int i = _max_key_len; i > 0; i--) - { - printf (" case %d:\n" - " hval += asso_values[%sstr[%d]", - i, char_to_index, i - 1); - if (_alpha_inc[i - 1]) - printf ("+%u", _alpha_inc[i - 1]); - printf ("];\n"); - } - - printf (" break;\n" - " }\n" - " return hval;\n"); - } - else if (_key_positions.get_size() == 0) + if (_key_positions.get_size() == 0) { /* Trivial case: No key positions at all. */ printf (" return %s;\n", @@ -668,7 +644,7 @@ Output::output_hash_function () const /* Iterate through the key positions. Remember that Positions::sort() has sorted them in decreasing order, with Positions::LASTCHAR coming last. */ - PositionIterator iter (_key_positions); + PositionIterator iter = _key_positions.iterator(_max_key_len); int key_pos; /* Get the highest key position. */ |