From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3283 invoked by alias); 28 Nov 2011 15:07:16 -0000 Received: (qmail 2919 invoked by uid 22791); 28 Nov 2011 15:07:08 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_CP X-Spam-Check-By: sourceware.org Received: from mail-bw0-f41.google.com (HELO mail-bw0-f41.google.com) (209.85.214.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Nov 2011 15:06:46 +0000 Received: by bke17 with SMTP id 17so9773141bke.0 for ; Mon, 28 Nov 2011 07:06:45 -0800 (PST) Received: by 10.204.8.77 with SMTP id g13mr44674100bkg.89.1322492805428; Mon, 28 Nov 2011 07:06:45 -0800 (PST) Received: from localhost.localdomain (l49-9-169.cn.ru. [178.49.9.169]) by mx.google.com with ESMTPS id q6sm30189806bka.6.2011.11.28.07.06.43 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 28 Nov 2011 07:06:44 -0800 (PST) From: Andrey Smirnov To: gdb-patches@sourceware.org Subject: [PATCH 024/238] [misc.] bcache.c: -Wshadow fix Date: Mon, 28 Nov 2011 15:07:00 -0000 Message-Id: <1322492788-29388-2-git-send-email-andrew.smirnov@gmail.com> In-Reply-To: <1322492788-29388-1-git-send-email-andrew.smirnov@gmail.com> References: <1322492788-29388-1-git-send-email-andrew.smirnov@gmail.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-11/txt/msg00754.txt.bz2 Cause: `bcache' function from "bcache.h" To ChangeLog: * bcache.c (bcache_full): Rename `bcache' to `cache'(-Wshadow). --- gdb/ChangeLog | 5 +++++ gdb/bcache.c | 36 ++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 431e4f6..f23767c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2011-11-22 Andrey Smirnov + * bcache.c (bcache_full): Fix -Wshadow + warnings. + +2011-11-22 Andrey Smirnov + * bcache.c (bcache): Fix -Wshadow warnings. diff --git a/gdb/bcache.c b/gdb/bcache.c index 035ed22..6e51cf2 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 *cache, 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 (cache->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 (&cache->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 (cache->unique_count >= cache->num_buckets * CHAIN_LENGTH_THRESHOLD) + expand_hash_table (cache); - bcache->total_count++; - bcache->total_size += length; + cache->total_count++; + cache->total_size += length; - full_hash = bcache->hash_function (addr, length); + full_hash = cache->hash_function (addr, length); half_hash = (full_hash >> 16); - hash_index = full_hash % bcache->num_buckets; + hash_index = full_hash % cache->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 = cache->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)) + && cache->compare_function (&s->d.data, addr, length)) return &s->d.data; else - bcache->half_hash_miss_count++; + cache->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 (&cache->cache, BSTRING_SIZE (length)); memcpy (&new->d.data, addr, length); new->length = length; - new->next = bcache->bucket[hash_index]; + new->next = cache->bucket[hash_index]; new->half_hash = half_hash; - bcache->bucket[hash_index] = new; + cache->bucket[hash_index] = new; - bcache->unique_count++; - bcache->unique_size += length; - bcache->structure_size += BSTRING_SIZE (length); + cache->unique_count++; + cache->unique_size += length; + cache->structure_size += BSTRING_SIZE (length); if (added) *added = 1; -- 1.7.5.4