mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
generate-wire.py: allow NULL len parameter from fromwire_*
It implies tal_count() gives the length. Great for almost all callers which don't care if there are extra bytes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -169,7 +169,12 @@ class Message(object):
|
||||
print('\t{} {};'.format(f.typename, f.name));
|
||||
|
||||
print('\tconst u8 *cursor = p;\n'
|
||||
'\tsize_t tmp_len;\n'
|
||||
'\n'
|
||||
'\tif (!plen) {{\n'
|
||||
'\t\ttmp_len = tal_count(p);\n'
|
||||
'\t\tplen = &tmp_len;\n'
|
||||
'\t}}\n'
|
||||
'\tif (fromwire_u16(&cursor, plen) != {})\n'
|
||||
'\t\treturn false;'
|
||||
.format(self.enum.name))
|
||||
|
||||
Reference in New Issue
Block a user