Browse Source

gossipd: annotate replace_broadcast that we take() the payload, make it const.

We tal_dup_arr() it, which does take.  Make it const in the structure;
the tal_dup_arr() removes the const, so it compiles without it, but it's
misleading.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
parent
commit
b8285db263
  1. 4
      gossipd/broadcast.c
  2. 4
      gossipd/broadcast.h

4
gossipd/broadcast.c

@ -18,7 +18,7 @@ static void destroy_queued_message(struct queued_message *msg,
static struct queued_message *new_queued_message(const tal_t *ctx,
struct broadcast_state *bstate,
const u8 *payload,
const u8 *payload TAKES,
u64 index)
{
struct queued_message *msg = tal(ctx, struct queued_message);
@ -32,7 +32,7 @@ static struct queued_message *new_queued_message(const tal_t *ctx,
bool replace_broadcast(const tal_t *ctx,
struct broadcast_state *bstate,
u64 *index,
const u8 *payload)
const u8 *payload TAKES)
{
struct queued_message *msg;
bool evicted = false;

4
gossipd/broadcast.h

@ -14,7 +14,7 @@ struct queued_message {
u64 index;
/* Serialized payload */
u8 *payload;
const u8 *payload;
};
struct broadcast_state {
@ -31,7 +31,7 @@ struct broadcast_state *new_broadcast_state(tal_t *ctx);
bool replace_broadcast(const tal_t *ctx,
struct broadcast_state *bstate,
u64 *index,
const u8 *payload);
const u8 *payload TAKES);
struct queued_message *next_broadcast_message(struct broadcast_state *bstate, u64 last_index);

Loading…
Cancel
Save