diff options
author | Bruno Haible <bruno@clisp.org> | 2018-09-08 16:37:56 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2018-09-08 16:37:56 +0200 |
commit | 5f4cf73df2bd7002cbff3869352c96b9b7cbfeda (patch) | |
tree | 8f34e7c38c34f7aec89cbc870bab4f447fbc5a1d | |
parent | 24f492fd8de73ea9c30e8820da3d7ac6fdda194e (diff) | |
download | gperf-5f4cf73df2bd7002cbff3869352c96b9b7cbfeda.tar.gz |
Don't print uninitialized hash values in debug mode.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/output.cc | 16 |
2 files changed, 19 insertions, 5 deletions
@@ -1,5 +1,13 @@ 2018-09-08 Bruno Haible <bruno@clisp.org> + Don't print uninitialized hash values in debug mode. + Reported by Frank Wojcik <frankw@touristinresidence.com> in + <https://savannah.gnu.org/patch/?9560>. + * src/output.cc (output_keyword_entry): Add an 'is_duplicate' argument. + (Output::output_keyword_table): Update callers. + +2018-09-08 Bruno Haible <bruno@clisp.org> + Improve the speed of the positions search. Reported by Frank Wojcik <frankw@touristinresidence.com> in <https://savannah.gnu.org/patch/?9562>. diff --git a/src/output.cc b/src/output.cc index e8370b1..2539fde 100644 --- a/src/output.cc +++ b/src/output.cc @@ -1172,7 +1172,7 @@ Output::output_string_pool () const /* ------------------------------------------------------------------------- */ static void -output_keyword_entry (KeywordExt *temp, int stringpool_index, const char *indent) +output_keyword_entry (KeywordExt *temp, int stringpool_index, const char *indent, bool is_duplicate) { if (option[TYPE]) output_line_directive (temp->_lineno); @@ -1205,8 +1205,14 @@ output_keyword_entry (KeywordExt *temp, int stringpool_index, const char *indent printf ("}"); } if (option[DEBUG]) - printf (" /* hash value = %d, index = %d */", - temp->_hash_value, temp->_final_index); + { + printf (" /* "); + if (is_duplicate) + printf ("hash value duplicate, "); + else + printf ("hash value = %d, ", temp->_hash_value); + printf ("index = %d */", temp->_final_index); + } } static void @@ -1297,7 +1303,7 @@ Output::output_keyword_table () const keyword->_final_index = index; - output_keyword_entry (keyword, index, indent); + output_keyword_entry (keyword, index, indent, false); /* Deal with duplicates specially. */ if (keyword->_duplicate_link) // implies option[DUP] @@ -1311,7 +1317,7 @@ Output::output_keyword_table () const keyword->_allchars_length) == 0 ? keyword->_final_index : links->_final_index); - output_keyword_entry (links, stringpool_index, indent); + output_keyword_entry (links, stringpool_index, indent, true); } index++; |