mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 14:54:26 +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:
@@ -77,8 +77,7 @@ static void destroy_peer(struct peer *peer)
|
||||
static void peer_update_features(struct peer *peer, const u8 *features TAKES)
|
||||
{
|
||||
tal_free(peer->features);
|
||||
peer->features = tal_dup_arr(peer, u8,
|
||||
features, tal_count(features), 0);
|
||||
peer->features = tal_dup_talarr(peer, u8, features);
|
||||
}
|
||||
|
||||
struct peer *new_peer(struct lightningd *ld, u64 dbid,
|
||||
@@ -386,9 +385,7 @@ void channel_errmsg(struct channel *channel,
|
||||
|
||||
/* Do we have an error to send? */
|
||||
if (err_for_them && !channel->error)
|
||||
channel->error = tal_dup_arr(channel, u8,
|
||||
err_for_them,
|
||||
tal_count(err_for_them), 0);
|
||||
channel->error = tal_dup_talarr(channel, u8, err_for_them);
|
||||
|
||||
/* Other implementations chose to ignore errors early on. Not
|
||||
* surprisingly, they now spew out spurious errors frequently,
|
||||
|
||||
Reference in New Issue
Block a user