param: add ok flag to struct command

Callers to param() can now optionally set a flag to see if command_fail was
called.

This is necessary because the `cmd` is freed in case of failure.

I spent a bit of time trying to extend the lifetime of the `cmd` to the end
of parse_request(), but the destructors still needed to be called when they
were, and it was getting ugly.  So I took this minimal approach.

Signed-off-by: Mark Beckwith <wythe@intrig.com>
This commit is contained in:
Mark Beckwith
2018-09-15 12:12:15 -05:00
committed by Christian Decker
parent 30b67c0334
commit 1a4f355a7b
2 changed files with 7 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ struct command {
enum command_mode mode;
/* This is created if mode is CMD_USAGE */
const char *usage;
bool *ok;
};
struct json_connection {