From 611116d4e31634384e9757befbd5e5a1a80e8cd3 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Sun, 14 Sep 2014 12:43:56 +0200 Subject: [PATCH] header include cleanup - ensures alphabetical ordering for includes etc. in source file headers --- src/Makefile.am | 10 +++++----- src/allocators.h | 1 + src/bitcoin-cli.cpp | 4 ++-- src/bitcoin-tx.cpp | 13 +++++++------ src/chainparamsbase.h | 2 +- src/core_io.h | 2 +- src/core_read.cpp | 11 ++++++----- src/core_write.cpp | 7 ++++--- src/crypto/ripemd160.cpp | 1 + src/crypto/sha1.cpp | 1 + src/crypto/sha2.cpp | 1 + src/db.cpp | 1 + src/db.h | 4 +++- src/hash.h | 2 +- src/init.cpp | 2 +- src/leveldbwrapper.h | 1 + src/net.cpp | 2 +- src/pow.h | 2 +- src/random.cpp | 4 +++- src/rpcclient.cpp | 2 +- src/rpcdump.cpp | 3 ++- src/rpcmining.cpp | 4 ++-- src/rpcnet.cpp | 1 + src/rpcprotocol.cpp | 2 +- src/rpcrawtransaction.cpp | 4 ++-- src/serialize.h | 2 +- src/sync.cpp | 3 ++- src/timedata.h | 4 ++-- src/txdb.cpp | 3 ++- src/txmempool.cpp | 4 ++-- src/uint256.h | 2 +- src/util.h | 2 +- src/utilstrencodings.cpp | 3 ++- src/version.cpp | 1 + src/wallet.h | 2 +- src/walletdb.cpp | 2 +- 36 files changed, 67 insertions(+), 48 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index b2071f49e..94a582dfa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -98,12 +98,11 @@ BITCOIN_CORE_H = \ rpcclient.h \ rpcprotocol.h \ rpcserver.h \ - script/interpreter.h \ script/compressor.h \ + script/interpreter.h \ script/script.h \ script/sign.h \ script/standard.h \ - wallet_ismine.h \ serialize.h \ sync.h \ threadsafety.h \ @@ -118,8 +117,9 @@ BITCOIN_CORE_H = \ utilmoneystr.h \ utiltime.h \ version.h \ - walletdb.h \ wallet.h \ + wallet_ismine.h \ + walletdb.h \ compat/sanity.h JSON_H = \ @@ -173,8 +173,8 @@ libbitcoin_wallet_a_SOURCES = \ crypter.cpp \ rpcdump.cpp \ rpcwallet.cpp \ - wallet_ismine.cpp \ wallet.cpp \ + wallet_ismine.cpp \ walletdb.cpp \ $(BITCOIN_CORE_H) @@ -212,8 +212,8 @@ libbitcoin_common_a_SOURCES = \ keystore.cpp \ netbase.cpp \ protocol.cpp \ - script/interpreter.cpp \ script/compressor.cpp \ + script/interpreter.cpp \ script/script.cpp \ script/sign.cpp \ script/standard.cpp \ diff --git a/src/allocators.h b/src/allocators.h index 0b1c9fea6..65a7d0898 100644 --- a/src/allocators.h +++ b/src/allocators.h @@ -12,6 +12,7 @@ #include #include + #include // for OPENSSL_cleanse() /** diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 871aaf93d..badb376cb 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -3,11 +3,11 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "util.h" +#include "chainparamsbase.h" #include "init.h" #include "rpcclient.h" #include "rpcprotocol.h" -#include "chainparamsbase.h" +#include "util.h" #include "utilstrencodings.h" #include "version.h" diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 91525b51c..2cc4fda9d 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -3,23 +3,24 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "base58.h" -#include "util.h" -#include "utilmoneystr.h" #include "core.h" -#include "main.h" // for MAX_BLOCK_SIZE +#include "core_io.h" #include "keystore.h" +#include "main.h" // for MAX_BLOCK_SIZE #include "script/script.h" #include "script/sign.h" #include "ui_interface.h" // for _(...) #include "univalue/univalue.h" -#include "core_io.h" +#include "util.h" +#include "utilmoneystr.h" #include -#include + #include +#include -using namespace std; using namespace boost::assign; +using namespace std; static bool fCreateBlank; static map registers; diff --git a/src/chainparamsbase.h b/src/chainparamsbase.h index 2d3a07b44..743c8c541 100644 --- a/src/chainparamsbase.h +++ b/src/chainparamsbase.h @@ -5,8 +5,8 @@ #ifndef BITCOIN_CHAIN_PARAMS_BASE_H #define BITCOIN_CHAIN_PARAMS_BASE_H -#include #include +#include /** * CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind) diff --git a/src/core_io.h b/src/core_io.h index adf74cce3..6268a3bf5 100644 --- a/src/core_io.h +++ b/src/core_io.h @@ -8,9 +8,9 @@ #include #include -class uint256; class CScript; class CTransaction; +class uint256; class UniValue; // core_read.cpp diff --git a/src/core_read.cpp b/src/core_read.cpp index efcecb106..11ec72f24 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -3,21 +3,22 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "core_io.h" + #include "core.h" -#include "serialize.h" #include "script/script.h" +#include "serialize.h" +#include "univalue/univalue.h" #include "util.h" -#include #include #include -#include #include -#include "univalue/univalue.h" +#include +#include -using namespace std; using namespace boost; using namespace boost::algorithm; +using namespace std; CScript ParseScript(std::string s) { diff --git a/src/core_write.cpp b/src/core_write.cpp index 62712b1ba..cd64aabf6 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -3,14 +3,15 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "core_io.h" -#include "univalue/univalue.h" + +#include "base58.h" +#include "core.h" #include "script/script.h" #include "script/standard.h" -#include "core.h" #include "serialize.h" +#include "univalue/univalue.h" #include "util.h" #include "utilmoneystr.h" -#include "base58.h" #include diff --git a/src/crypto/ripemd160.cpp b/src/crypto/ripemd160.cpp index 24bd318d4..b5e9f0df4 100644 --- a/src/crypto/ripemd160.cpp +++ b/src/crypto/ripemd160.cpp @@ -5,6 +5,7 @@ #include "crypto/ripemd160.h" #include "crypto/common.h" + #include // Internal implementation code. diff --git a/src/crypto/sha1.cpp b/src/crypto/sha1.cpp index 304401a50..819abab57 100644 --- a/src/crypto/sha1.cpp +++ b/src/crypto/sha1.cpp @@ -5,6 +5,7 @@ #include "crypto/sha1.h" #include "crypto/common.h" + #include // Internal implementation code. diff --git a/src/crypto/sha2.cpp b/src/crypto/sha2.cpp index 99a251cb1..72f191afc 100644 --- a/src/crypto/sha2.cpp +++ b/src/crypto/sha2.cpp @@ -5,6 +5,7 @@ #include "crypto/sha2.h" #include "crypto/common.h" + #include // Internal implementation code. diff --git a/src/db.cpp b/src/db.cpp index 23d2cc988..419b71e30 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -20,6 +20,7 @@ #include #include #include + #include using namespace std; diff --git a/src/db.h b/src/db.h index bba267b84..d1df95054 100644 --- a/src/db.h +++ b/src/db.h @@ -15,12 +15,14 @@ #include #include + #include -struct CBlockLocator; class CDiskBlockIndex; class COutPoint; +struct CBlockLocator; + extern unsigned int nWalletDBUpdated; void ThreadFlushWalletDB(const std::string& strWalletFile); diff --git a/src/hash.h b/src/hash.h index 98a2d1fb1..bdcd4afb4 100644 --- a/src/hash.h +++ b/src/hash.h @@ -6,8 +6,8 @@ #ifndef BITCOIN_HASH_H #define BITCOIN_HASH_H -#include "crypto/sha2.h" #include "crypto/ripemd160.h" +#include "crypto/sha2.h" #include "serialize.h" #include "uint256.h" #include "version.h" diff --git a/src/init.cpp b/src/init.cpp index 6e47536d3..a3f75d61d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -11,6 +11,7 @@ #include "addrman.h" #include "checkpoints.h" +#include "compat/sanity.h" #include "key.h" #include "main.h" #include "miner.h" @@ -32,7 +33,6 @@ #ifndef WIN32 #include #endif -#include "compat/sanity.h" #include #include diff --git a/src/leveldbwrapper.h b/src/leveldbwrapper.h index 452df9283..e2a4f286b 100644 --- a/src/leveldbwrapper.h +++ b/src/leveldbwrapper.h @@ -10,6 +10,7 @@ #include "version.h" #include + #include #include diff --git a/src/net.cpp b/src/net.cpp index b18944a26..891772cf6 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -48,8 +48,8 @@ #endif #endif -using namespace std; using namespace boost; +using namespace std; namespace { const int MAX_OUTBOUND_CONNECTIONS = 8; diff --git a/src/pow.h b/src/pow.h index 2a0d9b24b..5d91108ac 100644 --- a/src/pow.h +++ b/src/pow.h @@ -8,8 +8,8 @@ #include -class CBlockIndex; class CBlockHeader; +class CBlockIndex; class uint256; unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock); diff --git a/src/random.cpp b/src/random.cpp index 22c942acc..fb5258a44 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -12,10 +12,12 @@ #include "util.h" // for LogPrint() #include "utilstrencodings.h" // for GetTime() +#include + #ifndef WIN32 #include #endif -#include + #include #include #include diff --git a/src/rpcclient.cpp b/src/rpcclient.cpp index a0921453c..81797248b 100644 --- a/src/rpcclient.cpp +++ b/src/rpcclient.cpp @@ -3,7 +3,6 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include #include "rpcclient.h" #include "rpcprotocol.h" @@ -11,6 +10,7 @@ #include "ui_interface.h" #include "chainparams.h" // for Params().RPCPort() +#include #include using namespace std; diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index c286626fd..dc73161bf 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -7,8 +7,8 @@ #include "init.h" #include "main.h" #include "sync.h" -#include "utiltime.h" #include "util.h" +#include "utiltime.h" #include "wallet.h" #include @@ -16,6 +16,7 @@ #include #include + #include "json/json_spirit_value.h" using namespace json_spirit; diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index e4a5bc416..4c80a91e1 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -3,14 +3,14 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "rpcserver.h" #include "chainparams.h" +#include "core_io.h" #include "init.h" #include "net.h" #include "main.h" #include "miner.h" #include "pow.h" -#include "core_io.h" +#include "rpcserver.h" #include "util.h" #ifdef ENABLE_WALLET #include "db.h" diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 2baa481c4..4afbe442e 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -13,6 +13,7 @@ #include "util.h" #include + #include "json/json_spirit_value.h" using namespace json_spirit; diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp index 808b9bbd2..c99d113bc 100644 --- a/src/rpcprotocol.cpp +++ b/src/rpcprotocol.cpp @@ -5,8 +5,8 @@ #include "rpcprotocol.h" -#include "util.h" #include "tinyformat.h" +#include "util.h" #include "utilstrencodings.h" #include "utiltime.h" #include "version.h" diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index c5c99870f..3c89be078 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -12,8 +12,8 @@ #include "net.h" #include "rpcserver.h" #include "script/script.h" -#include "script/standard.h" #include "script/sign.h" +#include "script/standard.h" #include "uint256.h" #ifdef ENABLE_WALLET #include "wallet.h" @@ -25,10 +25,10 @@ #include "json/json_spirit_utils.h" #include "json/json_spirit_value.h" -using namespace std; using namespace boost; using namespace boost::assign; using namespace json_spirit; +using namespace std; void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeHex) { diff --git a/src/serialize.h b/src/serialize.h index dba3460d1..57f5fd069 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -10,8 +10,8 @@ #include #include -#include #include +#include #include #include #include diff --git a/src/sync.cpp b/src/sync.cpp index 066c1ca74..d424f7bc9 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -7,9 +7,10 @@ #include "util.h" #include "utilstrencodings.h" +#include + #include #include -#include #ifdef DEBUG_LOCKCONTENTION void PrintLockContention(const char* pszName, const char* pszFile, int nLine) diff --git a/src/timedata.h b/src/timedata.h index 9cc47bec1..155f6872d 100644 --- a/src/timedata.h +++ b/src/timedata.h @@ -5,10 +5,10 @@ #ifndef BITCOIN_TIMEDATA_H #define BITCOIN_TIMEDATA_H -#include -#include #include #include +#include +#include class CNetAddr; diff --git a/src/txdb.cpp b/src/txdb.cpp index d4c600755..79838b611 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -9,9 +9,10 @@ #include "pow.h" #include "uint256.h" -#include #include +#include + using namespace std; void static BatchWriteCoins(CLevelDBBatch &batch, const uint256 &hash, const CCoins &coins) { diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 6bbadc834..50e6fed2a 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -3,8 +3,9 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "core.h" #include "txmempool.h" + +#include "core.h" #include "util.h" #include @@ -644,4 +645,3 @@ bool CCoinsViewMemPool::GetCoins(const uint256 &txid, CCoins &coins) const { bool CCoinsViewMemPool::HaveCoins(const uint256 &txid) const { return mempool.exists(txid) || base->HaveCoins(txid); } - diff --git a/src/uint256.h b/src/uint256.h index 6bb9a5940..28de54022 100644 --- a/src/uint256.h +++ b/src/uint256.h @@ -7,10 +7,10 @@ #define BITCOIN_UINT256_H #include +#include #include #include #include -#include #include class uint_error : public std::runtime_error { diff --git a/src/util.h b/src/util.h index 6e1f439ff..e72c99adc 100644 --- a/src/util.h +++ b/src/util.h @@ -15,8 +15,8 @@ #endif #include "compat.h" -#include "utiltime.h" #include "tinyformat.h" +#include "utiltime.h" #include #include diff --git a/src/utilstrencodings.cpp b/src/utilstrencodings.cpp index ef1355510..6837e4e26 100644 --- a/src/utilstrencodings.cpp +++ b/src/utilstrencodings.cpp @@ -7,10 +7,11 @@ #include "tinyformat.h" -#include #include #include +#include + using namespace std; // safeChars chosen to allow simple messages/URLs/email addresses, but avoid anything diff --git a/src/version.cpp b/src/version.cpp index 8311041ed..e441cc463 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -7,6 +7,7 @@ #include "tinyformat.h" #include + #include // Name of client reported in the 'version' message. Report the same name diff --git a/src/wallet.h b/src/wallet.h index 5c2618673..3461446b8 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -11,8 +11,8 @@ #include "key.h" #include "keystore.h" #include "main.h" -#include "wallet_ismine.h" #include "ui_interface.h" +#include "wallet_ismine.h" #include "walletdb.h" #include diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 48045b98c..03161250d 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -9,8 +9,8 @@ #include "protocol.h" #include "serialize.h" #include "sync.h" -#include "utiltime.h" #include "util.h" +#include "utiltime.h" #include "wallet.h" #include