tests: testQemuCapsIterate: Pass suffix to callback

Right now users need to hardcode the suffix, which is not a big
deal since they're the ones who passed it to testQemuCapsIterate()
in the first place; however, since we're already passing most of
the information to the callback and we're going to add more later
on, it makes sense to be consistent and pass the suffix too.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Andrea Bolognani
2019-10-22 15:44:37 +02:00
parent 51495a4d73
commit 5a45ed9c96
4 changed files with 22 additions and 6 deletions

View File

@@ -936,9 +936,16 @@ testQemuCapsIterate(const char *suffix,
archName[0] = '\0';
archName++;
/* Run the user-provided callback */
if (callback(TEST_QEMU_CAPS_PATH, base, archName, opaque) < 0)
/* Run the user-provided callback.
*
* We skip the dot that, as verified earlier, starts the suffix
* to make it nicer to rebuild the original file name from inside
* the callback.
*/
if (callback(TEST_QEMU_CAPS_PATH, base,
archName, suffix + 1, opaque) < 0) {
goto cleanup;
}
}
if (rc < 0)