Use a local boolean flag for unnesting the *_in_permitted_state() function
call.

The one place where this change currently matters is [lib/api.c]:

> @@ -4805,7 +4943,9 @@ nbd_aio_connect_systemd_socket_activatio
>      free (argv_printable);
>    }
>
> -  if (unlikely (!aio_connect_systemd_socket_activation_in_permitted_state 
> (h))) {
> +  bool p;
> +  p = aio_connect_systemd_socket_activation_in_permitted_state (h);
> +  if (unlikely (!p)) {
>      ret = -1;
>      goto out;
>    }

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 generator/C.ml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/generator/C.ml b/generator/C.ml
index cf44424517de..d5ef067fb119 100644
--- a/generator/C.ml
+++ b/generator/C.ml
@@ -599,7 +599,9 @@ let
       let value = match errcode with
         | Some value -> value
         | None -> assert false in
-      pr "  if (unlikely (!%s_in_permitted_state (h))) {\n" name;
+      pr "  bool p;\n";
+      pr "  p = %s_in_permitted_state (h);\n" name;
+      pr "  if (unlikely (!p)) {\n";
       pr "    ret = %s;\n" value;
       pr "    goto out;\n";
       pr "  }\n";

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to