[Libguestfs] [nbdkit PATCH 3/3] vddk: Eliminate one needless goto

Martin Kletzander mkletzan at redhat.com
Mon Apr 29 20:11:43 UTC 2019


It just reads a bit better when the goto does not jump between blocks of code
with different scope (rather then just being used for retries or clean-ups).

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 plugins/vddk/vddk.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index cda670325b85..528a5896aad6 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -853,12 +853,10 @@ vddk_extents (void *handle, uint32_t count, uint64_t offset, uint32_t flags,
       /* The query returns allocated blocks.  We must insert holes
        * between the blocks as necessary.
        */
-      if (position < blk_offset &&
-          add_extent (extents, &position, blk_offset, true) == -1)
-        goto error_in_add;
-      if (add_extent (extents,
-                      &position, blk_offset + blk_length, false) == -1) {
-      error_in_add:
+      if ((position < blk_offset &&
+           add_extent (extents, &position, blk_offset, true) == -1) ||
+          (add_extent (extents,
+                       &position, blk_offset + blk_length, false) == -1)) {
         DEBUG_CALL ("VixDiskLib_FreeBlockList", "block_list");
         VixDiskLib_FreeBlockList (block_list);
         return -1;
-- 
2.21.0




More information about the Libguestfs mailing list