1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Fix -Wshadow=compatible-local warnings.

* src/search.cc (Search::prepare_asso_values): Declare 'temp' in each
'for' loop separately.
This commit is contained in:
Bruno Haible
2025-04-26 14:45:56 +02:00
parent 6c00ca4f97
commit 9273667ad1
2 changed files with 15 additions and 13 deletions

View File

@@ -1,3 +1,9 @@
2025-04-26 Bruno Haible <bruno@clisp.org>
Fix -Wshadow=compatible-local warnings.
* src/search.cc (Search::prepare_asso_values): Declare 'temp' in each
'for' loop separately.
2025-04-20 Bruno Haible <bruno@clisp.org>
Add some developer documentation.

View File

@@ -743,8 +743,6 @@ Search::find_alpha_inc ()
void
Search::prepare_asso_values ()
{
KeywordExt_List *temp;
/* Initialize each keyword's _selchars array. */
init_selchars_multiset(_key_positions, _alpha_unify, _alpha_inc);
@@ -766,7 +764,7 @@ Search::prepare_asso_values ()
Hash_Table representatives (_list_len, !_hash_includes_len);
KeywordExt_List *prev = NULL; /* list node before temp */
for (temp = _head; temp; )
for (KeywordExt_List *temp = _head; temp; )
{
KeywordExt *keyword = temp->first();
KeywordExt *other_keyword = representatives.insert (keyword);
@@ -831,7 +829,7 @@ Search::prepare_asso_values ()
/* Compute the occurrences of each character in the alphabet. */
_occurrences = new int[_alpha_size];
memset (_occurrences, 0, _alpha_size * sizeof (_occurrences[0]));
for (temp = _head; temp; temp = temp->rest())
for (KeywordExt_List *temp = _head; temp; temp = temp->rest())
{
KeywordExt *keyword = temp->first();
const unsigned int *ptr = keyword->_selchars;
@@ -843,7 +841,7 @@ Search::prepare_asso_values ()
_asso_values = new int[_alpha_size];
/* Memory allocation in each Keyword. */
for (temp = _head; temp; temp = temp->rest())
for (KeywordExt_List *temp = _head; temp; temp = temp->rest())
{
KeywordExt *keyword = temp->first();
keyword->_undetermined_chars = new unsigned int[keyword->_selchars_length];
@@ -885,14 +883,12 @@ Search::prepare_asso_values ()
int field_width;
field_width = 0;
{
for (KeywordExt_List *temp = _head; temp; temp = temp->rest())
{
KeywordExt *keyword = temp->first();
if (field_width < keyword->_selchars_length)
field_width = keyword->_selchars_length;
}
}
for (KeywordExt_List *temp = _head; temp; temp = temp->rest())
{
KeywordExt *keyword = temp->first();
if (field_width < keyword->_selchars_length)
field_width = keyword->_selchars_length;
}
fprintf (stderr, "\ndumping the keyword list without duplicates\n");
fprintf (stderr, "keyword #, %*s, keyword\n", field_width, "keysig");