[libvirt] [PATCH] createRawFileOpHook: avoid dead stores

Jim Meyering jim at meyering.net
Wed Apr 7 18:42:10 UTC 2010


Here are two more dead stores.

>From 7c3d498d8572556d72d4633e9b39f89a08a0a682 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at 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




More information about the libvir-list mailing list