mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-09 09:04:25 +01:00
bolt-gen: small cleanups
we were incorrectly printing the references for a subtype case, plus some errant styling,readability changes
This commit is contained in:
committed by
Rusty Russell
parent
f2819ba7d8
commit
12125ec8dc
@@ -24,18 +24,19 @@ const char *${enum_set['name']}_name(int e)
|
||||
snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e);
|
||||
return invalidbuf;
|
||||
}
|
||||
|
||||
% endfor
|
||||
|
||||
## FIXME: extract out partials for the method declarations
|
||||
## (shared between here and header_template)
|
||||
% for subtype in subtypes:
|
||||
|
||||
/* SUBTYPE: ${subtype.name.upper()} */
|
||||
% for c in subtype.type_comments:
|
||||
/*${c} */
|
||||
% endfor
|
||||
<% static = '' if options.expose_subtypes else 'static ' %>
|
||||
${static}void towire_${subtype.name}(u8 **p, const struct ${subtype.name} *${subtype.name})
|
||||
<%
|
||||
static = '' if options.expose_subtypes else 'static '
|
||||
%>\
|
||||
${static}void towire_${subtype.name}(u8 **p, const ${subtype.type_name()} *${subtype.name})
|
||||
{
|
||||
% for f in subtype.get_len_fields():
|
||||
${f.type_obj.type_name()} ${f.name} = tal_count(${subtype.name}->${f.len_field_of});
|
||||
@@ -62,7 +63,7 @@ ${static}void towire_${subtype.name}(u8 **p, const struct ${subtype.name} *${sub
|
||||
% elif f.len_field_of:
|
||||
towire_${f.type_obj.name}(p, ${f.name});
|
||||
% else:
|
||||
towire_${f.type_obj.name}(&p, ${'' if f.type_obj.is_assignable() else '*'}${fieldname});
|
||||
towire_${f.type_obj.name}(p, ${'' if f.type_obj.is_assignable() else '&'}${fieldname});
|
||||
% endif
|
||||
% endfor
|
||||
}
|
||||
|
||||
@@ -522,7 +522,7 @@ def main(options, args=None, output=sys.stdout, lines=None):
|
||||
elif token_type.startswith('#'):
|
||||
comment_set.append(token_type[1:])
|
||||
else:
|
||||
raise ValueError('Unknown token type {} on line {}:{}'.format(token_type, ln, line))
|
||||
raise ValueError("Unknown token type {} on line {}:{}".format(token_type, ln, line))
|
||||
|
||||
except StopIteration:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user