From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O7qnI-0007Sr-0x for qemu-devel@nongnu.org; Fri, 30 Apr 2010 10:02:16 -0400 Received: from [140.186.70.92] (port=55180 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O7qnD-0007Oa-Vp for qemu-devel@nongnu.org; Fri, 30 Apr 2010 10:02:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O7qnA-0000QF-Kz for qemu-devel@nongnu.org; Fri, 30 Apr 2010 10:02:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56283) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O7qnA-0000Pp-Cx for qemu-devel@nongnu.org; Fri, 30 Apr 2010 10:02:08 -0400 From: Kevin Wolf Date: Fri, 30 Apr 2010 16:00:32 +0200 Message-Id: <1272636040-17374-11-git-send-email-kwolf@redhat.com> In-Reply-To: <1272636040-17374-1-git-send-email-kwolf@redhat.com> References: <1272636040-17374-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 10/18] qcow2: Avoid shadowing variable in alloc_clusters_noref() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@linux.vnet.ibm.com Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Stefan Hajnoczi The i loop iterator is shadowed by the next free cluster index. Both using the variable name 'i' makes the code harder to read. Signed-off-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block/qcow2-refcount.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 2661493..95491d3 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -556,8 +556,8 @@ static int64_t alloc_clusters_noref(BlockDriverState *bs, int64_t size) nb_clusters = size_to_clusters(s, size); retry: for(i = 0; i < nb_clusters; i++) { - int64_t i = s->free_cluster_index++; - if (get_refcount(bs, i) != 0) + int64_t next_cluster_index = s->free_cluster_index++; + if (get_refcount(bs, next_cluster_index) != 0) goto retry; } #ifdef DEBUG_ALLOC2 -- 1.6.6.1