[Libguestfs] [libnbd PATCH 4/6] state_machine_generator: wrap nbd_internal_enter_* prototypes

Laszlo Ersek lersek at redhat.com
Wed May 10 11:48:12 UTC 2023


Similarly to commit bfef979aa372 ("generator: wrap "python/methods.h" at
80 characters", 2023-05-02), just break the fixed (and in itself, short)
parameter list to a new line.

Example effect in "lib/states.h":

> -extern int nbd_internal_enter_STATE_NEWSTYLE_OPT_STRUCTURED_REPLY_RECV_REPLY_PAYLOAD (struct nbd_handle *h, bool *blocked);
> +extern int nbd_internal_enter_STATE_NEWSTYLE_OPT_STRUCTURED_REPLY_RECV_REPLY_PAYLOAD (
> +             struct nbd_handle *h, bool *blocked
> +           );

Example effect in "lib/states.c":

> @@ -2566,9 +2626,11 @@ enter_STATE_NEWSTYLE_OPT_STRUCTURED_REPL
>
>  }
>
> -#line 2570 "lib/states.c"
> +#line 2630 "lib/states.c"
>  int
> -nbd_internal_enter_STATE_NEWSTYLE_OPT_STRUCTURED_REPLY_RECV_REPLY_PAYLOAD (struct nbd_handle *h, bool *blocked)
> +nbd_internal_enter_STATE_NEWSTYLE_OPT_STRUCTURED_REPLY_RECV_REPLY_PAYLOAD (
> +  struct nbd_handle *h, bool *blocked
> +)
>  {
>    int r;
>    enum state next_state = STATE_NEWSTYLE_OPT_STRUCTURED_REPLY_RECV_REPLY_PAYLOAD;

Note that some of the modified lines remain longer than 80 characters, but
we'll live with that, as we don't want to change the "state_enum" field.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
 generator/state_machine_generator.ml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/generator/state_machine_generator.ml b/generator/state_machine_generator.ml
index 74a009a33598..8667adeacf7a 100644
--- a/generator/state_machine_generator.ml
+++ b/generator/state_machine_generator.ml
@@ -333,7 +333,9 @@ let
   pr "/* State transitions defined in states.c. */\n";
   List.iter (
     fun { parsed = { state_enum } } ->
-      pr "extern int nbd_internal_enter_%s (struct nbd_handle *h, bool *blocked);\n" state_enum;
+      pr "extern int nbd_internal_enter_%s (\n" state_enum;
+      pr "             struct nbd_handle *h, bool *blocked\n";
+      pr "           );\n"
   ) states
 
 let generate_lib_states_c () =
@@ -366,8 +368,9 @@ let
       let output_loc = "lib/states.c", output_lineno () + 1 in
       pr "%s\n" (line_directive_of_location output_loc);
       pr "int\n";
-      pr "nbd_internal_enter_%s (struct nbd_handle *h, bool *blocked)\n"
-        state_enum;
+      pr "nbd_internal_enter_%s (\n" state_enum;
+      pr "  struct nbd_handle *h, bool *blocked\n";
+      pr ")\n";
       pr "{\n";
       pr "  int r;\n";
       pr "  enum state next_state = %s;\n" state_enum;



More information about the Libguestfs mailing list