[libvirt] [PATCH] createRawFileOpHook: avoid dead stores

Here are two more dead stores.
From 7c3d498d8572556d72d4633e9b39f89a08a0a682 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Wed, 7 Apr 2010 18:30:55 +0200 Subject: [PATCH] createRawFileOpHook: avoid dead stores
* src/storage/storage_backend.c (createRawFileOpHook): Remove dead stores and declaration of each stored-to variable. --- src/storage/storage_backend.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 7294a00..f0074ed 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -308,12 +308,11 @@ static int createRawFileOpHook(int fd, void *data) { * update every 9s is a fair-enough trade-off */ unsigned long long bytes = 512 * 1024 * 1024; - int r; if (bytes > remain) bytes = remain; - if ((r = safezero(fd, 0, hdata->vol->allocation - remain, - bytes)) != 0) { + if (safezero(fd, 0, hdata->vol->allocation - remain, + bytes) != 0) { ret = errno; virReportSystemError(errno, _("cannot fill file '%s'"), hdata->vol->target.path); @@ -322,9 +321,7 @@ static int createRawFileOpHook(int fd, void *data) { remain -= bytes; } } else { /* No progress bars to be shown */ - int r; - - if ((r = safezero(fd, 0, 0, remain)) != 0) { + if (safezero(fd, 0, 0, remain) != 0) { ret = errno; virReportSystemError(errno, _("cannot fill file '%s'"), hdata->vol->target.path); -- 1.7.1.rc0.212.gbd88f

On 04/07/2010 12:42 PM, Jim Meyering wrote:
+++ b/src/storage/storage_backend.c @@ -308,12 +308,11 @@ static int createRawFileOpHook(int fd, void *data) { * update every 9s is a fair-enough trade-off */ unsigned long long bytes = 512 * 1024 * 1024; - int r;
if (bytes > remain) bytes = remain; - if ((r = safezero(fd, 0, hdata->vol->allocation - remain, - bytes)) != 0) { + if (safezero(fd, 0, hdata->vol->allocation - remain, + bytes) != 0) { ret = errno; virReportSystemError(errno, _("cannot fill file '%s'"), hdata->vol->target.path);
ACK - the fact that it still compiles is proof of the dead store, so the removal is safe. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Jim Meyering