* Verify consistent internal state. */
| 234 | * Verify consistent internal state. |
| 235 | */ |
| 236 | static bool check_params(struct param *params) |
| 237 | { |
| 238 | if (tal_count(params) < 2) |
| 239 | return true; |
| 240 | |
| 241 | /* make sure there are no required params following optional */ |
| 242 | if (!check_distinct(params, comp_req_order)) |
| 243 | return false; |
| 244 | |
| 245 | /* duplicate so we can sort */ |
| 246 | struct param *copy = tal_dup_talarr(params, struct param, params); |
| 247 | |
| 248 | /* check for repeated names and args */ |
| 249 | if (!check_unique(copy, comp_by_name)) |
| 250 | return false; |
| 251 | if (!check_unique(copy, comp_by_arg)) |
| 252 | return false; |
| 253 | |
| 254 | tal_free(copy); |
| 255 | return true; |
| 256 | } |
| 257 | #endif |
| 258 | |
| 259 | static char *param_usage(const tal_t *ctx, |
no test coverage detected