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/oldstyle.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/oldstyle.c b/tests/oldstyle.c index 46fd2a64fcb8..e67c428e63e2 100644 --- a/tests/oldstyle.c +++ b/tests/oldstyle.c @@ -84,6 +84,8 @@ main (int argc, char *argv[]) char *args[] = { "nbdkit", "-s", "-o", "--exit-with-parent", "-v", "memory", "size=" STR (SIZE), NULL }; int calls = 0; + nbd_chunk_callback chunk_callback = { .callback = pread_cb, + .user_data = &calls }; const char *s; progname = argv[0]; @@ -174,8 +176,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); } @@ -191,8 +192,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