diff --git a/Makefile b/Makefile index 3bba43075..64a0adea1 100644 --- a/Makefile +++ b/Makefile @@ -252,8 +252,10 @@ check-bolt: check-bolt.o $(CCAN_OBJS) check-bolt.o: $(CCAN_HEADERS) -check-whitespace: - @if grep -n '[ ]$$' Makefile daemon/test/Makefile daemon/Makefile bitcoin/Makefile check-bolt.c $(CORE_SRC) $(BITCOIN_SRC) $(DAEMON_SRC); then echo Extraneous whitespace found >&2; exit 1; fi +check-whitespace/%: % + @if grep -Hn '[ ]$$' $<; then echo Extraneous whitespace found >&2; exit 1; fi + +check-whitespace: check-whitespace/Makefile check-whitespace/check-bolt.c $(CORE_SRC:%=check-whitespace/%) $(CORE_HEADERS:%=check-whitespace/%) check-source: check-makefile check-source-bolt check-whitespace \ $(CORE_SRC:%=check-src-include-order/%) \ diff --git a/bitcoin/Makefile b/bitcoin/Makefile index 9a412d656..951b95728 100644 --- a/bitcoin/Makefile +++ b/bitcoin/Makefile @@ -15,4 +15,6 @@ check: bitcoin-tests check-source-bolt: $(BITCOIN_SRC:%=bolt-check/%) $(BITCOIN_HEADERS:%=bolt-check/%) +check-whitespace: $(BITCOIN_SRC:%=check-whitespace/%) $(BITCOIN_HEADERS:%=check-whitespace/%) check-whitespace/bitcoin/Makefile + bitcoin-tests: $(BITCOIN_TEST_PROGRAMS:%=unittest/%) diff --git a/bitcoin/address.h b/bitcoin/address.h index 38f075445..d7960b564 100644 --- a/bitcoin/address.h +++ b/bitcoin/address.h @@ -7,5 +7,5 @@ /* An address is the RIPEMD160 of the SHA of the public key. */ struct bitcoin_address { struct ripemd160 addr; -}; +}; #endif /* LIGHTNING_BITCOIN_ADDRESS_H */ diff --git a/daemon/Makefile b/daemon/Makefile index d69d82243..3a8198133 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -123,6 +123,8 @@ check-daemon-makefile: check-source-bolt: $(DAEMON_SRC:%=bolt-check/%) $(DAEMON_HEADERS:%=bolt-check/%) +check-whitespace: $(DAEMON_SRC:%=check-whitespace/%) $(DAEMON_HEADERS:%=check-whitespace/%) check-whitespace/daemon/Makefile + # Git submodules are seriously broken. daemon/jsmn/jsmn.h: git submodule update daemon/jsmn/ diff --git a/daemon/options.h b/daemon/options.h index 01759cf17..8654fb6c3 100644 --- a/daemon/options.h +++ b/daemon/options.h @@ -5,7 +5,7 @@ struct lightningd_state; -/* After this, we're in the .lightning dir, config file parsed. +/* After this, we're in the .lightning dir, config file parsed. * If we just created the dir, returns true. */ bool handle_opts(struct lightningd_state *dstate, int argc, char *argv[]); diff --git a/daemon/routing.h b/daemon/routing.h index 938ed4f68..aac61b0d6 100644 --- a/daemon/routing.h +++ b/daemon/routing.h @@ -25,7 +25,7 @@ struct node_connection { /* Minimum number of msatoshi in an HTLC */ u32 htlc_minimum_msat; - + /* The channel ID, as determined by the anchor transaction */ struct channel_id channel_id; diff --git a/wire/Makefile b/wire/Makefile index 4539329c4..8708270ce 100644 --- a/wire/Makefile +++ b/wire/Makefile @@ -28,6 +28,9 @@ wire/gen_wire.o: wire/gen_wire.h check-source: $(WIRE_SRC:%=check-src-include-order/%) $(WIRE_HEADERS:%=check-hdr-include-order/%) check-source-bolt: $(WIRE_SRC:%=bolt-check/%) $(WIRE_HEADERS:%=bolt-check/%) + +check-whitespace: $(WIRE_SRC:%=check-whitespace/%) $(WIRE_HEADERS:%=check-whitespace/%) check-whitespace/wire/Makefile + clean: wire-clean wire-all: wire/gen_wire.o wire/fromwire.o wire/towire.o @@ -35,4 +38,4 @@ wire-all: wire/gen_wire.o wire/fromwire.o wire/towire.o wire-clean: $(RM) $(WIRE_OBJS) $(WIRE_GEN_SRC) $(WIRE_GEN_HEADERS) towire.c fromwire.c -include wire/test/Makefile +include wire/test/Makefile diff --git a/wire/fromwire.c b/wire/fromwire.c index 3a44a4be4..dbd58103c 100644 --- a/wire/fromwire.c +++ b/wire/fromwire.c @@ -46,7 +46,7 @@ u16 fromwire_u16(const u8 **cursor, size_t *max) return 0; return be16_to_cpu(ret); } - + u32 fromwire_u32(const u8 **cursor, size_t *max) { be32 ret; @@ -102,7 +102,7 @@ void fromwire_channel_id(const u8 **cursor, size_t *max, fromwire(cursor, max, &outnum, 1); channel_id->outnum = outnum; } - + void fromwire_sha256(const u8 **cursor, size_t *max, struct sha256 *sha256) { fromwire(cursor, max, sha256, sizeof(*sha256)); @@ -122,7 +122,7 @@ void fromwire_pad_array(const u8 **cursor, size_t *max, u8 *arr, size_t num) { fromwire(cursor, max, arr, num); } - + void fromwire_signature_array(const u8 **cursor, size_t *max, struct signature *arr, size_t num) { diff --git a/wire/towire.c b/wire/towire.c index abad65de2..47a21c2e8 100644 --- a/wire/towire.c +++ b/wire/towire.c @@ -59,7 +59,7 @@ void towire_channel_id(u8 **pptr, const struct channel_id *channel_id) { be32 txnum = cpu_to_be32(channel_id->txnum); u8 outnum = channel_id->outnum; - + towire_u32(pptr, channel_id->blocknum); towire(pptr, (char *)&txnum + 1, 3); towire(pptr, &outnum, 1); @@ -88,7 +88,7 @@ void towire_pad_array(u8 **pptr, const u8 *arr, size_t num) tal_resize(pptr, oldsize + num); memset(*pptr + oldsize, 0, num); } - + void towire_signature_array(u8 **pptr, const struct signature *arr, size_t num) { size_t i;