summaryrefslogtreecommitdiff
path: root/src/mongo/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/util')
-rw-r--r--src/mongo/util/allocator.cpp4
-rw-r--r--src/mongo/util/assert_util.cpp2
-rw-r--r--src/mongo/util/background.cpp2
-rw-r--r--src/mongo/util/concurrency/mutex.h2
-rw-r--r--src/mongo/util/concurrency/ticketholder.h6
-rw-r--r--src/mongo/util/heap_profiler.cpp2
-rw-r--r--src/mongo/util/log.h2
-rw-r--r--src/mongo/util/md5.cpp2
-rw-r--r--src/mongo/util/net/sock.cpp8
-rw-r--r--src/mongo/util/net/sock.h2
-rw-r--r--src/mongo/util/net/sock_test.cpp2
-rw-r--r--src/mongo/util/net/sockaddr.cpp2
-rw-r--r--src/mongo/util/net/ssl/detail/impl/engine_openssl.ipp10
-rw-r--r--src/mongo/util/net/ssl/impl/context_openssl.ipp12
-rw-r--r--src/mongo/util/net/ssl_manager_openssl.cpp26
-rw-r--r--src/mongo/util/processinfo_linux.cpp8
-rw-r--r--src/mongo/util/progress_meter.cpp4
-rw-r--r--src/mongo/util/shared_buffer.h2
-rw-r--r--src/mongo/util/signal_handlers.cpp4
-rw-r--r--src/mongo/util/stacktrace_posix.cpp8
-rw-r--r--src/mongo/util/str.h4
-rw-r--r--src/mongo/util/text_test.cpp4
-rw-r--r--src/mongo/util/time_support.cpp6
-rw-r--r--src/mongo/util/unowned_ptr_test.cpp8
24 files changed, 66 insertions, 66 deletions
diff --git a/src/mongo/util/allocator.cpp b/src/mongo/util/allocator.cpp
index 358689a0655..66e87518b59 100644
--- a/src/mongo/util/allocator.cpp
+++ b/src/mongo/util/allocator.cpp
@@ -37,7 +37,7 @@ namespace mongo {
void* mongoMalloc(size_t size) {
void* x = std::malloc(size);
- if (x == NULL) {
+ if (x == nullptr) {
reportOutOfMemoryErrorAndExit();
}
return x;
@@ -45,7 +45,7 @@ void* mongoMalloc(size_t size) {
void* mongoRealloc(void* ptr, size_t size) {
void* x = std::realloc(ptr, size);
- if (x == NULL) {
+ if (x == nullptr) {
reportOutOfMemoryErrorAndExit();
}
return x;
diff --git a/src/mongo/util/assert_util.cpp b/src/mongo/util/assert_util.cpp
index 2167b2849ec..dcf2b580d42 100644
--- a/src/mongo/util/assert_util.cpp
+++ b/src/mongo/util/assert_util.cpp
@@ -223,7 +223,7 @@ std::string demangleName(const std::type_info& typeinfo) {
#else
int status;
- char* niceName = abi::__cxa_demangle(typeinfo.name(), 0, 0, &status);
+ char* niceName = abi::__cxa_demangle(typeinfo.name(), nullptr, nullptr, &status);
if (!niceName)
return typeinfo.name();
diff --git a/src/mongo/util/background.cpp b/src/mongo/util/background.cpp
index 441cdab0e53..e5b40238230 100644
--- a/src/mongo/util/background.cpp
+++ b/src/mongo/util/background.cpp
@@ -276,7 +276,7 @@ void PeriodicTaskRunner::remove(PeriodicTask* task) {
stdx::lock_guard<stdx::mutex> lock(_mutex);
for (size_t i = 0; i != _tasks.size(); i++) {
if (_tasks[i] == task) {
- _tasks[i] = NULL;
+ _tasks[i] = nullptr;
break;
}
}
diff --git a/src/mongo/util/concurrency/mutex.h b/src/mongo/util/concurrency/mutex.h
index 8674fe269a4..30ee48f8a30 100644
--- a/src/mongo/util/concurrency/mutex.h
+++ b/src/mongo/util/concurrency/mutex.h
@@ -79,7 +79,7 @@ class SimpleMutex {
public:
SimpleMutex() {
- verify(pthread_mutex_init(&_lock, 0) == 0);
+ verify(pthread_mutex_init(&_lock, nullptr) == 0);
}
~SimpleMutex() {
diff --git a/src/mongo/util/concurrency/ticketholder.h b/src/mongo/util/concurrency/ticketholder.h
index 51c232bc5d1..8ab3d4a39d9 100644
--- a/src/mongo/util/concurrency/ticketholder.h
+++ b/src/mongo/util/concurrency/ticketholder.h
@@ -118,7 +118,7 @@ class TicketHolderReleaser {
public:
TicketHolderReleaser() {
- _holder = NULL;
+ _holder = nullptr;
}
explicit TicketHolderReleaser(TicketHolder* holder) {
@@ -132,10 +132,10 @@ public:
}
bool hasTicket() const {
- return _holder != NULL;
+ return _holder != nullptr;
}
- void reset(TicketHolder* holder = NULL) {
+ void reset(TicketHolder* holder = nullptr) {
if (_holder) {
_holder->release();
}
diff --git a/src/mongo/util/heap_profiler.cpp b/src/mongo/util/heap_profiler.cpp
index 3edb8717f79..05a8a59f03a 100644
--- a/src/mongo/util/heap_profiler.cpp
+++ b/src/mongo/util/heap_profiler.cpp
@@ -481,7 +481,7 @@ private:
if (dladdr(stack.frames[j], &dli)) {
if (dli.dli_sname) {
int status;
- demangled = abi::__cxa_demangle(dli.dli_sname, 0, 0, &status);
+ demangled = abi::__cxa_demangle(dli.dli_sname, nullptr, nullptr, &status);
if (demangled) {
// strip off function parameters as they are very verbose and not useful
char* p = strchr(demangled, '(');
diff --git a/src/mongo/util/log.h b/src/mongo/util/log.h
index bca7c87a33a..68a16c34493 100644
--- a/src/mongo/util/log.h
+++ b/src/mongo/util/log.h
@@ -236,7 +236,7 @@ extern Tee* const startupWarningsLog; // Things put here get reported in MMS
/**
* Write the current context (backtrace), along with the optional "msg".
*/
-void logContext(const char* msg = NULL);
+void logContext(const char* msg = nullptr);
/**
* Turns the global log manager into a plain console logger (no adornments).
diff --git a/src/mongo/util/md5.cpp b/src/mongo/util/md5.cpp
index 383b046c9ac..6a2867f0007 100644
--- a/src/mongo/util/md5.cpp
+++ b/src/mongo/util/md5.cpp
@@ -159,7 +159,7 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/) {
* On little-endian machines, we can process properly aligned
* data without copying it.
*/
- if (!((data - (const md5_byte_t*)0) & 3)) {
+ if (!((data - (const md5_byte_t*)nullptr) & 3)) {
/* data are properly aligned */
X = (const md5_word_t*)data;
} else {
diff --git a/src/mongo/util/net/sock.cpp b/src/mongo/util/net/sock.cpp
index 6d7b2d1e8f7..bb616b4452e 100644
--- a/src/mongo/util/net/sock.cpp
+++ b/src/mongo/util/net/sock.cpp
@@ -190,7 +190,7 @@ Socket::Socket(int fd, const SockAddr& remote)
: _fd(fd),
_remote(remote),
_timeout(0),
- _lastValidityCheckAtSecs(time(0)),
+ _lastValidityCheckAtSecs(time(nullptr)),
_logLevel(logger::LogSeverity::Log()) {
_init();
if (fd >= 0) {
@@ -201,7 +201,7 @@ Socket::Socket(int fd, const SockAddr& remote)
Socket::Socket(double timeout, logger::LogSeverity ll) : _logLevel(ll) {
_fd = INVALID_SOCKET;
_timeout = timeout;
- _lastValidityCheckAtSecs = time(0);
+ _lastValidityCheckAtSecs = time(nullptr);
_init();
}
@@ -214,7 +214,7 @@ void Socket::_init() {
_bytesIn = 0;
_awaitingHandshake = true;
#ifdef MONGO_CONFIG_SSL
- _sslManager = 0;
+ _sslManager = nullptr;
#endif
}
@@ -612,7 +612,7 @@ bool Socket::isStillConnected() {
if (!isPollSupported())
return true; // nothing we can do
- time_t now = time(0);
+ time_t now = time(nullptr);
time_t idleTimeSecs = now - _lastValidityCheckAtSecs;
// Only check once every 5 secs
diff --git a/src/mongo/util/net/sock.h b/src/mongo/util/net/sock.h
index 561cd1cd9e4..a9edfc71de6 100644
--- a/src/mongo/util/net/sock.h
+++ b/src/mongo/util/net/sock.h
@@ -196,7 +196,7 @@ public:
*
* This function may throw SocketException.
*/
- SSLPeerInfo doSSLHandshake(const char* firstBytes = NULL, int len = 0);
+ SSLPeerInfo doSSLHandshake(const char* firstBytes = nullptr, int len = 0);
/**
* @return the time when the socket was opened.
diff --git a/src/mongo/util/net/sock_test.cpp b/src/mongo/util/net/sock_test.cpp
index 14cc5721e29..bb246175eef 100644
--- a/src/mongo/util/net/sock_test.cpp
+++ b/src/mongo/util/net/sock_test.cpp
@@ -210,7 +210,7 @@ public:
SocketFailPointTest()
: _failPoint(getGlobalFailPointRegistry()->getFailPoint(kSocketFailPointName)),
_sockets(socketPair(SOCK_STREAM)) {
- ASSERT_TRUE(_failPoint != NULL);
+ ASSERT_TRUE(_failPoint != nullptr);
ASSERT_TRUE(_sockets.first);
ASSERT_TRUE(_sockets.second);
}
diff --git a/src/mongo/util/net/sockaddr.cpp b/src/mongo/util/net/sockaddr.cpp
index be88e9c206e..9efa10ca409 100644
--- a/src/mongo/util/net/sockaddr.cpp
+++ b/src/mongo/util/net/sockaddr.cpp
@@ -280,7 +280,7 @@ std::string SockAddr::getAddr() const {
case AF_INET6: {
const int buflen = 128;
char buffer[buflen];
- int ret = getnameinfo(raw(), addressSize, buffer, buflen, NULL, 0, NI_NUMERICHOST);
+ int ret = getnameinfo(raw(), addressSize, buffer, buflen, nullptr, 0, NI_NUMERICHOST);
massert(
13082, str::stream() << "getnameinfo error " << getAddrInfoStrError(ret), ret == 0);
return buffer;
diff --git a/src/mongo/util/net/ssl/detail/impl/engine_openssl.ipp b/src/mongo/util/net/ssl/detail/impl/engine_openssl.ipp
index d143a358253..fc0ff1128b7 100644
--- a/src/mongo/util/net/ssl/detail/impl/engine_openssl.ipp
+++ b/src/mongo/util/net/ssl/detail/impl/engine_openssl.ipp
@@ -42,14 +42,14 @@ engine::engine(SSL_CTX* context, const std::string& remoteHostName)
::SSL_set_mode(ssl_, SSL_MODE_ENABLE_PARTIAL_WRITE);
::SSL_set_mode(ssl_, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
- ::BIO* int_bio = 0;
+ ::BIO* int_bio = nullptr;
::BIO_new_bio_pair(&int_bio, 0, &ext_bio_, 0);
::SSL_set_bio(ssl_, int_bio, int_bio);
}
engine::~engine() {
if (SSL_get_app_data(ssl_)) {
- SSL_set_app_data(ssl_, 0);
+ SSL_set_app_data(ssl_, nullptr);
}
::BIO_free(ext_bio_);
@@ -63,14 +63,14 @@ SSL* engine::native_handle() {
engine::want engine::handshake(stream_base::handshake_type type, asio::error_code& ec) {
return perform((type == asio::ssl::stream_base::client) ? &engine::do_connect
: &engine::do_accept,
- 0,
+ nullptr,
0,
ec,
- 0);
+ nullptr);
}
engine::want engine::shutdown(asio::error_code& ec) {
- return perform(&engine::do_shutdown, 0, 0, ec, 0);
+ return perform(&engine::do_shutdown, nullptr, 0, ec, nullptr);
}
engine::want engine::write(const asio::const_buffer& data,
diff --git a/src/mongo/util/net/ssl/impl/context_openssl.ipp b/src/mongo/util/net/ssl/impl/context_openssl.ipp
index b0b48910b4a..ef3ba9cb992 100644
--- a/src/mongo/util/net/ssl/impl/context_openssl.ipp
+++ b/src/mongo/util/net/ssl/impl/context_openssl.ipp
@@ -29,7 +29,7 @@
namespace asio {
namespace ssl {
-context::context(context::method m) : handle_(0) {
+context::context(context::method m) : handle_(nullptr) {
::ERR_clear_error();
switch (m) {
@@ -257,11 +257,11 @@ context::context(context::method m) : handle_(0) {
#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
default:
- handle_ = ::SSL_CTX_new(0);
+ handle_ = ::SSL_CTX_new(nullptr);
break;
}
- if (handle_ == 0) {
+ if (handle_ == nullptr) {
asio::error_code ec(static_cast<int>(::ERR_get_error()), asio::error::get_ssl_category());
asio::detail::throw_error(ec, "context");
}
@@ -270,13 +270,13 @@ context::context(context::method m) : handle_(0) {
#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
context::context(context&& other) {
handle_ = other.handle_;
- other.handle_ = 0;
+ other.handle_ = nullptr;
}
context& context::operator=(context&& other) {
context tmp(ASIO_MOVE_CAST(context)(*this));
handle_ = other.handle_;
- other.handle_ = 0;
+ other.handle_ = nullptr;
return *this;
}
#endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
@@ -284,7 +284,7 @@ context& context::operator=(context&& other) {
context::~context() {
if (handle_) {
if (SSL_CTX_get_app_data(handle_)) {
- SSL_CTX_set_app_data(handle_, 0);
+ SSL_CTX_set_app_data(handle_, nullptr);
}
::SSL_CTX_free(handle_);
diff --git a/src/mongo/util/net/ssl_manager_openssl.cpp b/src/mongo/util/net/ssl_manager_openssl.cpp
index 59695f00504..3c178b9f0b2 100644
--- a/src/mongo/util/net/ssl_manager_openssl.cpp
+++ b/src/mongo/util/net/ssl_manager_openssl.cpp
@@ -738,7 +738,7 @@ SSLConnectionOpenSSL::SSLConnectionOpenSSL(SSL_CTX* context,
ssl = SSL_new(context);
std::string sslErr =
- NULL != getSSLManager() ? getSSLManager()->getSSLErrorMessage(ERR_get_error()) : "";
+ nullptr != getSSLManager() ? getSSLManager()->getSSLErrorMessage(ERR_get_error()) : "";
massert(15861, "Error creating new SSL object " + sslErr, ssl);
BIO_new_bio_pair(&internalBIO, BUFFER_SIZE, &networkBIO, BUFFER_SIZE);
@@ -794,7 +794,7 @@ SSLManagerOpenSSL::SSLManagerOpenSSL(const SSLParams& params, bool isServer)
if (!clientPEM.empty()) {
if (!_parseAndValidateCertificate(
- clientPEM, clientPassword, &_sslConfiguration.clientSubjectName, NULL)) {
+ clientPEM, clientPassword, &_sslConfiguration.clientSubjectName, nullptr)) {
uasserted(16941, "ssl initialization problem");
}
}
@@ -1069,7 +1069,7 @@ bool SSLManagerOpenSSL::_parseAndValidateCertificate(const std::string& keyFile,
SSLX509Name* subjectName,
Date_t* serverCertificateExpirationDate) {
BIO* inBIO = BIO_new(BIO_s_file());
- if (inBIO == NULL) {
+ if (inBIO == nullptr) {
error() << "failed to allocate BIO object: " << getSSLErrorMessage(ERR_get_error());
return false;
}
@@ -1082,8 +1082,8 @@ bool SSLManagerOpenSSL::_parseAndValidateCertificate(const std::string& keyFile,
}
X509* x509 = PEM_read_bio_X509(
- inBIO, NULL, &SSLManagerOpenSSL::password_cb, static_cast<void*>(&keyPassword));
- if (x509 == NULL) {
+ inBIO, nullptr, &SSLManagerOpenSSL::password_cb, static_cast<void*>(&keyPassword));
+ if (x509 == nullptr) {
error() << "cannot retrieve certificate from keyfile: " << keyFile << ' '
<< getSSLErrorMessage(ERR_get_error());
return false;
@@ -1091,7 +1091,7 @@ bool SSLManagerOpenSSL::_parseAndValidateCertificate(const std::string& keyFile,
ON_BLOCK_EXIT([&] { X509_free(x509); });
*subjectName = getCertificateSubjectX509Name(x509);
- if (serverCertificateExpirationDate != NULL) {
+ if (serverCertificateExpirationDate != nullptr) {
unsigned long long notBeforeMillis = _convertASN1ToMillis(X509_get_notBefore(x509));
if (notBeforeMillis == 0) {
error() << "date conversion failed";
@@ -1166,7 +1166,7 @@ bool SSLManagerOpenSSL::_setupPEM(SSL_CTX* context,
Status SSLManagerOpenSSL::_setupCA(SSL_CTX* context, const std::string& caFile) {
// Set the list of CAs sent to clients
STACK_OF(X509_NAME)* certNames = SSL_load_client_CA_file(caFile.c_str());
- if (certNames == NULL) {
+ if (certNames == nullptr) {
return Status(ErrorCodes::InvalidSSLConfiguration,
str::stream() << "cannot read certificate authority file: " << caFile << " "
<< getSSLErrorMessage(ERR_get_error()));
@@ -1174,7 +1174,7 @@ Status SSLManagerOpenSSL::_setupCA(SSL_CTX* context, const std::string& caFile)
SSL_CTX_set_client_CA_list(context, certNames);
// Load trusted CA
- if (SSL_CTX_load_verify_locations(context, caFile.c_str(), NULL) != 1) {
+ if (SSL_CTX_load_verify_locations(context, caFile.c_str(), nullptr) != 1) {
return Status(ErrorCodes::InvalidSSLConfiguration,
str::stream() << "cannot read certificate authority file: " << caFile << " "
<< getSSLErrorMessage(ERR_get_error()));
@@ -1426,8 +1426,8 @@ bool SSLManagerOpenSSL::_doneWithSSLOp(SSLConnectionOpenSSL* conn, int status) {
}
SSLConnectionInterface* SSLManagerOpenSSL::connect(Socket* socket) {
- std::unique_ptr<SSLConnectionOpenSSL> sslConn =
- std::make_unique<SSLConnectionOpenSSL>(_clientContext.get(), socket, (const char*)NULL, 0);
+ std::unique_ptr<SSLConnectionOpenSSL> sslConn = std::make_unique<SSLConnectionOpenSSL>(
+ _clientContext.get(), socket, (const char*)nullptr, 0);
const auto undotted = removeFQDNRoot(socket->remoteAddr().hostOrIp());
int ret = ::SSL_set_tlsext_host_name(sslConn->ssl, undotted.c_str());
@@ -1497,7 +1497,7 @@ StatusWith<SSLPeerInfo> SSLManagerOpenSSL::parseAndValidatePeerCertificate(
X509* peerCert = SSL_get_peer_certificate(conn);
- if (NULL == peerCert) { // no certificate presented by peer
+ if (nullptr == peerCert) { // no certificate presented by peer
if (_weakValidation) {
// do not give warning if certificate warnings are suppressed
if (!_suppressNoCertificateWarning) {
@@ -1561,9 +1561,9 @@ StatusWith<SSLPeerInfo> SSLManagerOpenSSL::parseAndValidatePeerCertificate(
StringBuilder certificateNames;
STACK_OF(GENERAL_NAME)* sanNames = static_cast<STACK_OF(GENERAL_NAME)*>(
- X509_get_ext_d2i(peerCert, NID_subject_alt_name, NULL, NULL));
+ X509_get_ext_d2i(peerCert, NID_subject_alt_name, nullptr, nullptr));
- if (sanNames != NULL) {
+ if (sanNames != nullptr) {
int sanNamesList = sk_GENERAL_NAME_num(sanNames);
certificateNames << "SAN(s): ";
for (int i = 0; i < sanNamesList; i++) {
diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp
index c9bd249d478..32e98f7fc1d 100644
--- a/src/mongo/util/processinfo_linux.cpp
+++ b/src/mongo/util/processinfo_linux.cpp
@@ -255,8 +255,8 @@ public:
char fstr[1024] = {0};
f = fopen(fname, "r");
- if (f != NULL) {
- if (fgets(fstr, 1023, f) != NULL)
+ if (f != nullptr) {
+ if (fgets(fstr, 1023, f) != nullptr)
fstr[strlen(fstr) < 1 ? 0 : strlen(fstr) - 1] = '\0';
fclose(f);
}
@@ -272,10 +272,10 @@ public:
procCount = 0;
f = fopen("/proc/cpuinfo", "r");
- if (f == NULL)
+ if (f == nullptr)
return;
- while (fgets(fstr, 1023, f) != NULL && !feof(f)) {
+ while (fgets(fstr, 1023, f) != nullptr && !feof(f)) {
// until the end of the file
fstr[strlen(fstr) < 1 ? 0 : strlen(fstr) - 1] = '\0';
if (strncmp(fstr, "processor ", 10) == 0 || strncmp(fstr, "processor\t:", 11) == 0)
diff --git a/src/mongo/util/progress_meter.cpp b/src/mongo/util/progress_meter.cpp
index 9ad977581ec..6287cbd7552 100644
--- a/src/mongo/util/progress_meter.cpp
+++ b/src/mongo/util/progress_meter.cpp
@@ -45,7 +45,7 @@ void ProgressMeter::reset(unsigned long long total, int secondsBetween, int chec
_done = 0;
_hits = 0;
- _lastTime = (int)time(0);
+ _lastTime = (int)time(nullptr);
_active = true;
}
@@ -62,7 +62,7 @@ bool ProgressMeter::hit(int n) {
if (_hits % _checkInterval)
return false;
- int t = (int)time(0);
+ int t = (int)time(nullptr);
if (t - _lastTime < _secondsBetween)
return false;
diff --git a/src/mongo/util/shared_buffer.h b/src/mongo/util/shared_buffer.h
index 00000d0a3d5..c026f92f848 100644
--- a/src/mongo/util/shared_buffer.h
+++ b/src/mongo/util/shared_buffer.h
@@ -95,7 +95,7 @@ public:
}
char* get() const {
- return _holder ? _holder->data() : NULL;
+ return _holder ? _holder->data() : nullptr;
}
explicit operator bool() const {
diff --git a/src/mongo/util/signal_handlers.cpp b/src/mongo/util/signal_handlers.cpp
index 707a76f3233..f6f81234c11 100644
--- a/src/mongo/util/signal_handlers.cpp
+++ b/src/mongo/util/signal_handlers.cpp
@@ -180,7 +180,7 @@ void signalProcessingThread(LogFileStatus rotate) {
switch (actualSignal) {
case SIGUSR1:
// log rotate signal
- signalTimeSeconds = time(0);
+ signalTimeSeconds = time(nullptr);
if (signalTimeSeconds <= lastSignalTimeSeconds) {
// ignore multiple signals in the same or earlier second.
break;
@@ -227,7 +227,7 @@ void startSignalProcessingThread(LogFileStatus rotate) {
stdx::thread(eventProcessingThread).detach();
#else
// Mask signals in the current (only) thread. All new threads will inherit this mask.
- invariant(pthread_sigmask(SIG_SETMASK, &asyncSignals, 0) == 0);
+ invariant(pthread_sigmask(SIG_SETMASK, &asyncSignals, nullptr) == 0);
// Spawn a thread to capture the signals we just masked off.
stdx::thread(signalProcessingThread, rotate).detach();
#endif
diff --git a/src/mongo/util/stacktrace_posix.cpp b/src/mongo/util/stacktrace_posix.cpp
index 9eaed27e06c..996cdb52b16 100644
--- a/src/mongo/util/stacktrace_posix.cpp
+++ b/src/mongo/util/stacktrace_posix.cpp
@@ -61,7 +61,7 @@ const int maxBackTraceFrames = 100;
/// Optional string containing extra unwinding information. Should take the form of a
/// JSON document.
-std::string* soMapJson = NULL;
+std::string* soMapJson = nullptr;
/**
* Returns the "basename" of a path. The returned StringData is valid until the data referenced
@@ -188,9 +188,9 @@ void printStackTrace(std::ostream& os) {
Dl_info& dlinfo(dlinfoForFrames[i]);
if (!dladdr(addresses[i], &dlinfo)) {
dlinfo.dli_fname = unknownFileName;
- dlinfo.dli_fbase = NULL;
- dlinfo.dli_sname = NULL;
- dlinfo.dli_saddr = NULL;
+ dlinfo.dli_fbase = nullptr;
+ dlinfo.dli_sname = nullptr;
+ dlinfo.dli_saddr = nullptr;
}
os << ' ' << addresses[i];
}
diff --git a/src/mongo/util/str.h b/src/mongo/util/str.h
index b2ee26dbbdb..f36aa3b0f6d 100644
--- a/src/mongo/util/str.h
+++ b/src/mongo/util/str.h
@@ -128,7 +128,7 @@ inline bool endsWith(const char* p, const char* suffix) {
/** find char x, and return rest of the string thereafter, or an empty string if not found */
inline const char* after(const char* s, char x) {
const char* p = strchr(s, x);
- return (p != 0) ? p + 1 : "";
+ return (p != nullptr) ? p + 1 : "";
}
inline mongo::StringData after(mongo::StringData s, char x) {
auto pos = s.find(x);
@@ -138,7 +138,7 @@ inline mongo::StringData after(mongo::StringData s, char x) {
/** find string x, and return rest of the string thereafter, or an empty string if not found */
inline const char* after(const char* s, const char* x) {
const char* p = strstr(s, x);
- return (p != 0) ? p + strlen(x) : "";
+ return (p != nullptr) ? p + strlen(x) : "";
}
inline mongo::StringData after(mongo::StringData s, mongo::StringData x) {
auto pos = s.find(x);
diff --git a/src/mongo/util/text_test.cpp b/src/mongo/util/text_test.cpp
index cee43fd57cc..77d6561e795 100644
--- a/src/mongo/util/text_test.cpp
+++ b/src/mongo/util/text_test.cpp
@@ -43,7 +43,7 @@ static std::vector<std::string> svec(const char* first, ...) {
va_list ap;
va_start(ap, first);
const char* curr;
- while (NULL != (curr = va_arg(ap, const char*))) {
+ while (nullptr != (curr = va_arg(ap, const char*))) {
result.push_back(curr);
}
va_end(ap);
@@ -52,7 +52,7 @@ static std::vector<std::string> svec(const char* first, ...) {
}
TEST(WindowsCommandLineConstruction, EmptyCommandLine) {
- ASSERT_EQUALS("", constructUtf8WindowsCommandLine(svec(NULL)));
+ ASSERT_EQUALS("", constructUtf8WindowsCommandLine(svec(nullptr)));
}
TEST(WindowsCommandLineConstruction, NothingToQuote) {
diff --git a/src/mongo/util/time_support.cpp b/src/mongo/util/time_support.cpp
index f3c1fee7a33..b40ebcb19ee 100644
--- a/src/mongo/util/time_support.cpp
+++ b/src/mongo/util/time_support.cpp
@@ -143,7 +143,7 @@ std::string time_t_to_String_short(time_t t) {
// colonsOk should be false when creating filenames
string terseCurrentTime(bool colonsOk) {
struct tm t;
- time_t_to_Struct(time(0), &t);
+ time_t_to_Struct(time(nullptr), &t);
const char* fmt = (colonsOk ? "%Y-%m-%dT%H:%M:%S" : "%Y-%m-%dT%H-%M-%S");
char buf[32];
@@ -921,13 +921,13 @@ unsigned long long curTimeMicros64() {
#include <sys/time.h>
unsigned long long curTimeMillis64() {
timeval tv;
- gettimeofday(&tv, NULL);
+ gettimeofday(&tv, nullptr);
return ((unsigned long long)tv.tv_sec) * 1000 + tv.tv_usec / 1000;
}
unsigned long long curTimeMicros64() {
timeval tv;
- gettimeofday(&tv, NULL);
+ gettimeofday(&tv, nullptr);
return (((unsigned long long)tv.tv_sec) * 1000 * 1000) + tv.tv_usec;
}
#endif
diff --git a/src/mongo/util/unowned_ptr_test.cpp b/src/mongo/util/unowned_ptr_test.cpp
index ac1bf86067f..4a6ec0b1d34 100644
--- a/src/mongo/util/unowned_ptr_test.cpp
+++ b/src/mongo/util/unowned_ptr_test.cpp
@@ -46,7 +46,7 @@ TEST(UnownedPtr, Construction) {
ASSERT_EQUALS(aNullPtr, unowned_ptr<int>());
ASSERT_EQUALS(aNullPtr, unowned_ptr<int>({}));
ASSERT_EQUALS(aNullPtr, unowned_ptr<int>(nullptr));
- ASSERT_EQUALS(aNullPtr, unowned_ptr<int>(NULL));
+ ASSERT_EQUALS(aNullPtr, unowned_ptr<int>(nullptr));
ASSERT_EQUALS(p1.get(), unowned_ptr<int>(p1.get()));
ASSERT_EQUALS(p1.get(), unowned_ptr<int>(p1));
ASSERT_EQUALS(p2.get(), unowned_ptr<int>(p2));
@@ -59,7 +59,7 @@ TEST(UnownedPtr, Construction) {
ASSERT_EQUALS(aNullPtr, unowned_ptr<const int>());
ASSERT_EQUALS(aNullPtr, unowned_ptr<const int>({}));
ASSERT_EQUALS(aNullPtr, unowned_ptr<const int>(nullptr));
- ASSERT_EQUALS(aNullPtr, unowned_ptr<const int>(NULL));
+ ASSERT_EQUALS(aNullPtr, unowned_ptr<const int>(nullptr));
ASSERT_EQUALS(p1.get(), unowned_ptr<const int>(p1.get()));
ASSERT_EQUALS(cp1.get(), unowned_ptr<const int>(cp1.get()));
ASSERT_EQUALS(p1.get(), unowned_ptr<const int>(p1));
@@ -86,7 +86,7 @@ TEST(UnownedPtr, Assignment) {
ASSERT_EQUALS(aNullPtr, (unowned_ptr<int>() = {}));
ASSERT_EQUALS(aNullPtr, (unowned_ptr<int>() = nullptr));
- ASSERT_EQUALS(aNullPtr, (unowned_ptr<int>() = NULL));
+ ASSERT_EQUALS(aNullPtr, (unowned_ptr<int>() = nullptr));
ASSERT_EQUALS(p1.get(), (unowned_ptr<int>() = p1.get()));
ASSERT_EQUALS(p1.get(), (unowned_ptr<int>() = p1));
ASSERT_EQUALS(p2.get(), (unowned_ptr<int>() = p2));
@@ -98,7 +98,7 @@ TEST(UnownedPtr, Assignment) {
ASSERT_EQUALS(aNullPtr, (unowned_ptr<const int>() = {}));
ASSERT_EQUALS(aNullPtr, (unowned_ptr<const int>() = nullptr));
- ASSERT_EQUALS(aNullPtr, (unowned_ptr<const int>() = NULL));
+ ASSERT_EQUALS(aNullPtr, (unowned_ptr<const int>() = nullptr));
ASSERT_EQUALS(p1.get(), (unowned_ptr<const int>() = p1.get()));
ASSERT_EQUALS(cp1.get(), (unowned_ptr<const int>() = cp1.get()));
ASSERT_EQUALS(p1.get(), (unowned_ptr<const int>() = p1));