The chunk callback struct is created with a duplicate compound
initializer. Introduce just one local variable for the callback struct,
also bringing the width of the source file under 80 characters.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 tests/newstyle-limited.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/newstyle-limited.c b/tests/newstyle-limited.c
index b86e3614a859..eccca2a24145 100644
--- a/tests/newstyle-limited.c
+++ b/tests/newstyle-limited.c
@@ -113,6 +113,8 @@ main (int argc, char *argv[])
                    "can_write=exit 0",
                    NULL };
   int calls = 0;
+  nbd_chunk_callback chunk_callback = { .callback = pread_cb,
+                                        .user_data = &calls };
   const char *s;
 
   progname = argv[0];
@@ -323,8 +325,7 @@ main (int argc, char *argv[])
   /* Test again for callback operation. */
   memset (rbuf, 0, sizeof rbuf);
   if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2 * sizeof rbuf,
-                            (nbd_chunk_callback) { .callback = pread_cb, 
.user_data = &calls },
-                            0) == -1) {
+                            chunk_callback, 0) == -1) {
     fprintf (stderr, "%s\n", nbd_get_error ());
     exit (EXIT_FAILURE);
   }
@@ -340,8 +341,7 @@ main (int argc, char *argv[])
 
   /* Also test that callback errors are reflected correctly. */
   if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2 * sizeof rbuf,
-                            (nbd_chunk_callback) { .callback = pread_cb, 
.user_data = &calls },
-                            0) != -1) {
+                            chunk_callback, 0) != -1) {
     fprintf (stderr, "%s: expected failure from callback\n", argv[0]);
     exit (EXIT_FAILURE);
   }

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to