aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2022-09-23 10:48:47 +0100
committerfanquake <fanquake@gmail.com>2022-09-23 10:48:47 +0100
commita63d4cb26a2830b297288aa6acf5b69108353334 (patch)
tree0c1428b8652ee7f616b8fff83a079bc5b98e778d
parent100949af0e2551f22c02a73355f2c64710b68ef1 (diff)
downloadbitcoin-a63d4cb26a2830b297288aa6acf5b69108353334.tar.xz
refactor: use <cstdlib> over stdlib.h
We currently use both. Consolidate on the former.
-rw-r--r--src/consensus/consensus.h2
-rw-r--r--src/crypto/chacha20.h2
-rw-r--r--src/crypto/hkdf_sha256_32.h2
-rw-r--r--src/crypto/hmac_sha256.h2
-rw-r--r--src/crypto/hmac_sha512.h2
-rw-r--r--src/crypto/poly1305.h2
-rw-r--r--src/crypto/ripemd160.h2
-rw-r--r--src/crypto/sha1.h2
-rw-r--r--src/crypto/sha256.h2
-rw-r--r--src/crypto/sha256_sse4.cpp2
-rw-r--r--src/crypto/sha3.h2
-rw-r--r--src/crypto/sha512.h2
-rw-r--r--src/httpserver.cpp2
-rw-r--r--src/ipc/interfaces.cpp2
-rw-r--r--src/ipc/process.cpp2
-rw-r--r--src/memusage.h3
-rw-r--r--src/prevector.h2
-rw-r--r--src/random.cpp2
-rw-r--r--src/script/miniscript.h2
-rw-r--r--src/support/cleanse.h2
-rw-r--r--src/test/blockchain_tests.cpp4
-rw-r--r--src/test/raii_event_tests.cpp2
22 files changed, 23 insertions, 24 deletions
diff --git a/src/consensus/consensus.h b/src/consensus/consensus.h
index b2a31e3ba4..10bdbf31a8 100644
--- a/src/consensus/consensus.h
+++ b/src/consensus/consensus.h
@@ -6,7 +6,7 @@
#ifndef BITCOIN_CONSENSUS_CONSENSUS_H
#define BITCOIN_CONSENSUS_CONSENSUS_H
-#include <stdlib.h>
+#include <cstdlib>
#include <stdint.h>
/** The maximum allowed size for a serialized block, in bytes (only for buffer size limits) */
diff --git a/src/crypto/chacha20.h b/src/crypto/chacha20.h
index 69fbbe9fa5..de16a77878 100644
--- a/src/crypto/chacha20.h
+++ b/src/crypto/chacha20.h
@@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_CHACHA20_H
#define BITCOIN_CRYPTO_CHACHA20_H
+#include <cstdlib>
#include <stdint.h>
-#include <stdlib.h>
/** A class for ChaCha20 256-bit stream cipher developed by Daniel J. Bernstein
https://cr.yp.to/chacha/chacha-20080128.pdf */
diff --git a/src/crypto/hkdf_sha256_32.h b/src/crypto/hkdf_sha256_32.h
index fa1e42aec1..878b03a37f 100644
--- a/src/crypto/hkdf_sha256_32.h
+++ b/src/crypto/hkdf_sha256_32.h
@@ -7,8 +7,8 @@
#include <crypto/hmac_sha256.h>
+#include <cstdlib>
#include <stdint.h>
-#include <stdlib.h>
/** A rfc5869 HKDF implementation with HMAC_SHA256 and fixed key output length of 32 bytes (L=32) */
class CHKDF_HMAC_SHA256_L32
diff --git a/src/crypto/hmac_sha256.h b/src/crypto/hmac_sha256.h
index d31fda1dd1..9c25edd7c1 100644
--- a/src/crypto/hmac_sha256.h
+++ b/src/crypto/hmac_sha256.h
@@ -7,8 +7,8 @@
#include <crypto/sha256.h>
+#include <cstdlib>
#include <stdint.h>
-#include <stdlib.h>
/** A hasher class for HMAC-SHA-256. */
class CHMAC_SHA256
diff --git a/src/crypto/hmac_sha512.h b/src/crypto/hmac_sha512.h
index 1ea9a3671e..6acce8992e 100644
--- a/src/crypto/hmac_sha512.h
+++ b/src/crypto/hmac_sha512.h
@@ -7,8 +7,8 @@
#include <crypto/sha512.h>
+#include <cstdlib>
#include <stdint.h>
-#include <stdlib.h>
/** A hasher class for HMAC-SHA-512. */
class CHMAC_SHA512
diff --git a/src/crypto/poly1305.h b/src/crypto/poly1305.h
index 1598b013b9..c80faada7e 100644
--- a/src/crypto/poly1305.h
+++ b/src/crypto/poly1305.h
@@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_POLY1305_H
#define BITCOIN_CRYPTO_POLY1305_H
+#include <cstdlib>
#include <stdint.h>
-#include <stdlib.h>
#define POLY1305_KEYLEN 32
#define POLY1305_TAGLEN 16
diff --git a/src/crypto/ripemd160.h b/src/crypto/ripemd160.h
index 38ea375c1f..f1d89b8407 100644
--- a/src/crypto/ripemd160.h
+++ b/src/crypto/ripemd160.h
@@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_RIPEMD160_H
#define BITCOIN_CRYPTO_RIPEMD160_H
+#include <cstdlib>
#include <stdint.h>
-#include <stdlib.h>
/** A hasher class for RIPEMD-160. */
class CRIPEMD160
diff --git a/src/crypto/sha1.h b/src/crypto/sha1.h
index 8b4568ee12..6ef0187efd 100644
--- a/src/crypto/sha1.h
+++ b/src/crypto/sha1.h
@@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_SHA1_H
#define BITCOIN_CRYPTO_SHA1_H
+#include <cstdlib>
#include <stdint.h>
-#include <stdlib.h>
/** A hasher class for SHA1. */
class CSHA1
diff --git a/src/crypto/sha256.h b/src/crypto/sha256.h
index 028ee14345..24bd1f2e7e 100644
--- a/src/crypto/sha256.h
+++ b/src/crypto/sha256.h
@@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_SHA256_H
#define BITCOIN_CRYPTO_SHA256_H
+#include <cstdlib>
#include <stdint.h>
-#include <stdlib.h>
#include <string>
/** A hasher class for SHA-256. */
diff --git a/src/crypto/sha256_sse4.cpp b/src/crypto/sha256_sse4.cpp
index f1a7fefea3..bc69703607 100644
--- a/src/crypto/sha256_sse4.cpp
+++ b/src/crypto/sha256_sse4.cpp
@@ -5,8 +5,8 @@
// This is a translation to GCC extended asm syntax from YASM code by Intel
// (available at the bottom of this file).
+#include <cstdlib>
#include <stdint.h>
-#include <stdlib.h>
#if defined(__x86_64__) || defined(__amd64__)
diff --git a/src/crypto/sha3.h b/src/crypto/sha3.h
index 88d8c1204d..78608eae76 100644
--- a/src/crypto/sha3.h
+++ b/src/crypto/sha3.h
@@ -7,8 +7,8 @@
#include <span.h>
+#include <cstdlib>
#include <stdint.h>
-#include <stdlib.h>
//! The Keccak-f[1600] transform.
void KeccakF(uint64_t (&st)[25]);
diff --git a/src/crypto/sha512.h b/src/crypto/sha512.h
index 21ca930c75..7356dff6d9 100644
--- a/src/crypto/sha512.h
+++ b/src/crypto/sha512.h
@@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_SHA512_H
#define BITCOIN_CRYPTO_SHA512_H
+#include <cstdlib>
#include <stdint.h>
-#include <stdlib.h>
/** A hasher class for SHA-512. */
class CSHA512
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index 19caefe400..41e048a877 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -22,10 +22,10 @@
#include <util/translation.h>
#include <cstdio>
+#include <cstdlib>
#include <deque>
#include <memory>
#include <optional>
-#include <stdlib.h>
#include <string>
#include <sys/types.h>
diff --git a/src/ipc/interfaces.cpp b/src/ipc/interfaces.cpp
index f4115db982..ee0d4123ce 100644
--- a/src/ipc/interfaces.cpp
+++ b/src/ipc/interfaces.cpp
@@ -13,10 +13,10 @@
#include <util/system.h>
#include <cstdio>
+#include <cstdlib>
#include <functional>
#include <memory>
#include <stdexcept>
-#include <stdlib.h>
#include <string.h>
#include <string>
#include <unistd.h>
diff --git a/src/ipc/process.cpp b/src/ipc/process.cpp
index 9036b80c45..9474ad2c4a 100644
--- a/src/ipc/process.cpp
+++ b/src/ipc/process.cpp
@@ -10,10 +10,10 @@
#include <util/strencodings.h>
#include <cstdint>
+#include <cstdlib>
#include <exception>
#include <iostream>
#include <stdexcept>
-#include <stdlib.h>
#include <string.h>
#include <system_error>
#include <unistd.h>
diff --git a/src/memusage.h b/src/memusage.h
index a6e894129a..fd85a7956c 100644
--- a/src/memusage.h
+++ b/src/memusage.h
@@ -8,9 +8,8 @@
#include <indirectmap.h>
#include <prevector.h>
-#include <stdlib.h>
-
#include <cassert>
+#include <cstdlib>
#include <map>
#include <memory>
#include <set>
diff --git a/src/prevector.h b/src/prevector.h
index a52510930a..7df5a067a2 100644
--- a/src/prevector.h
+++ b/src/prevector.h
@@ -6,7 +6,7 @@
#define BITCOIN_PREVECTOR_H
#include <assert.h>
-#include <stdlib.h>
+#include <cstdlib>
#include <stdint.h>
#include <string.h>
diff --git a/src/random.cpp b/src/random.cpp
index f92e679a00..eab54630b1 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -21,7 +21,7 @@
#include <util/time.h> // for GetTimeMicros()
#include <cmath>
-#include <stdlib.h>
+#include <cstdlib>
#include <thread>
#ifndef WIN32
diff --git a/src/script/miniscript.h b/src/script/miniscript.h
index c4f41e0adf..6faf2624fd 100644
--- a/src/script/miniscript.h
+++ b/src/script/miniscript.h
@@ -13,8 +13,8 @@
#include <string>
#include <vector>
-#include <stdlib.h>
#include <assert.h>
+#include <cstdlib>
#include <policy/policy.h>
#include <primitives/transaction.h>
diff --git a/src/support/cleanse.h b/src/support/cleanse.h
index 8c1210a114..b1227770c7 100644
--- a/src/support/cleanse.h
+++ b/src/support/cleanse.h
@@ -6,7 +6,7 @@
#ifndef BITCOIN_SUPPORT_CLEANSE_H
#define BITCOIN_SUPPORT_CLEANSE_H
-#include <stdlib.h>
+#include <cstdlib>
/** Secure overwrite a buffer (possibly containing secret data) with zero-bytes. The write
* operation will not be optimized out by the compiler. */
diff --git a/src/test/blockchain_tests.cpp b/src/test/blockchain_tests.cpp
index c8e8cdeeb3..0157e25071 100644
--- a/src/test/blockchain_tests.cpp
+++ b/src/test/blockchain_tests.cpp
@@ -4,13 +4,13 @@
#include <boost/test/unit_test.hpp>
-#include <stdlib.h>
-
#include <chain.h>
#include <rpc/blockchain.h>
#include <test/util/setup_common.h>
#include <util/string.h>
+#include <cstdlib>
+
/* Equality between doubles is imprecise. Comparison should be done
* with a small threshold of tolerance, rather than exact equality.
*/
diff --git a/src/test/raii_event_tests.cpp b/src/test/raii_event_tests.cpp
index c489ac04e9..d4487cd941 100644
--- a/src/test/raii_event_tests.cpp
+++ b/src/test/raii_event_tests.cpp
@@ -4,8 +4,8 @@
#include <event2/event.h>
+#include <cstdlib>
#include <map>
-#include <stdlib.h>
#include <support/events.h>