@@ -123,7 +123,8 @@ struct out_req *jsonrpc_request_start_(struct plugin *plugin,
123123 const char * buf ,
124124 const jsmntok_t * result ,
125125 void * arg ),
126- void * arg );
126+ void * arg )
127+ NON_NULL_ARGS (1 , 2 , 3 , 4 , 6 );
127128
128129/* This variant has callbacks received whole obj, not "result" or
129130 * "error" members. */
@@ -202,30 +203,36 @@ struct request_batch *request_batch_new_(const tal_t *ctx,
202203
203204struct out_req * add_to_batch (struct command * cmd ,
204205 struct request_batch * batch ,
205- const char * cmdname );
206+ const char * cmdname )
207+ NON_NULL_ARGS (1 , 2 , 3 );
206208
207209/* We want some commands to live after this command (possibly)
208210 * completes. This creates a new command with the same id but its own
209211 * lifetime: use aux_command_done() or tal_free() when you're done. */
210- struct command * aux_command (const struct command * cmd );
212+ struct command * aux_command (const struct command * cmd )
213+ NON_NULL_ARGS (1 );
211214
212215/* Runs finalcb immediately if batch is empty. */
213216struct command_result * batch_done (struct command * cmd ,
214- struct request_batch * batch );
217+ struct request_batch * batch )
218+ NON_NULL_ARGS (1 , 2 );
215219
216220/* Helper to create a JSONRPC2 response stream with a "result" object. */
217- struct json_stream * jsonrpc_stream_success (struct command * cmd );
221+ struct json_stream * jsonrpc_stream_success (struct command * cmd )
222+ NON_NULL_ARGS (1 );
218223
219224/* Helper to create a JSONRPC2 response stream with an "error" object. */
220225struct json_stream * jsonrpc_stream_fail (struct command * cmd ,
221226 int code ,
222- const char * err );
227+ const char * err )
228+ NON_NULL_ARGS (1 , 3 );
223229
224230/* Helper to create a JSONRPC2 response stream with an "error" object,
225231 * to which will be added a "data" object. */
226232struct json_stream * jsonrpc_stream_fail_data (struct command * cmd ,
227233 int code ,
228- const char * err );
234+ const char * err )
235+ NON_NULL_ARGS (1 , 3 );
229236
230237/* Helper to jsonrpc_request_start() and send_outreq() to update datastore.
231238 * NULL cb means ignore, NULL errcb means plugin_error.
@@ -244,7 +251,8 @@ struct command_result *jsonrpc_set_datastore_(struct plugin *plugin,
244251 const char * buf ,
245252 const jsmntok_t * result ,
246253 void * arg ),
247- void * arg );
254+ void * arg )
255+ NON_NULL_ARGS (1 , 2 , 3 , 4 , 6 );
248256
249257#define jsonrpc_set_datastore_string (plugin , cmd , path , str , mode , cb , errcb , arg ) \
250258 jsonrpc_set_datastore_((plugin), (cmd), (path), (str), true, (mode), \
@@ -286,7 +294,8 @@ struct command_result *jsonrpc_get_datastore_(struct plugin *plugin,
286294 struct command_result * (* binary_cb )(struct command * command ,
287295 const u8 * val ,
288296 void * arg ),
289- void * arg );
297+ void * arg )
298+ NON_NULL_ARGS (1 , 2 , 3 );
290299
291300#define jsonrpc_get_datastore_string (plugin , cmd , path , cb , arg ) \
292301 jsonrpc_get_datastore_((plugin), (cmd), (path), \
@@ -312,11 +321,13 @@ struct command_result *jsonrpc_get_datastore_(struct plugin *plugin,
312321/* This command is finished, here's the response (the content of the
313322 * "result" or "error" field) */
314323WARN_UNUSED_RESULT
315- struct command_result * command_finished (struct command * cmd , struct json_stream * response );
324+ struct command_result * command_finished (struct command * cmd , struct json_stream * response )
325+ NON_NULL_ARGS (1 , 2 );
316326
317327/* Helper for a command that'll be finished in a callback. */
318328WARN_UNUSED_RESULT
319- struct command_result * command_still_pending (struct command * cmd );
329+ struct command_result * command_still_pending (struct command * cmd )
330+ NON_NULL_ARGS (1 );
320331
321332/* Helper to create a zero or single-value JSON object; if @str is NULL,
322333 * object is empty. */
@@ -355,36 +366,43 @@ struct command_result *WARN_UNUSED_RESULT
355366command_done_err (struct command * cmd ,
356367 enum jsonrpc_errcode code ,
357368 const char * errmsg ,
358- const struct json_out * data );
369+ const struct json_out * data )
370+ NON_NULL_ARGS (1 , 3 );
359371
360372/* Send a raw error response. Useful for forwarding a previous
361373 * error after cleanup */
362374struct command_result * command_err_raw (struct command * cmd ,
363- const char * json_str );
375+ const char * json_str )
376+ NON_NULL_ARGS (1 , 2 );
364377
365378/* This command is finished, here's the result object; @cmd cannot be NULL. */
366379struct command_result * WARN_UNUSED_RESULT
367- command_success (struct command * cmd , const struct json_out * result );
380+ command_success (struct command * cmd , const struct json_out * result )
381+ NON_NULL_ARGS (1 , 2 );
368382
369383/* End a hook normally (with "result": "continue") */
370384struct command_result * WARN_UNUSED_RESULT
371- command_hook_success (struct command * cmd );
385+ command_hook_success (struct command * cmd )
386+ NON_NULL_ARGS (1 );
372387
373388/* End a notification handler. */
374389struct command_result * WARN_UNUSED_RESULT
375- notification_handled (struct command * cmd );
390+ notification_handled (struct command * cmd )
391+ NON_NULL_ARGS (1 );
376392
377393/* End a command created with aux_command. */
378394struct command_result * WARN_UNUSED_RESULT
379- aux_command_done (struct command * cmd );
395+ aux_command_done (struct command * cmd )
396+ NON_NULL_ARGS (1 );
380397
381398/**
382399 * What's the deprecation_ok state for this cmd?
383400 * @cmd: the command.
384401 *
385402 * Either the default, or the explicit connection override.
386403 */
387- bool command_deprecated_ok_flag (const struct command * cmd );
404+ bool command_deprecated_ok_flag (const struct command * cmd )
405+ NON_NULL_ARGS (1 );
388406
389407/* Helper for notification handler that will be finished in a callback. */
390408#define notification_handler_pending (cmd ) command_still_pending(cmd)
@@ -422,22 +440,21 @@ struct command_result *send_outreq(struct plugin *plugin,
422440struct command_result * forward_error (struct command * cmd ,
423441 const char * buf ,
424442 const jsmntok_t * error ,
425- void * arg );
443+ void * arg )
444+ NON_NULL_ARGS (1 , 2 , 3 );
426445
427446/* Callback to just forward result and close request; @cmd cannot be NULL */
428447struct command_result * forward_result (struct command * cmd ,
429448 const char * buf ,
430449 const jsmntok_t * result ,
431- void * arg );
450+ void * arg )
451+ NON_NULL_ARGS (1 , 2 , 3 );
432452
433453/* Callback for timer where we expect a 'command_result'. All timers
434454 * must return this eventually, though they may do so via a convoluted
435455 * send_req() path. */
436- struct command_result * timer_complete (struct command * cmd );
437-
438- /* Signals that we've completed a command. Useful for when
439- * there's no `cmd` present. Deprecated! */
440- struct command_result * command_done (void );
456+ struct command_result * timer_complete (struct command * cmd )
457+ NON_NULL_ARGS (1 );
441458
442459/* Access timer infrastructure to add a global timer for the plugin.
443460 *
0 commit comments