Skip to content

Commit ef366ae

Browse files
committed
amalgamation: include ccan_config.h explicitly, protect from multiple inclusion
With this change, users of the amalgamation only need to provide wally-specific defines in their config.h.
1 parent dc0821d commit ef366ae

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/amalgamation/combined.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
#include "src/secp256k1/src/secp256k1.c"
3434
#include "src/secp256k1/src/precomputed_ecmult_gen.c"
3535
#include "src/secp256k1/src/precomputed_ecmult.c"
36-
#include "src/ccan/ccan/crypto/sha256/sha256.c"
36+
37+
#ifndef _WALLY_CCAN_CONFIG_H_
38+
#include "src/ccan_config.h"
39+
#endif
3740

3841
#include "src/internal.c"
3942
#include "src/address.c"
@@ -66,6 +69,9 @@
6669
#include "src/wif.c"
6770
#include "src/wordlist.c"
6871

72+
/* ccan sources */
73+
#include "src/ccan/ccan/crypto/sha256/sha256.c"
74+
6975
/* Redefine internal names so sha-512 can be included without conflicts */
7076
#define Round Round_512
7177
#define Transform Transform_512

src/ccan_config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
#ifndef _WALLY_CCAN_CONFIG_H_
2+
#define _WALLY_CCAN_CONFIG_H_ 1
3+
14
/* Config directives for ccan */
5+
26
#include <stddef.h>
37

48
#ifdef WORDS_BIGENDIAN
@@ -55,3 +59,5 @@
5559
void wally_clear(void *p, size_t len);
5660

5761
#define CCAN_CLEAR_MEMORY(p, len) wally_clear(p, len)
62+
63+
#endif /*_WALLY_CCAN_CONFIG_H_ */

0 commit comments

Comments
 (0)