Break the flags guard condition, if any, to a new line.

One of the most impactful changes of this patch is [lib/api.c]:

> @@ -4218,7 +4224,8 @@ nbd_zero (struct nbd_handle *h, uint64_t
>      ret = -1;
>      goto out;
>    }
> -  if (unlikely ((flags & ~0x13) != 0) && ((h->strict & LIBNBD_STRICT_FLAGS) 
> || flags > UINT16_MAX)) {
> +  if (unlikely ((flags & ~0x13) != 0) &&
> +      ((h->strict & LIBNBD_STRICT_FLAGS) || flags > UINT16_MAX)) {
>      set_error (EINVAL, "%s: invalid value for flag: 0x%x",
>                 "flags", flags);
>      ret = -1;

Note that this patch is not really future-proof; if we add another

  guard = Some "...";

to "generator/API.ml", that string can still exceed 80 characters.

For now, the current patch should suffice.

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

diff --git a/generator/C.ml b/generator/C.ml
index cff8f854f1d1..cf44424517de 100644
--- a/generator/C.ml
+++ b/generator/C.ml
@@ -622,7 +622,7 @@ let
            sprintf "0x%x" !v
         | None -> "LIBNBD_" ^ flag_prefix ^ "_MASK" in
       let guard = match guard with
-        | Some value -> " && " ^ value
+        | Some value -> " &&\n      " ^ value
         | None -> "" in
       pr "  if (unlikely ((%s & ~%s) != 0)%s) {\n" n mask guard;
       pr "    set_error (EINVAL, \"%%s: invalid value for flag: 0x%%x\",\n";

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

Reply via email to