Remove tal_len, use tal_count() or tal_bytelen().

tal_count() is used where there's a type, even if it's char or u8, and
tal_bytelen() is going to replace tal_len() for clarity: it's only needed
where a pointer is void.

We shim tal_bytelen() for now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-07-28 15:30:16 +09:30
committed by Christian Decker
parent eae9b81099
commit 5cf34d6618
57 changed files with 200 additions and 195 deletions

View File

@@ -865,7 +865,7 @@ static struct io_plan *handle_returning_peer(struct io_conn *conn,
recv_gossip, NULL);
/* If they told us to send a message, queue it now */
if (tal_len(rpeer->inner_msg))
if (tal_count(rpeer->inner_msg))
msg_enqueue(&peer->local->peer_out, take(rpeer->inner_msg));
/* FIXME: rpeer destructor should close peer_fd, gossip_fd */
@@ -1794,9 +1794,9 @@ static void append_peer_features(const struct peer_features ***pf,
new = tal(*pf, struct peer_features);
new->global_features = tal_dup_arr(new, u8, gfeatures,
tal_len(gfeatures), 0);
tal_count(gfeatures), 0);
new->local_features = tal_dup_arr(new, u8, lfeatures,
tal_len(lfeatures), 0);
tal_count(lfeatures), 0);
tal_resize(pf, num_nodes + 1);
(*pf)[num_nodes] = new;
}

View File

@@ -161,13 +161,13 @@ static void negotiate_auth(struct rbuf *rbuf, const char *tor_password)
cookiefileerrno = errno;
continue;
}
assert(tal_len(contents) != 0);
assert(tal_count(contents) != 0);
discard_remaining_response(rbuf);
tor_send_cmd(rbuf,
tal_fmt(tmpctx, "AUTHENTICATE %s",
tal_hexstr(tmpctx,
contents,
tal_len(contents)-1)));
tal_count(contents)-1)));
discard_remaining_response(rbuf);
return;
}
@@ -222,7 +222,7 @@ struct wireaddr *tor_autoservice(const tal_t *ctx,
err(1, "Connecting stream socket to Tor service");
buffer = tal_arr(tmpctx, char, rbuf_good_size(fd));
rbuf_init(&rbuf, fd, buffer, tal_len(buffer));
rbuf_init(&rbuf, fd, buffer, tal_count(buffer));
negotiate_auth(&rbuf, tor_password);
onion = make_onion(ctx, &rbuf, laddr);