libqtest: Rework qtest_rsp()
commitf8a9b4c66569cbc1640722369a91c635102b5264
authorMarkus Armbruster <armbru@redhat.com>
Tue, 26 Jan 2021 15:16:49 +0000 (26 16:16 +0100)
committerThomas Huth <thuth@redhat.com>
Wed, 27 Jan 2021 06:18:13 +0000 (27 07:18 +0100)
treeed32b36335d728e08b27d8510e8ef30871d15d58
parentcf5891ec534e5418cf613cf9634160f911dadc50
libqtest: Rework qtest_rsp()

qtest_rsp() is used in two different ways: (1) return some arguments
to caller, which the caller must free, and (2) return no arguments to
caller.  Passing non-zero @expected_args gets you (1), and passing
zero gets you (2).

Having "the return value must be freed" depend on an argument this way
is less than ideal.

Provide separate functions for the two ways: (1) qtest_rsp_args()
takes @expected_args (possibly zero), and returns that number of
arguments.  Caller must free the return value always.  (2) qtest_rsp()
assumes zero, and returns nothing.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210126151649.2220902-1-armbru@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/qtest/libqtest.c