From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdDG4-00007N-DN for qemu-devel@nongnu.org; Fri, 26 Aug 2016 05:17:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bdDG2-0003uT-GH for qemu-devel@nongnu.org; Fri, 26 Aug 2016 05:17:03 -0400 From: Reda Sallahi Date: Fri, 26 Aug 2016 11:16:40 +0200 Message-Id: <20160826091643.15841-5-fullmanet@gmail.com> In-Reply-To: <20160826091643.15841-1-fullmanet@gmail.com> References: <20160826091643.15841-1-fullmanet@gmail.com> Subject: [Qemu-devel] [PATCH v2 4/7] qemu-img: delete not used variable and an unecessary check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Kevin Wolf , Max Reitz , Fam Zheng , Stefan Hajnoczi , Reda Sallahi block_count is not used in img_dd() and the C_SKIP check is unecessary so this patch removes both of them. Signed-off-by: Reda Sallahi Reviewed-by: Stefan Hajnoczi --- qemu-img.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index a4d0556..bd3e80d 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -4066,7 +4066,7 @@ static int img_dd(int argc, char **argv) const char *fmt = NULL; const char *out_filename; int64_t size = 0, out_size = 0; - int64_t block_count = 0, out_pos, in_pos, sparse_count = 0; + int64_t out_pos, in_pos, sparse_count = 0; bool writethrough = false; int flags = 0; int ibsz = 0, obsz = 0, bsz; @@ -4344,8 +4344,7 @@ static int img_dd(int argc, char **argv) } } - if (dd.flags & C_SKIP && (in.offset > INT64_MAX / ibsz || - size < in.offset * ibsz)) { + if (in.offset > INT64_MAX / ibsz || size < in.offset * ibsz) { /* We give a warning if the skip option is bigger than the input * size and create an empty output disk image (i.e. like dd(1)). */ @@ -4357,7 +4356,7 @@ static int img_dd(int argc, char **argv) in.buf = g_new(uint8_t, in.bsz); - for (out_pos = out.offset * obsz; in_pos < size; block_count++) { + for (out_pos = out.offset * obsz; in_pos < size;) { int in_ret, out_ret; bsz = in.bsz; -- 2.9.3