mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-02 20:05:45 +02:00
scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL
-BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
This commit is contained in:
28
src/util.cpp
28
src/util.cpp
@@ -144,7 +144,7 @@ public:
|
||||
// Securely erase the memory used by the PRNG
|
||||
RAND_cleanup();
|
||||
// Shutdown OpenSSL library multithreading support
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
CRYPTO_set_locking_callback(nullptr);
|
||||
// Clear the set of locks now to maintain symmetry with the constructor.
|
||||
ppmutexOpenSSL.reset();
|
||||
}
|
||||
@@ -173,8 +173,8 @@ static boost::once_flag debugPrintInitFlag = BOOST_ONCE_INIT;
|
||||
* the OS/libc. When the shutdown sequence is fully audited and
|
||||
* tested, explicit destruction of these objects can be implemented.
|
||||
*/
|
||||
static FILE* fileout = NULL;
|
||||
static boost::mutex* mutexDebugLog = NULL;
|
||||
static FILE* fileout = nullptr;
|
||||
static boost::mutex* mutexDebugLog = nullptr;
|
||||
static std::list<std::string>* vMsgsBeforeOpenLog;
|
||||
|
||||
static int FileWriteStr(const std::string &str, FILE *fp)
|
||||
@@ -184,7 +184,7 @@ static int FileWriteStr(const std::string &str, FILE *fp)
|
||||
|
||||
static void DebugPrintInit()
|
||||
{
|
||||
assert(mutexDebugLog == NULL);
|
||||
assert(mutexDebugLog == nullptr);
|
||||
mutexDebugLog = new boost::mutex();
|
||||
vMsgsBeforeOpenLog = new std::list<std::string>;
|
||||
}
|
||||
@@ -194,12 +194,12 @@ void OpenDebugLog()
|
||||
boost::call_once(&DebugPrintInit, debugPrintInitFlag);
|
||||
boost::mutex::scoped_lock scoped_lock(*mutexDebugLog);
|
||||
|
||||
assert(fileout == NULL);
|
||||
assert(fileout == nullptr);
|
||||
assert(vMsgsBeforeOpenLog);
|
||||
fs::path pathDebug = GetDataDir() / "debug.log";
|
||||
fileout = fsbridge::fopen(pathDebug, "a");
|
||||
if (fileout) {
|
||||
setbuf(fileout, NULL); // unbuffered
|
||||
setbuf(fileout, nullptr); // unbuffered
|
||||
// dump buffered messages from before we opened the log
|
||||
while (!vMsgsBeforeOpenLog->empty()) {
|
||||
FileWriteStr(vMsgsBeforeOpenLog->front(), fileout);
|
||||
@@ -208,7 +208,7 @@ void OpenDebugLog()
|
||||
}
|
||||
|
||||
delete vMsgsBeforeOpenLog;
|
||||
vMsgsBeforeOpenLog = NULL;
|
||||
vMsgsBeforeOpenLog = nullptr;
|
||||
}
|
||||
|
||||
struct CLogCategoryDesc
|
||||
@@ -344,7 +344,7 @@ int LogPrintStr(const std::string &str)
|
||||
boost::mutex::scoped_lock scoped_lock(*mutexDebugLog);
|
||||
|
||||
// buffer if we haven't opened the log yet
|
||||
if (fileout == NULL) {
|
||||
if (fileout == nullptr) {
|
||||
assert(vMsgsBeforeOpenLog);
|
||||
ret = strTimestamped.length();
|
||||
vMsgsBeforeOpenLog->push_back(strTimestamped);
|
||||
@@ -355,8 +355,8 @@ int LogPrintStr(const std::string &str)
|
||||
if (fReopenDebugLog) {
|
||||
fReopenDebugLog = false;
|
||||
fs::path pathDebug = GetDataDir() / "debug.log";
|
||||
if (fsbridge::freopen(pathDebug,"a",fileout) != NULL)
|
||||
setbuf(fileout, NULL); // unbuffered
|
||||
if (fsbridge::freopen(pathDebug,"a",fileout) != nullptr)
|
||||
setbuf(fileout, nullptr); // unbuffered
|
||||
}
|
||||
|
||||
ret = FileWriteStr(strTimestamped, fileout);
|
||||
@@ -503,7 +503,7 @@ static std::string FormatException(const std::exception* pex, const char* pszThr
|
||||
{
|
||||
#ifdef WIN32
|
||||
char pszModule[MAX_PATH] = "";
|
||||
GetModuleFileNameA(NULL, pszModule, sizeof(pszModule));
|
||||
GetModuleFileNameA(nullptr, pszModule, sizeof(pszModule));
|
||||
#else
|
||||
const char* pszModule = "bitcoin";
|
||||
#endif
|
||||
@@ -534,7 +534,7 @@ fs::path GetDefaultDataDir()
|
||||
#else
|
||||
fs::path pathRet;
|
||||
char* pszHome = getenv("HOME");
|
||||
if (pszHome == NULL || strlen(pszHome) == 0)
|
||||
if (pszHome == nullptr || strlen(pszHome) == 0)
|
||||
pathRet = fs::path("/");
|
||||
else
|
||||
pathRet = fs::path(pszHome);
|
||||
@@ -791,7 +791,7 @@ void ShrinkDebugFile()
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
else if (file != NULL)
|
||||
else if (file != nullptr)
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
@@ -800,7 +800,7 @@ fs::path GetSpecialFolderPath(int nFolder, bool fCreate)
|
||||
{
|
||||
char pszPath[MAX_PATH] = "";
|
||||
|
||||
if(SHGetSpecialFolderPathA(NULL, pszPath, nFolder, fCreate))
|
||||
if(SHGetSpecialFolderPathA(nullptr, pszPath, nFolder, fCreate))
|
||||
{
|
||||
return fs::path(pszPath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user