core-lightning/common/status_wire.c
Rusty Russell 4ffda340d3 check: make sure all files outside contrib/ include "config.h" first.
And turn "" includes into full-path (which makes it easier to put
config.h first, and finds some cases check-includes.sh missed
previously).

config.h sets _GNU_SOURCE which really needs to be done before any
'#includes': we mainly got away with it with glibc, but other platforms
like Alpine may have stricter requirements.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-12-06 10:05:39 +10:30

35 lines
691 B
C

#include "config.h"
#include <common/status_wire.h>
#include <wire/wire.h>
enum status_failreason fromwire_status_failreason(const u8 **cursor,
size_t *max)
{
u8 r = fromwire_u8(cursor, max);
if (r > STATUS_FAIL_MAX) {
fromwire_fail(cursor, max);
r = STATUS_FAIL_INTERNAL_ERROR;
}
return r;
}
enum log_level fromwire_log_level(const u8 **cursor, size_t *max)
{
u8 l = fromwire_u8(cursor, max);
if (l > LOG_LEVEL_MAX) {
fromwire_fail(cursor, max);
l = LOG_BROKEN;
}
return l;
}
void towire_log_level(u8 **pptr, enum log_level level)
{
towire_u8(pptr, level);
}
void towire_status_failreason(u8 **pptr, enum status_failreason reason)
{
towire_u8(pptr, reason);
}