From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O34dt-0001ST-DV for qemu-devel@nongnu.org; Sat, 17 Apr 2010 05:48:49 -0400 Received: from [140.186.70.92] (port=59499 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O34dr-0001S8-1J for qemu-devel@nongnu.org; Sat, 17 Apr 2010 05:48:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O34dn-0003Ta-TD for qemu-devel@nongnu.org; Sat, 17 Apr 2010 05:48:46 -0400 Received: from mtagate2.uk.ibm.com ([194.196.100.162]:44010) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O34dn-0003TM-LB for qemu-devel@nongnu.org; Sat, 17 Apr 2010 05:48:43 -0400 Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate2.uk.ibm.com (8.13.1/8.13.1) with ESMTP id o3H9mgEb016675 for ; Sat, 17 Apr 2010 09:48:42 GMT Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o3H9mgIh1245268 for ; Sat, 17 Apr 2010 10:48:42 +0100 Received: from d06av04.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o3H9mfxq007224 for ; Sat, 17 Apr 2010 10:48:42 +0100 From: Stefan Hajnoczi Date: Sat, 17 Apr 2010 10:49:07 +0100 Message-Id: <1271497747-4463-2-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1271497747-4463-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1271497747-4463-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 2/2] 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: qemu-devel@nongnu.org Cc: Kevin Wolf , 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 --- 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 47c9978..088d96d 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -554,8 +554,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.7.0