Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 022/238] [misc.] bcache.c: -Wshadow fix.
Date: Mon, 28 Nov 2011 15:07:00 -0000	[thread overview]
Message-ID: <1322492788-29388-1-git-send-email-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <CAHQ1cqHNswA2d5dDQsiu3i0kGe6rDFs+izUNYoWcvcf4NaLd0Q@mail.gmail.com>

Cause:
        Clashes with `bcache' function from "bcache.h".

To ChangeLog:
	* bcache.c (expand_hash_table): Rename `bcache' to `cache'(-Wshadow).
---
 gdb/ChangeLog |    5 +++++
 gdb/bcache.c  |   30 +++++++++++++++---------------
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4ce5f86..57ee41f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2011-11-22  Andrey Smirnov <andrew.smirnov@gmail.com>
 
+	* bcache.c (expand_hash_table): Fix -Wshadow
+	warnings.
+
+2011-11-22  Andrey Smirnov <andrew.smirnov@gmail.com>
+
 	* annotate.c (annotate_array_section_begin): Fix -Wshadow
 	warnings.
 
diff --git a/gdb/bcache.c b/gdb/bcache.c
index 76e3893..5c287d9 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -130,7 +130,7 @@ hash_continue (const void *addr, int length, unsigned long h)
 #define CHAIN_LENGTH_THRESHOLD (5)
 
 static void
-expand_hash_table (struct bcache *bcache)
+expand_hash_table (struct bcache *cache)
 {
   /* A table of good hash table sizes.  Whenever we grow, we pick the
      next larger size from this table.  sizes[i] is close to 1 << (i+10),
@@ -149,13 +149,13 @@ expand_hash_table (struct bcache *bcache)
 
   /* Count the stats.  Every unique item needs to be re-hashed and
      re-entered.  */
-  bcache->expand_count++;
-  bcache->expand_hash_count += bcache->unique_count;
+  cache->expand_count++;
+  cache->expand_hash_count += cache->unique_count;
 
   /* Find the next size.  */
-  new_num_buckets = bcache->num_buckets * 2;
+  new_num_buckets = cache->num_buckets * 2;
   for (i = 0; i < (sizeof (sizes) / sizeof (sizes[0])); i++)
-    if (sizes[i] > bcache->num_buckets)
+    if (sizes[i] > cache->num_buckets)
       {
 	new_num_buckets = sizes[i];
 	break;
@@ -168,22 +168,22 @@ expand_hash_table (struct bcache *bcache)
     new_buckets = (struct bstring **) xmalloc (new_size);
     memset (new_buckets, 0, new_size);
 
-    bcache->structure_size -= (bcache->num_buckets
-			       * sizeof (bcache->bucket[0]));
-    bcache->structure_size += new_size;
+    cache->structure_size -= (cache->num_buckets
+			       * sizeof (cache->bucket[0]));
+    cache->structure_size += new_size;
   }
 
   /* Rehash all existing strings.  */
-  for (i = 0; i < bcache->num_buckets; i++)
+  for (i = 0; i < cache->num_buckets; i++)
     {
       struct bstring *s, *next;
 
-      for (s = bcache->bucket[i]; s; s = next)
+      for (s = cache->bucket[i]; s; s = next)
 	{
 	  struct bstring **new_bucket;
 	  next = s->next;
 
-	  new_bucket = &new_buckets[(bcache->hash_function (&s->d.data,
+	  new_bucket = &new_buckets[(cache->hash_function (&s->d.data,
 							    s->length)
 				     % new_num_buckets)];
 	  s->next = *new_bucket;
@@ -192,10 +192,10 @@ expand_hash_table (struct bcache *bcache)
     }
 
   /* Plug in the new table.  */
-  if (bcache->bucket)
-    xfree (bcache->bucket);
-  bcache->bucket = new_buckets;
-  bcache->num_buckets = new_num_buckets;
+  if (cache->bucket)
+    xfree (cache->bucket);
+  cache->bucket = new_buckets;
+  cache->num_buckets = new_num_buckets;
 }
 
 \f
-- 
1.7.5.4


  parent reply	other threads:[~2011-11-28 15:07 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22 13:07 [PATCH 22/348] Fix -Wsahdow warnings Andrey Smirnov
2011-11-22 13:14 ` Eli Zaretskii
2011-11-22 13:34   ` Andrey Smirnov
2011-11-22 13:35     ` Marek Polacek
2011-11-22 14:04       ` Andrey Smirnov
2011-11-22 15:28         ` Mike Frysinger
2011-11-22 16:05           ` Joel Brobecker
2011-11-22 16:20             ` Mike Frysinger
2011-11-23 17:25               ` Doug Evans
2011-11-22 18:24             ` Tom Tromey
2011-11-23 16:46             ` Mark Kettenis
     [not found]               ` <CAHQ1cqFADK_pXv4JAW6ouvm_NPyM6dM+-FmVF0FojKi1rs98Wg@mail.gmail.com>
2011-11-24  3:23                 ` Andrey Smirnov
2011-11-23  5:29           ` Andrey Smirnov
2011-11-23 17:06             ` Tom Tromey
2011-11-24  3:18               ` Andrey Smirnov
2011-11-23 17:56             ` Doug Evans
2011-11-23 18:03               ` Doug Evans
2011-11-23 20:16                 ` Joel Brobecker
2011-11-24  4:33               ` Andrey Smirnov
2011-11-29 19:06                 ` Tom Tromey
2011-11-28 15:07         ` Andrey Smirnov [this message]
2011-11-28 15:07           ` [PATCH 026/238] [misc.] bcache.c: -Wshadow fix Andrey Smirnov
2011-12-20 15:43             ` Tom Tromey
2011-11-28 15:07           ` [PATCH 024/238] " Andrey Smirnov
2011-12-20 15:46             ` Tom Tromey
2011-11-28 15:07           ` [PATCH 025/238] " Andrey Smirnov
2011-12-20 15:42             ` Tom Tromey
2011-12-20 15:42           ` [PATCH 022/238] " Tom Tromey
2011-12-20 16:13             ` Andrey Smirnov
2011-12-20 19:17               ` Tom Tromey
2011-12-20 19:31                 ` Andrey Smirnov
2011-12-20 21:06                   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322492788-29388-1-git-send-email-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox