[Libguestfs] [PATCH nbdkit v2 2/6] error: Use new nbdkit_parse_probability

Eric Blake eblake at redhat.com
Wed May 17 21:08:17 UTC 2023


On Wed, May 17, 2023 at 11:06:55AM +0100, Richard W.M. Jones wrote:
> This replaces the existing ad hoc parsing with the new public function.
> ---
>  filters/error/nbdkit-error-filter.pod | 12 +++++++-----
>  filters/error/error.c                 | 14 +-------------
>  2 files changed, 8 insertions(+), 18 deletions(-)
> 

> +  if (nbdkit_parse_probability (key, value, &d) == -1)
>      return -1;
> -  }
>    if (d < 0 || d > 1) {

If you change nbdkit_parse_probability() based on my comments to patch
1 to guarantee a non-negative value in d on success, then then left
half of this conditional would now be dead code.

Otherwise,

Reviewed-by: Eric Blake <eblake at redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


More information about the Libguestfs mailing list