mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
generate-wire.py: add memcheck() to towire functions.
Sanity check that we're not streaming uninitialized bytes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -251,8 +251,9 @@ class Message(object):
|
|||||||
print('\ttowire_{}(&p, {});'
|
print('\ttowire_{}(&p, {});'
|
||||||
.format(basetype, f.name))
|
.format(basetype, f.name))
|
||||||
|
|
||||||
|
# Make sure we haven't encoded any uninitialzied fields!
|
||||||
print('\n'
|
print('\n'
|
||||||
'\treturn p;\n'
|
'\treturn memcheck(p, tal_count(p));\n'
|
||||||
'}\n')
|
'}\n')
|
||||||
|
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
@@ -274,6 +275,7 @@ if options.output_header:
|
|||||||
''.format(idem))
|
''.format(idem))
|
||||||
else:
|
else:
|
||||||
print('#include <{}>\n'
|
print('#include <{}>\n'
|
||||||
|
'#include <ccan/mem/mem.h>\n'
|
||||||
''.format(args[0]))
|
''.format(args[0]))
|
||||||
|
|
||||||
# Maps message names to messages
|
# Maps message names to messages
|
||||||
|
|||||||
Reference in New Issue
Block a user