mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
generator: daemon: Get rid of useless done_no_free label.
The generated code had:
...
done_no_free:
return;
}
There was no possible code between the label and the return statement,
so both the label and the return statement are redundant. The
instances of ‘goto done_no_free’ can simply be replaced by ‘return’.
The only small complication is that there is a label just before this
which contains some optional code. So we might have ended up with
generated code looking like:
done:
// if there was no optional code, this would be empty
}
which provokes a parse error in C. Therefore I had to add a semicolon
after the ‘done:’ label. This will be removed in a subsequent commit,
so it's just to make the current commit bisectable.
This commit is contained in:
@@ -284,7 +284,7 @@ let generate_daemon_stubs actions () =
|
||||
if is_filein then
|
||||
pr " cancel_receive ();\n";
|
||||
pr " reply_with_unavailable_feature (\"%s\");\n" group;
|
||||
pr " goto done_no_free;\n";
|
||||
pr " return;\n";
|
||||
pr " }\n";
|
||||
pr "\n"
|
||||
| None -> ()
|
||||
@@ -302,14 +302,14 @@ let generate_daemon_stubs actions () =
|
||||
if is_filein then
|
||||
pr " cancel_receive ();\n";
|
||||
pr " reply_with_error (\"unknown option in optional arguments bitmask (this can happen if a program is compiled against a newer version of libguestfs, then run against an older version of the daemon)\");\n";
|
||||
pr " goto done_no_free;\n";
|
||||
pr " return;\n";
|
||||
pr " }\n";
|
||||
) else (
|
||||
pr " if (optargs_bitmask != 0) {\n";
|
||||
if is_filein then
|
||||
pr " cancel_receive ();\n";
|
||||
pr " reply_with_error (\"header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments\");\n";
|
||||
pr " goto done_no_free;\n";
|
||||
pr " return;\n";
|
||||
pr " }\n";
|
||||
);
|
||||
pr "\n";
|
||||
@@ -499,15 +499,13 @@ let generate_daemon_stubs actions () =
|
||||
);
|
||||
|
||||
(* Free the args. *)
|
||||
pr "done:\n";
|
||||
pr "done: ;\n";
|
||||
(match args_passed_to_daemon with
|
||||
| [] -> ()
|
||||
| _ ->
|
||||
pr " xdr_free ((xdrproc_t) xdr_guestfs_%s_args, (char *) &args);\n"
|
||||
name
|
||||
);
|
||||
pr "done_no_free:\n";
|
||||
pr " return;\n";
|
||||
pr "}\n\n";
|
||||
) (actions |> daemon_functions |> sort)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user