Skip to content

Commit a63d4cb

Browse files
committed
refactor: use <cstdlib> over stdlib.h
We currently use both. Consolidate on the former.
1 parent 100949a commit a63d4cb

22 files changed

+23
-24
lines changed

src/consensus/consensus.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#ifndef BITCOIN_CONSENSUS_CONSENSUS_H
77
#define BITCOIN_CONSENSUS_CONSENSUS_H
88

9-
#include <stdlib.h>
9+
#include <cstdlib>
1010
#include <stdint.h>
1111

1212
/** The maximum allowed size for a serialized block, in bytes (only for buffer size limits) */

src/crypto/chacha20.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#ifndef BITCOIN_CRYPTO_CHACHA20_H
66
#define BITCOIN_CRYPTO_CHACHA20_H
77

8+
#include <cstdlib>
89
#include <stdint.h>
9-
#include <stdlib.h>
1010

1111
/** A class for ChaCha20 256-bit stream cipher developed by Daniel J. Bernstein
1212
https://cr.yp.to/chacha/chacha-20080128.pdf */

src/crypto/hkdf_sha256_32.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
#include <crypto/hmac_sha256.h>
99

10+
#include <cstdlib>
1011
#include <stdint.h>
11-
#include <stdlib.h>
1212

1313
/** A rfc5869 HKDF implementation with HMAC_SHA256 and fixed key output length of 32 bytes (L=32) */
1414
class CHKDF_HMAC_SHA256_L32

src/crypto/hmac_sha256.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
#include <crypto/sha256.h>
99

10+
#include <cstdlib>
1011
#include <stdint.h>
11-
#include <stdlib.h>
1212

1313
/** A hasher class for HMAC-SHA-256. */
1414
class CHMAC_SHA256

src/crypto/hmac_sha512.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
#include <crypto/sha512.h>
99

10+
#include <cstdlib>
1011
#include <stdint.h>
11-
#include <stdlib.h>
1212

1313
/** A hasher class for HMAC-SHA-512. */
1414
class CHMAC_SHA512

src/crypto/poly1305.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#ifndef BITCOIN_CRYPTO_POLY1305_H
66
#define BITCOIN_CRYPTO_POLY1305_H
77

8+
#include <cstdlib>
89
#include <stdint.h>
9-
#include <stdlib.h>
1010

1111
#define POLY1305_KEYLEN 32
1212
#define POLY1305_TAGLEN 16

src/crypto/ripemd160.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#ifndef BITCOIN_CRYPTO_RIPEMD160_H
66
#define BITCOIN_CRYPTO_RIPEMD160_H
77

8+
#include <cstdlib>
89
#include <stdint.h>
9-
#include <stdlib.h>
1010

1111
/** A hasher class for RIPEMD-160. */
1212
class CRIPEMD160

src/crypto/sha1.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#ifndef BITCOIN_CRYPTO_SHA1_H
66
#define BITCOIN_CRYPTO_SHA1_H
77

8+
#include <cstdlib>
89
#include <stdint.h>
9-
#include <stdlib.h>
1010

1111
/** A hasher class for SHA1. */
1212
class CSHA1

src/crypto/sha256.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#ifndef BITCOIN_CRYPTO_SHA256_H
66
#define BITCOIN_CRYPTO_SHA256_H
77

8+
#include <cstdlib>
89
#include <stdint.h>
9-
#include <stdlib.h>
1010
#include <string>
1111

1212
/** A hasher class for SHA-256. */

src/crypto/sha256_sse4.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// This is a translation to GCC extended asm syntax from YASM code by Intel
66
// (available at the bottom of this file).
77

8+
#include <cstdlib>
89
#include <stdint.h>
9-
#include <stdlib.h>
1010

1111
#if defined(__x86_64__) || defined(__amd64__)
1212

src/crypto/sha3.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
#include <span.h>
99

10+
#include <cstdlib>
1011
#include <stdint.h>
11-
#include <stdlib.h>
1212

1313
//! The Keccak-f[1600] transform.
1414
void KeccakF(uint64_t (&st)[25]);

src/crypto/sha512.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#ifndef BITCOIN_CRYPTO_SHA512_H
66
#define BITCOIN_CRYPTO_SHA512_H
77

8+
#include <cstdlib>
89
#include <stdint.h>
9-
#include <stdlib.h>
1010

1111
/** A hasher class for SHA-512. */
1212
class CSHA512

src/httpserver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
#include <util/translation.h>
2323

2424
#include <cstdio>
25+
#include <cstdlib>
2526
#include <deque>
2627
#include <memory>
2728
#include <optional>
28-
#include <stdlib.h>
2929
#include <string>
3030

3131
#include <sys/types.h>

src/ipc/interfaces.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
#include <util/system.h>
1414

1515
#include <cstdio>
16+
#include <cstdlib>
1617
#include <functional>
1718
#include <memory>
1819
#include <stdexcept>
19-
#include <stdlib.h>
2020
#include <string.h>
2121
#include <string>
2222
#include <unistd.h>

src/ipc/process.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#include <util/strencodings.h>
1111

1212
#include <cstdint>
13+
#include <cstdlib>
1314
#include <exception>
1415
#include <iostream>
1516
#include <stdexcept>
16-
#include <stdlib.h>
1717
#include <string.h>
1818
#include <system_error>
1919
#include <unistd.h>

src/memusage.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
#include <indirectmap.h>
99
#include <prevector.h>
1010

11-
#include <stdlib.h>
12-
1311
#include <cassert>
12+
#include <cstdlib>
1413
#include <map>
1514
#include <memory>
1615
#include <set>

src/prevector.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#define BITCOIN_PREVECTOR_H
77

88
#include <assert.h>
9-
#include <stdlib.h>
9+
#include <cstdlib>
1010
#include <stdint.h>
1111
#include <string.h>
1212

src/random.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <util/time.h> // for GetTimeMicros()
2222

2323
#include <cmath>
24-
#include <stdlib.h>
24+
#include <cstdlib>
2525
#include <thread>
2626

2727
#ifndef WIN32

src/script/miniscript.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#include <string>
1414
#include <vector>
1515

16-
#include <stdlib.h>
1716
#include <assert.h>
17+
#include <cstdlib>
1818

1919
#include <policy/policy.h>
2020
#include <primitives/transaction.h>

src/support/cleanse.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#ifndef BITCOIN_SUPPORT_CLEANSE_H
77
#define BITCOIN_SUPPORT_CLEANSE_H
88

9-
#include <stdlib.h>
9+
#include <cstdlib>
1010

1111
/** Secure overwrite a buffer (possibly containing secret data) with zero-bytes. The write
1212
* operation will not be optimized out by the compiler. */

src/test/blockchain_tests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
#include <boost/test/unit_test.hpp>
66

7-
#include <stdlib.h>
8-
97
#include <chain.h>
108
#include <rpc/blockchain.h>
119
#include <test/util/setup_common.h>
1210
#include <util/string.h>
1311

12+
#include <cstdlib>
13+
1414
/* Equality between doubles is imprecise. Comparison should be done
1515
* with a small threshold of tolerance, rather than exact equality.
1616
*/

src/test/raii_event_tests.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
#include <event2/event.h>
66

7+
#include <cstdlib>
78
#include <map>
8-
#include <stdlib.h>
99

1010
#include <support/events.h>
1111

0 commit comments

Comments
 (0)