We can shave off 17 characters by renaming "next_state" to "next",
and
replacing its initialization with a standalone assignment.
Most impactful effect [lib/states.c]:
int
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;
+ enum state next;
+ next = STATE_NEWSTYLE_OPT_STRUCTURED_REPLY_RECV_REPLY_PAYLOAD;
r = enter_STATE_NEWSTYLE_OPT_STRUCTURED_REPLY_RECV_REPLY_PAYLOAD (
- h, &next_state, blocked
+ h, &next, blocked
);
- if (get_next_state (h) != next_state) {
+ if (get_next_state (h) != next) {
debug (h, "transition: %s -> %s",
"NEWSTYLE.OPT_STRUCTURED_REPLY.RECV_REPLY_PAYLOAD",
- nbd_internal_state_short_string (next_state));
- set_next_state (h, next_state);
+ nbd_internal_state_short_string (next));
+ set_next_state (h, next);
}
return r;
}
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=2172516
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
generator/state_machine_generator.ml | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/generator/state_machine_generator.ml b/generator/state_machine_generator.ml
index af07e4ff3966..274e290952c1 100644
--- a/generator/state_machine_generator.ml
+++ b/generator/state_machine_generator.ml
@@ -373,16 +373,17 @@ let
pr ")\n";
pr "{\n";
pr " int r;\n";
- pr " enum state next_state = %s;\n" state_enum;
+ pr " enum state next;\n";
pr "\n";
+ pr " next = %s;\n" state_enum;
pr " r = enter_%s (\n" state_enum;
- pr " h, &next_state, blocked\n";
+ pr " h, &next, blocked\n";
pr " );\n";
- pr " if (get_next_state (h) != next_state) {\n";
+ pr " if (get_next_state (h) != next) {\n";
pr " debug (h, \"transition: %%s -> %%s\",\n";
pr " \"%s\",\n" display_name;
- pr " nbd_internal_state_short_string (next_state));\n";
- pr " set_next_state (h, next_state);\n";
+ pr " nbd_internal_state_short_string (next));\n";
+ pr " set_next_state (h, next);\n";
pr " }\n";
pr " return r;\n";
pr "}\n";