mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
param: make command_fail/command_success WARN_UNUSED_RESULT.
This causes a compiler warning if we don't do something with the result (hopefully return immediately!). We use was_pending() to ignore the result in the case where we complete a command in a callback (thus really do want to ignore the result). This actually fixes one bug: we didn't return after command_fail in json_getroute with a bad seed value. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -96,12 +96,15 @@ struct json_stream *null_response(struct command *cmd);
|
||||
|
||||
/* These returned values are never NULL. */
|
||||
struct command_result *command_success(struct command *cmd,
|
||||
struct json_stream *response);
|
||||
struct json_stream *response)
|
||||
WARN_UNUSED_RESULT;
|
||||
struct command_result *command_failed(struct command *cmd,
|
||||
struct json_stream *result);
|
||||
struct json_stream *result)
|
||||
WARN_UNUSED_RESULT;
|
||||
|
||||
/* Mainly for documentation, that we plan to close this later. */
|
||||
struct command_result *command_still_pending(struct command *cmd);
|
||||
struct command_result *command_still_pending(struct command *cmd)
|
||||
WARN_UNUSED_RESULT;
|
||||
|
||||
/* For low-level JSON stream access: */
|
||||
struct json_stream *json_stream_raw_for_cmd(struct command *cmd);
|
||||
@@ -109,7 +112,8 @@ struct command_result *command_raw_complete(struct command *cmd,
|
||||
struct json_stream *result);
|
||||
|
||||
/* To return if param() fails. */
|
||||
extern struct command_result *command_param_failed(void);
|
||||
extern struct command_result *command_param_failed(void)
|
||||
WARN_UNUSED_RESULT;
|
||||
|
||||
/* Wrapper for pending commands (ignores return) */
|
||||
static inline void was_pending(const struct command_result *res)
|
||||
|
||||
Reference in New Issue
Block a user