This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 24/348] Fix -Wsahdow warnings
- From: Andrey Smirnov <andrew dot smirnov at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 22 Nov 2011 20:21:04 +0700
- Subject: [PATCH 24/348] Fix -Wsahdow warnings
>From c959e87aa076a5ea53f97659dc8a412c6ae77dd5 Mon Sep 17 00:00:00 2001
From: Andrey Smirnov <andrew.smirnov@gmail.com>
Date: Tue, 22 Nov 2011 17:38:40 +0700
Subject: [PATCH 24/39] Fix -Wshadow warnings.
* bcache.c (bcache_full): Fix -Wshadow
warnings.
---
gdb/ChangeLog | 5 +++++
gdb/bcache.c | 36 ++++++++++++++++++------------------
2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index aeb5b56..b3ba09b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2011-11-22 Andrey Smirnov <andrew.smirnov@gmail.com>
+ * bcache.c (bcache_full): Fix -Wshadow
+ warnings.
+
+2011-11-22 Andrey Smirnov <andrew.smirnov@gmail.com>
+
* bcache.c (bcache): Fix -Wshadow
warnings.
diff --git a/gdb/bcache.c b/gdb/bcache.c
index 0fe42b5..bd5b8ea 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -221,7 +221,7 @@ bcache (const void *addr, int length, struct bcache *cache)
returning an old entry. */
const void *
-bcache_full (const void *addr, int length, struct bcache *bcache, int *added)
+bcache_full (const void *addr, int length, struct bcache *cahce, int *added)
{
unsigned long full_hash;
unsigned short half_hash;
@@ -233,55 +233,55 @@ bcache_full (const void *addr, int length, struct bcache *bcache, int *added)
/* Lazily initialize the obstack. This can save quite a bit of
memory in some cases. */
- if (bcache->total_count == 0)
+ if (cahce->total_count == 0)
{
/* We could use obstack_specify_allocation here instead, but
gdb_obstack.h specifies the allocation/deallocation
functions. */
- obstack_init (&bcache->cache);
+ obstack_init (&cahce->cache);
}
/* If our average chain length is too high, expand the hash table. */
- if (bcache->unique_count >= bcache->num_buckets * CHAIN_LENGTH_THRESHOLD)
- expand_hash_table (bcache);
+ if (cahce->unique_count >= cahce->num_buckets * CHAIN_LENGTH_THRESHOLD)
+ expand_hash_table (cahce);
- bcache->total_count++;
- bcache->total_size += length;
+ cahce->total_count++;
+ cahce->total_size += length;
- full_hash = bcache->hash_function (addr, length);
+ full_hash = cahce->hash_function (addr, length);
half_hash = (full_hash >> 16);
- hash_index = full_hash % bcache->num_buckets;
+ hash_index = full_hash % cahce->num_buckets;
/* Search the hash bucket for a string identical to the caller's.
As a short-circuit first compare the upper part of each hash
values. */
- for (s = bcache->bucket[hash_index]; s; s = s->next)
+ for (s = cahce->bucket[hash_index]; s; s = s->next)
{
if (s->half_hash == half_hash)
{
if (s->length == length
- && bcache->compare_function (&s->d.data, addr, length))
+ && cahce->compare_function (&s->d.data, addr, length))
return &s->d.data;
else
- bcache->half_hash_miss_count++;
+ cahce->half_hash_miss_count++;
}
}
/* The user's string isn't in the list. Insert it after *ps. */
{
struct bstring *new
- = obstack_alloc (&bcache->cache, BSTRING_SIZE (length));
+ = obstack_alloc (&cahce->cache, BSTRING_SIZE (length));
memcpy (&new->d.data, addr, length);
new->length = length;
- new->next = bcache->bucket[hash_index];
+ new->next = cahce->bucket[hash_index];
new->half_hash = half_hash;
- bcache->bucket[hash_index] = new;
+ cahce->bucket[hash_index] = new;
- bcache->unique_count++;
- bcache->unique_size += length;
- bcache->structure_size += BSTRING_SIZE (length);
+ cahce->unique_count++;
+ cahce->unique_size += length;
+ cahce->structure_size += BSTRING_SIZE (length);
if (added)
*added = 1;
--
1.7.5.4