On Fri, Sep 18, 2026 at 07:29:51PM -0300, Fabiano Rosas wrote:
> Currently the qemu_opts_parse and qemu_opts_parse_noisily functions
> are called in one two ways:
>
> 1) qemu_opts_parse|_noisily(&some_group_list, ...)
> 2) qemu_opts_parse|_noisily(qemu_find_opts("some_opt"), ...)
>
> The second form is problematic. Having the result of qemu_find_opts()
> going directly into the first argument makes it difficult to handle a
> possible NULL pointer retuned by it.
>
> Next patches will change qemu_opts_parse() and
> qemu_opts_parse_noisily() to receive the option name and call
> qemu_find_opts() in their body so the return of the function can be
> handled properly.
>
> Add a new qemu_opts_parse_list() and change all callsites that pass
> the list directly to use it. In the next patches this new _list
> version will become the inner function, but at this point, simply make
> it defer to qemu_opts_parse() to make the refactoring easier.
>
> Signed-off-by: Fabiano Rosas <[email protected]>
> ---
> include/qemu/option.h | 2 +
> tests/unit/test-qemu-opts.c | 169 +++++++++++++++++++-----------------
> util/qemu-option.c | 13 +++
> util/qemu-sockets.c | 2 +-
> 4 files changed, 104 insertions(+), 82 deletions(-)
Reviewed-by: Daniel P. Berrangé <[email protected]>
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|