tools/generate-wire: no more lonely messages!

When we have only a single member in a TLV (e.g. an optional u64),
wrapping it in a struct is awkward.  This changes it to directly
access those fields.

This is not only more elegant (60 fewer lines), it would also be
more cache friendly.  That's right: cache hot singles!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2020-05-06 20:11:54 +09:30
committed by neil saitug
parent 8d4abc1104
commit b0c9059602
14 changed files with 149 additions and 175 deletions

View File

@@ -49,9 +49,8 @@ int main(int argc, char *argv[])
tlvs = NULL;
else if (argc == 6) {
tlvs = tlv_query_channel_range_tlvs_new(ctx);
tlvs->query_option = tal(tlvs, struct tlv_query_channel_range_tlvs_query_option);
tlvs->query_option->query_option_flags
= strtol(argv[5], NULL, 0);
tlvs->query_option = tal(tlvs, varint);
*tlvs->query_option = strtol(argv[5], NULL, 0);
} else
usage();
msg = towire_query_channel_range(ctx, &chainhash,