Skip to content

Commit

Permalink
tools/gen: Always return bool!
Browse files Browse the repository at this point in the history
  • Loading branch information
adi2011 authored and niftynei committed Jul 14, 2022
1 parent 1a1be6a commit 286d6c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/test/run-lease_rates.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bool fromwire_bool(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
{ fprintf(stderr, "fromwire_fail called!\n"); abort(); }
/* Generated stub for fromwire_lease_rates */
void fromwire_lease_rates(const u8 **cursor UNNEEDED, size_t *plen UNNEEDED, struct lease_rates *lease_rates UNNEEDED)
bool fromwire_lease_rates(const u8 **cursor UNNEEDED, size_t *plen UNNEEDED, struct lease_rates *lease_rates UNNEEDED)
{ fprintf(stderr, "fromwire_lease_rates called!\n"); abort(); }
/* Generated stub for fromwire_secp256k1_ecdsa_signature */
void fromwire_secp256k1_ecdsa_signature(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
Expand Down
2 changes: 1 addition & 1 deletion tools/gen/header_template
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void towire_${subtype.name}(u8 **p, const ${subtype.type_name()} *${subtype.name
% if subtype.is_varsize():
${subtype.type_name()} *fromwire_${subtype.name}(const tal_t *ctx, const u8 **cursor, size_t *plen);
% else:
void fromwire_${subtype.name}(const u8 **cursor, size_t *plen, ${subtype.type_name()} *${subtype.name});
bool fromwire_${subtype.name}(const u8 **cursor, size_t *plen, ${subtype.type_name()} *${subtype.name});
% endif

% endfor
Expand Down
5 changes: 4 additions & 1 deletion tools/gen/impl_template
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ ${static}void towire_${subtype.name}(u8 **p, const ${subtype.type_name()} *${sub
${static}${subtype.type_name()} *
fromwire_${subtype.name}(const tal_t *ctx, const u8 **cursor, size_t *plen)
% else:
${static}void fromwire_${subtype.name}(${'const tal_t *ctx, ' if subtype.needs_context() else ''}const u8 **cursor, size_t *plen, ${subtype.type_name()} *${subtype.name})
${static}bool fromwire_${subtype.name}(${'const tal_t *ctx, ' if subtype.needs_context() else ''}const u8 **cursor, size_t *plen, ${subtype.type_name()} *${subtype.name})
% endif
{
% if subtype.is_varsize():
Expand All @@ -175,6 +175,9 @@ ${static}void fromwire_${subtype.name}(${'const tal_t *ctx, ' if subtype.needs_c
% if subtype.is_varsize():

return ${subtype.name};
% else:

return *cursor != NULL;
% endif
}
% endfor ## END Subtypes
Expand Down

0 comments on commit 286d6c3

Please sign in to comment.