| 274 | } |
| 275 | |
| 276 | static struct command_result *param_arr(struct command *cmd, const char *buffer, |
| 277 | const jsmntok_t tokens[], |
| 278 | struct param *params, |
| 279 | bool allow_extra) |
| 280 | { |
| 281 | #if DEVELOPER |
| 282 | if (!check_params(params)) { |
| 283 | return command_fail(cmd, PARAM_DEV_ERROR, |
| 284 | "developer error: check_params"); |
| 285 | } |
| 286 | #endif |
| 287 | if (tokens->type == JSMN_ARRAY) |
| 288 | return parse_by_position(cmd, params, buffer, tokens, allow_extra); |
| 289 | else if (tokens->type == JSMN_OBJECT) |
| 290 | return parse_by_name(cmd, params, buffer, tokens, allow_extra); |
| 291 | |
| 292 | return command_fail(cmd, JSONRPC2_INVALID_PARAMS, |
| 293 | "Expected array or object for params"); |
| 294 | } |
| 295 | |
| 296 | const char *param_subcommand(struct command *cmd, const char *buffer, |
| 297 | const jsmntok_t tokens[], |