mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 09:04:22 +01:00
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:
@@ -868,8 +868,7 @@ static struct command_result *getroute_error(struct command *cmd,
|
||||
/* Deep copy of excludes array. */
|
||||
static const char **dup_excludes(const tal_t *ctx, const char **excludes)
|
||||
{
|
||||
const char **ret = tal_dup_arr(ctx, const char *,
|
||||
excludes, tal_count(excludes), 0);
|
||||
const char **ret = tal_dup_talarr(ctx, const char *, excludes);
|
||||
for (size_t i = 0; i < tal_count(ret); i++)
|
||||
ret[i] = tal_strdup(ret, excludes[i]);
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user