common: tal_dup_talarr() helper.

This is a common thing to do, so create a macro.

Unfortunately, it still needs the type arg, because the paramter may
be const, and the return cannot be, and C doesn't have a general
"(-const)" cast.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2020-02-27 12:47:01 +10:30
parent 684ed4231f
commit 2aad3ffcf8
21 changed files with 54 additions and 49 deletions

View File

@@ -214,8 +214,7 @@ static bool check_params(struct param *params)
return false;
/* duplicate so we can sort */
struct param *copy = tal_dup_arr(params, struct param,
params, tal_count(params), 0);
struct param *copy = tal_dup_talarr(params, struct param, params);
/* check for repeated names and args */
if (!check_unique(copy, comp_by_name))