You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/06/04 23:51:46 UTC
[1/4] mesos git commit: Replaced `NULL` with `nullptr` in mesos.
Repository: mesos
Updated Branches:
refs/heads/master 39cd667a9 -> 686e5013b
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/registrar_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/registrar_tests.cpp b/src/tests/registrar_tests.cpp
index f707a04..ba7c66f 100644
--- a/src/tests/registrar_tests.cpp
+++ b/src/tests/registrar_tests.cpp
@@ -142,10 +142,10 @@ class RegistrarTestBase : public TemporaryDirectoryTest
{
public:
RegistrarTestBase()
- : log(NULL),
- storage(NULL),
- state(NULL),
- replica2(NULL) {}
+ : log(nullptr),
+ storage(nullptr),
+ state(nullptr),
+ replica2(nullptr) {}
protected:
virtual void SetUp()
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/script.cpp
----------------------------------------------------------------------
diff --git a/src/tests/script.cpp b/src/tests/script.cpp
index ec5f2c3..ef6b22a 100644
--- a/src/tests/script.cpp
+++ b/src/tests/script.cpp
@@ -92,8 +92,8 @@ void execute(const string& script)
// Redirect output to /dev/null unless the test is verbose.
if (!flags.verbose) {
- if (freopen("/dev/null", "w", stdout) == NULL ||
- freopen("/dev/null", "w", stderr) == NULL) {
+ if (freopen("/dev/null", "w", stdout) == nullptr ||
+ freopen("/dev/null", "w", stderr) == nullptr) {
std::cerr << "Failed to redirect stdout/stderr to /dev/null:"
<< os::strerror(errno) << std::endl;
abort();
@@ -163,7 +163,7 @@ void execute(const string& script)
os::setenv("MESOS_ACLS", "file://" + aclsPath);
// Now execute the script.
- execl(path.get().c_str(), path.get().c_str(), (char*) NULL);
+ execl(path.get().c_str(), path.get().c_str(), (char*) nullptr);
std::cerr << "Failed to execute '" << script << "': "
<< os::strerror(errno) << std::endl;
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index ab4633a..7ba03e8 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -908,7 +908,7 @@ TEST_F(SlaveTest, DISABLED_ROOT_RunTaskWithCommandInfoWithUser)
// TODO(nnielsen): Introduce STOUT abstraction for user verification
// instead of flat getpwnam call.
const string testUser = "nobody";
- if (::getpwnam(testUser.c_str()) == NULL) {
+ if (::getpwnam(testUser.c_str()) == nullptr) {
LOG(WARNING) << "Cannot run ROOT_RunTaskWithCommandInfoWithUser test:"
<< " user '" << testUser << "' is not present";
return;
@@ -2584,7 +2584,7 @@ TEST_F(SlaveTest, CancelSlaveShutdown)
Clock::settle();
// Reset the filters to allow pongs from the slave.
- filter(NULL);
+ filter(nullptr);
// Advance clock enough to do a ping pong.
Clock::advance(masterFlags.agent_ping_timeout);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/state_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/state_tests.cpp b/src/tests/state_tests.cpp
index e9f6e85..4ba4267 100644
--- a/src/tests/state_tests.cpp
+++ b/src/tests/state_tests.cpp
@@ -331,8 +331,8 @@ class InMemoryStateTest : public ::testing::Test
{
public:
InMemoryStateTest()
- : storage(NULL),
- state(NULL) {}
+ : storage(nullptr),
+ state(nullptr) {}
protected:
virtual void SetUp()
@@ -398,8 +398,8 @@ class LevelDBStateTest : public TemporaryDirectoryTest
{
public:
LevelDBStateTest()
- : storage(NULL),
- state(NULL) {}
+ : storage(nullptr),
+ state(nullptr) {}
protected:
virtual void SetUp()
@@ -475,10 +475,10 @@ class LogStateTest : public TemporaryDirectoryTest
{
public:
LogStateTest()
- : storage(NULL),
- state(NULL),
- replica2(NULL),
- log(NULL) {}
+ : storage(nullptr),
+ state(nullptr),
+ replica2(nullptr),
+ log(nullptr) {}
protected:
virtual void SetUp()
@@ -696,8 +696,8 @@ class ZooKeeperStateTest : public tests::ZooKeeperTest
{
public:
ZooKeeperStateTest()
- : storage(NULL),
- state(NULL) {}
+ : storage(nullptr),
+ state(nullptr) {}
protected:
virtual void SetUp()
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/zookeeper.hpp
----------------------------------------------------------------------
diff --git a/src/tests/zookeeper.hpp b/src/tests/zookeeper.hpp
index 2a4e829..e921fd1 100644
--- a/src/tests/zookeeper.hpp
+++ b/src/tests/zookeeper.hpp
@@ -44,7 +44,7 @@ inline ::testing::AssertionResult AssertZKGet(
const std::string& path)
{
std::string result;
- int code = zk->get(path, false, &result, NULL);
+ int code = zk->get(path, false, &result, nullptr);
if (code == ZOK) {
if (expected == result) {
return ::testing::AssertionSuccess();
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/zookeeper_test_server.cpp
----------------------------------------------------------------------
diff --git a/src/tests/zookeeper_test_server.cpp b/src/tests/zookeeper_test_server.cpp
index c4fd447..b33a001 100644
--- a/src/tests/zookeeper_test_server.cpp
+++ b/src/tests/zookeeper_test_server.cpp
@@ -38,8 +38,8 @@ namespace internal {
namespace tests {
ZooKeeperTestServer::ZooKeeperTestServer()
- : zooKeeperServer(NULL),
- connectionFactory(NULL),
+ : zooKeeperServer(nullptr),
+ connectionFactory(nullptr),
port(0),
started(false)
{
@@ -112,11 +112,11 @@ std::string ZooKeeperTestServer::connectString() const
void ZooKeeperTestServer::shutdownNetwork()
{
- if (connectionFactory != NULL && started) {
+ if (connectionFactory != nullptr && started) {
LOG(INFO) << "Shutting down ZooKeeperTestServer on port " << port;
connectionFactory->shutdown();
delete connectionFactory;
- connectionFactory = NULL;
+ connectionFactory = nullptr;
started = false;
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/zookeeper_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/zookeeper_tests.cpp b/src/tests/zookeeper_tests.cpp
index 0a360c6..72279a3 100644
--- a/src/tests/zookeeper_tests.cpp
+++ b/src/tests/zookeeper_tests.cpp
@@ -53,7 +53,7 @@ TEST_F(ZooKeeperTest, Auth)
"42",
zookeeper::EVERYONE_READ_CREATOR_ALL,
0,
- NULL);
+ nullptr);
ASSERT_ZK_GET("42", &authenticatedZk, "/test");
ZooKeeper unauthenticatedZk(server->connectString(), NO_TIMEOUT, &watcher);
@@ -104,13 +104,13 @@ TEST_F(ZooKeeperTest, Create)
"",
zookeeper::EVERYONE_READ_CREATOR_ALL,
0,
- NULL,
+ nullptr,
true));
authenticatedZk.create("/foo/bar/baz",
"43",
zookeeper::EVERYONE_CREATE_AND_READ_CREATOR_ALL,
0,
- NULL);
+ nullptr);
ASSERT_ZK_GET("43", &authenticatedZk, "/foo/bar/baz");
ZooKeeper nonOwnerZk(server->connectString(), NO_TIMEOUT, &watcher);
@@ -120,13 +120,13 @@ TEST_F(ZooKeeperTest, Create)
"",
zookeeper::EVERYONE_READ_CREATOR_ALL,
0,
- NULL,
+ nullptr,
true));
EXPECT_EQ(ZOK, nonOwnerZk.create("/foo/bar/baz/bam",
"44",
zookeeper::EVERYONE_READ_CREATOR_ALL,
0,
- NULL,
+ nullptr,
true));
ASSERT_ZK_GET("44", &nonOwnerZk, "/foo/bar/baz/bam");
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/zookeeper/group.cpp
----------------------------------------------------------------------
diff --git a/src/zookeeper/group.cpp b/src/zookeeper/group.cpp
index 0168089..a9c6eae 100644
--- a/src/zookeeper/group.cpp
+++ b/src/zookeeper/group.cpp
@@ -96,8 +96,8 @@ GroupProcess::GroupProcess(
acl(_auth.isSome()
? EVERYONE_READ_CREATOR_ALL
: ZOO_OPEN_ACL_UNSAFE),
- watcher(NULL),
- zk(NULL),
+ watcher(nullptr),
+ zk(nullptr),
state(DISCONNECTED),
retrying(false)
{}
@@ -116,8 +116,8 @@ GroupProcess::GroupProcess(
acl(url.authentication.isSome()
? EVERYONE_READ_CREATOR_ALL
: ZOO_OPEN_ACL_UNSAFE),
- watcher(NULL),
- zk(NULL),
+ watcher(nullptr),
+ zk(nullptr),
state(DISCONNECTED),
retrying(false)
{}
@@ -424,7 +424,7 @@ Try<bool> GroupProcess::create()
LOG(INFO) << "Trying to create path '" << znode << "' in ZooKeeper";
- int code = zk->create(znode, "", acl, 0, NULL, true);
+ int code = zk->create(znode, "", acl, 0, nullptr, true);
// We fail all non-retryable return codes except ZNONODEEXISTS (
// since that means the path we were trying to create exists). Note
@@ -700,7 +700,7 @@ Result<Option<string>> GroupProcess::doData(
// Get data associated with ephemeral node.
string result;
- int code = zk->get(path, false, &result, NULL);
+ int code = zk->get(path, false, &result, nullptr);
if (code == ZNONODE) {
return Option<string>::none();
@@ -978,8 +978,8 @@ void GroupProcess::abort(const string& message)
// ephemeral ZNodes as necessary.
delete CHECK_NOTNULL(zk);
delete CHECK_NOTNULL(watcher);
- zk = NULL;
- watcher = NULL;
+ zk = nullptr;
+ watcher = nullptr;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/zookeeper/zookeeper.cpp
----------------------------------------------------------------------
diff --git a/src/zookeeper/zookeeper.cpp b/src/zookeeper/zookeeper.cpp
index 5b136bb..e105377 100644
--- a/src/zookeeper/zookeeper.cpp
+++ b/src/zookeeper/zookeeper.cpp
@@ -55,7 +55,7 @@ public:
: ProcessBase(ID::generate("zookeeper")),
servers(servers),
sessionTimeout(sessionTimeout),
- zh(NULL)
+ zh(nullptr)
{
// We bind the Watcher::process callback so we can pass it to the
// C callback as a pointer and invoke it directly.
@@ -108,7 +108,7 @@ public:
servers.c_str(),
event,
static_cast<int>(sessionTimeout.ms()),
- NULL,
+ nullptr,
&callback,
0);
@@ -118,7 +118,7 @@ public:
// (2) Any getaddrinfo error other than EAI_NONAME,
// EAI_NODATA, and EAI_MEMORY are mapped to EINVAL.
// Either way, retrying is not problematic.
- if (zh == NULL && errno == EINVAL) {
+ if (zh == nullptr && errno == EINVAL) {
ErrnoError error("zookeeper_init failed");
LOG(WARNING) << error.message << " ; retrying in 1 second";
os::sleep(Seconds(1));
@@ -128,7 +128,7 @@ public:
break;
}
- if (zh == NULL) {
+ if (zh == nullptr) {
PLOG(FATAL) << "Failed to create ZooKeeper, zookeeper_init";
}
}
@@ -232,7 +232,7 @@ public:
}
// First check if the path exists.
- return exists(path, false, NULL)
+ return exists(path, false, nullptr)
.then(defer(self(),
&Self::_create,
path,
@@ -385,7 +385,7 @@ public:
Future<int> future = promise->future();
tuple<Promise<int>*, Stat*>* args =
- new tuple<Promise<int>*, Stat*>(promise, NULL);
+ new tuple<Promise<int>*, Stat*>(promise, nullptr);
int ret = zoo_aset(
zh,
@@ -444,7 +444,7 @@ private:
string* result = std::get<1>(*args);
if (ret == 0) {
- if (result != NULL) {
+ if (result != nullptr) {
result->assign(value);
}
}
@@ -464,7 +464,7 @@ private:
Stat *stat_result = std::get<1>(*args);
if (ret == 0) {
- if (stat_result != NULL) {
+ if (stat_result != nullptr) {
*stat_result = *stat;
}
}
@@ -490,11 +490,11 @@ private:
Stat* stat_result = std::get<2>(*args);
if (ret == 0) {
- if (result != NULL) {
+ if (result != nullptr) {
result->assign(value, value_len);
}
- if (stat_result != NULL) {
+ if (stat_result != nullptr) {
*stat_result = *stat;
}
}
@@ -517,7 +517,7 @@ private:
vector<string>* results = std::get<1>(*args);
if (ret == 0) {
- if (results != NULL) {
+ if (results != nullptr) {
for (int i = 0; i < values->count; i++) {
results->push_back(values->data[i]);
}
[2/4] mesos git commit: Replaced `NULL` with `nullptr` in mesos.
Posted by mp...@apache.org.
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/python/scheduler/src/mesos/scheduler/mesos_scheduler_driver_impl.cpp
----------------------------------------------------------------------
diff --git a/src/python/scheduler/src/mesos/scheduler/mesos_scheduler_driver_impl.cpp b/src/python/scheduler/src/mesos/scheduler/mesos_scheduler_driver_impl.cpp
index e1c91fe..6dec9da 100644
--- a/src/python/scheduler/src/mesos/scheduler/mesos_scheduler_driver_impl.cpp
+++ b/src/python/scheduler/src/mesos/scheduler/mesos_scheduler_driver_impl.cpp
@@ -40,7 +40,7 @@ namespace python {
* Python type object for MesosSchedulerDriverImpl.
*/
PyTypeObject MesosSchedulerDriverImplType = {
- PyObject_HEAD_INIT(NULL)
+ PyObject_HEAD_INIT(nullptr)
0, /* ob_size */
"_mesos.MesosSchedulerDriverImpl", /* tp_name */
sizeof(MesosSchedulerDriverImpl), /* tp_basicsize */
@@ -161,7 +161,7 @@ PyMethodDef MesosSchedulerDriverImpl_methods[] = {
METH_VARARGS,
"Master sends status updates if task status is different from expected"
},
- { NULL } /* Sentinel */
+ { nullptr } /* Sentinel */
};
@@ -175,10 +175,10 @@ PyObject* MesosSchedulerDriverImpl_new(PyTypeObject* type,
{
MesosSchedulerDriverImpl* self;
self = (MesosSchedulerDriverImpl*) type->tp_alloc(type, 0);
- if (self != NULL) {
- self->driver = NULL;
- self->proxyScheduler = NULL;
- self->pythonScheduler = NULL;
+ if (self != nullptr) {
+ self->driver = nullptr;
+ self->proxyScheduler = nullptr;
+ self->pythonScheduler = nullptr;
}
return (PyObject*) self;
}
@@ -193,11 +193,11 @@ int MesosSchedulerDriverImpl_init(MesosSchedulerDriverImpl* self,
{
// Note: We use an integer for 'implicitAcknoweldgements' because
// it is the recommended way to pass booleans through CPython.
- PyObject* schedulerObj = NULL;
- PyObject* frameworkObj = NULL;
+ PyObject* schedulerObj = nullptr;
+ PyObject* frameworkObj = nullptr;
const char* master;
int implicitAcknowledgements = 1; // Enabled by default.
- PyObject* credentialObj = NULL;
+ PyObject* credentialObj = nullptr;
if (!PyArg_ParseTuple(
args,
@@ -210,7 +210,7 @@ int MesosSchedulerDriverImpl_init(MesosSchedulerDriverImpl* self,
return -1;
}
- if (schedulerObj != NULL) {
+ if (schedulerObj != nullptr) {
PyObject* tmp = self->pythonScheduler;
Py_INCREF(schedulerObj);
self->pythonScheduler = schedulerObj;
@@ -218,7 +218,7 @@ int MesosSchedulerDriverImpl_init(MesosSchedulerDriverImpl* self,
}
FrameworkInfo framework;
- if (frameworkObj != NULL) {
+ if (frameworkObj != nullptr) {
if (!readPythonProtobuf(frameworkObj, &framework)) {
PyErr_Format(PyExc_Exception,
"Could not deserialize Python FrameworkInfo");
@@ -227,7 +227,7 @@ int MesosSchedulerDriverImpl_init(MesosSchedulerDriverImpl* self,
}
Credential credential;
- if (credentialObj != NULL) {
+ if (credentialObj != nullptr) {
if (!readPythonProtobuf(credentialObj, &credential)) {
PyErr_Format(PyExc_Exception, "Could not deserialize Python Credential");
return -1;
@@ -235,19 +235,19 @@ int MesosSchedulerDriverImpl_init(MesosSchedulerDriverImpl* self,
}
- if (self->driver != NULL) {
+ if (self->driver != nullptr) {
delete self->driver;
- self->driver = NULL;
+ self->driver = nullptr;
}
- if (self->proxyScheduler != NULL) {
+ if (self->proxyScheduler != nullptr) {
delete self->proxyScheduler;
- self->proxyScheduler = NULL;
+ self->proxyScheduler = nullptr;
}
self->proxyScheduler = new ProxyScheduler(self);
- if (credentialObj != NULL) {
+ if (credentialObj != nullptr) {
self->driver = new MesosSchedulerDriver(
self->proxyScheduler,
framework,
@@ -271,7 +271,7 @@ int MesosSchedulerDriverImpl_init(MesosSchedulerDriverImpl* self,
*/
void MesosSchedulerDriverImpl_dealloc(MesosSchedulerDriverImpl* self)
{
- if (self->driver != NULL) {
+ if (self->driver != nullptr) {
// We need to wrap the driver destructor in an "allow threads"
// macro since the MesosSchedulerDriver destructor waits for the
// SchedulerProcess to terminate and there might be a thread that
@@ -281,12 +281,12 @@ void MesosSchedulerDriverImpl_dealloc(MesosSchedulerDriverImpl* self)
Py_BEGIN_ALLOW_THREADS
delete self->driver;
Py_END_ALLOW_THREADS
- self->driver = NULL;
+ self->driver = nullptr;
}
- if (self->proxyScheduler != NULL) {
+ if (self->proxyScheduler != nullptr) {
delete self->proxyScheduler;
- self->proxyScheduler = NULL;
+ self->proxyScheduler = nullptr;
}
MesosSchedulerDriverImpl_clear(self);
@@ -320,9 +320,9 @@ int MesosSchedulerDriverImpl_clear(MesosSchedulerDriverImpl* self)
PyObject* MesosSchedulerDriverImpl_start(MesosSchedulerDriverImpl* self)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
Status status = self->driver->start();
@@ -333,15 +333,15 @@ PyObject* MesosSchedulerDriverImpl_start(MesosSchedulerDriverImpl* self)
PyObject* MesosSchedulerDriverImpl_stop(MesosSchedulerDriverImpl* self,
PyObject* args)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
bool failover = false; // Should match default in mesos.py.
if (!PyArg_ParseTuple(args, "|b", &failover)) {
- return NULL;
+ return nullptr;
}
Status status = self->driver->stop(failover);
@@ -351,9 +351,9 @@ PyObject* MesosSchedulerDriverImpl_stop(MesosSchedulerDriverImpl* self,
PyObject* MesosSchedulerDriverImpl_abort(MesosSchedulerDriverImpl* self)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
Status status = self->driver->abort();
@@ -363,9 +363,9 @@ PyObject* MesosSchedulerDriverImpl_abort(MesosSchedulerDriverImpl* self)
PyObject* MesosSchedulerDriverImpl_join(MesosSchedulerDriverImpl* self)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
Status status;
@@ -378,9 +378,9 @@ PyObject* MesosSchedulerDriverImpl_join(MesosSchedulerDriverImpl* self)
PyObject* MesosSchedulerDriverImpl_run(MesosSchedulerDriverImpl* self)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
Status status;
@@ -395,33 +395,33 @@ PyObject* MesosSchedulerDriverImpl_requestResources(
MesosSchedulerDriverImpl* self,
PyObject* args)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
- PyObject* requestsObj = NULL;
+ PyObject* requestsObj = nullptr;
vector<Request> requests;
if (!PyArg_ParseTuple(args, "O", &requestsObj)) {
- return NULL;
+ return nullptr;
}
if (!PyList_Check(requestsObj)) {
PyErr_Format(PyExc_Exception,
"Parameter 2 to requestsResources is not a list");
- return NULL;
+ return nullptr;
}
Py_ssize_t len = PyList_Size(requestsObj);
for (int i = 0; i < len; i++) {
PyObject* requestObj = PyList_GetItem(requestsObj, i);
- if (requestObj == NULL) {
- return NULL; // Exception will have been set by PyList_GetItem.
+ if (requestObj == nullptr) {
+ return nullptr; // Exception will have been set by PyList_GetItem.
}
Request request;
if (!readPythonProtobuf(requestObj, &request)) {
PyErr_Format(PyExc_Exception, "Could not deserialize Python Request");
- return NULL;
+ return nullptr;
}
requests.push_back(request);
}
@@ -434,20 +434,20 @@ PyObject* MesosSchedulerDriverImpl_requestResources(
PyObject* MesosSchedulerDriverImpl_launchTasks(MesosSchedulerDriverImpl* self,
PyObject* args)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
- PyObject* offerIdsObj = NULL;
- PyObject* tasksObj = NULL;
- PyObject* filtersObj = NULL;
+ PyObject* offerIdsObj = nullptr;
+ PyObject* tasksObj = nullptr;
+ PyObject* filtersObj = nullptr;
vector<OfferID> offerIds;
vector<TaskInfo> tasks;
Filters filters;
if (!PyArg_ParseTuple(args, "OO|O", &offerIdsObj, &tasksObj, &filtersObj)) {
- return NULL;
+ return nullptr;
}
// Offer argument can be a list of offer ids or a single offer id (for
@@ -456,21 +456,21 @@ PyObject* MesosSchedulerDriverImpl_launchTasks(MesosSchedulerDriverImpl* self,
OfferID offerId;
if (!readPythonProtobuf(offerIdsObj, &offerId)) {
PyErr_Format(PyExc_Exception, "Could not deserialize Python OfferID");
- return NULL;
+ return nullptr;
}
offerIds.push_back(offerId);
} else {
Py_ssize_t len = PyList_Size(offerIdsObj);
for (int i = 0; i < len; i++) {
PyObject* offerObj = PyList_GetItem(offerIdsObj, i);
- if (offerObj == NULL) {
- return NULL;
+ if (offerObj == nullptr) {
+ return nullptr;
}
OfferID offerId;
if (!readPythonProtobuf(offerObj, &offerId)) {
PyErr_Format(PyExc_Exception,
"Could not deserialize Python OfferID");
- return NULL;
+ return nullptr;
}
offerIds.push_back(offerId);
}
@@ -478,28 +478,28 @@ PyObject* MesosSchedulerDriverImpl_launchTasks(MesosSchedulerDriverImpl* self,
if (!PyList_Check(tasksObj)) {
PyErr_Format(PyExc_Exception, "Parameter 2 to launchTasks is not a list");
- return NULL;
+ return nullptr;
}
Py_ssize_t len = PyList_Size(tasksObj);
for (int i = 0; i < len; i++) {
PyObject* taskObj = PyList_GetItem(tasksObj, i);
- if (taskObj == NULL) {
- return NULL; // Exception will have been set by PyList_GetItem.
+ if (taskObj == nullptr) {
+ return nullptr; // Exception will have been set by PyList_GetItem.
}
TaskInfo task;
if (!readPythonProtobuf(taskObj, &task)) {
PyErr_Format(PyExc_Exception,
"Could not deserialize Python TaskInfo");
- return NULL;
+ return nullptr;
}
tasks.push_back(task);
}
- if (filtersObj != NULL) {
+ if (filtersObj != nullptr) {
if (!readPythonProtobuf(filtersObj, &filters)) {
PyErr_Format(PyExc_Exception,
"Could not deserialize Python Filters");
- return NULL;
+ return nullptr;
}
}
@@ -511,19 +511,19 @@ PyObject* MesosSchedulerDriverImpl_launchTasks(MesosSchedulerDriverImpl* self,
PyObject* MesosSchedulerDriverImpl_killTask(MesosSchedulerDriverImpl* self,
PyObject* args)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
- PyObject* tidObj = NULL;
+ PyObject* tidObj = nullptr;
TaskID tid;
if (!PyArg_ParseTuple(args, "O", &tidObj)) {
- return NULL;
+ return nullptr;
}
if (!readPythonProtobuf(tidObj, &tid)) {
PyErr_Format(PyExc_Exception, "Could not deserialize Python TaskID");
- return NULL;
+ return nullptr;
}
Status status = self->driver->killTask(tid);
@@ -534,14 +534,14 @@ PyObject* MesosSchedulerDriverImpl_killTask(MesosSchedulerDriverImpl* self,
PyObject* MesosSchedulerDriverImpl_acceptOffers(MesosSchedulerDriverImpl* self,
PyObject* args)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
- PyObject* offerIdsObj = NULL;
- PyObject* operationsObj = NULL;
- PyObject* filtersObj = NULL;
+ PyObject* offerIdsObj = nullptr;
+ PyObject* operationsObj = nullptr;
+ PyObject* filtersObj = nullptr;
Py_ssize_t len = 0;
vector<OfferID> offerIds;
vector<Offer::Operation> operations;
@@ -552,56 +552,56 @@ PyObject* MesosSchedulerDriverImpl_acceptOffers(MesosSchedulerDriverImpl* self,
&offerIdsObj,
&operationsObj,
&filtersObj)) {
- return NULL;
+ return nullptr;
}
if (!PyList_Check(offerIdsObj)) {
PyErr_Format(PyExc_Exception, "Parameter 1 to acceptOffers is not a list");
- return NULL;
+ return nullptr;
}
len = PyList_Size(offerIdsObj);
for (int i = 0; i < len; i++) {
PyObject* offerObj = PyList_GetItem(offerIdsObj, i);
- if (offerObj == NULL) {
- return NULL;
+ if (offerObj == nullptr) {
+ return nullptr;
}
OfferID offerId;
if (!readPythonProtobuf(offerObj, &offerId)) {
PyErr_Format(PyExc_Exception,
"Could not deserialize Python OfferID");
- return NULL;
+ return nullptr;
}
offerIds.push_back(offerId);
}
if (!PyList_Check(operationsObj)) {
PyErr_Format(PyExc_Exception, "Parameter 2 to acceptOffers is not a list");
- return NULL;
+ return nullptr;
}
len = PyList_Size(operationsObj);
for (int i = 0; i < len; i++) {
PyObject* operationObj = PyList_GetItem(operationsObj, i);
- if (operationObj == NULL) {
- return NULL; // Exception will have been set by PyList_GetItem.
+ if (operationObj == nullptr) {
+ return nullptr; // Exception will have been set by PyList_GetItem.
}
Offer::Operation operation;
if (!readPythonProtobuf(operationObj, &operation)) {
PyErr_Format(PyExc_Exception,
"Could not deserialize Python Offer.Operation");
- return NULL;
+ return nullptr;
}
operations.push_back(operation);
}
- if (filtersObj != NULL) {
+ if (filtersObj != nullptr) {
if (!readPythonProtobuf(filtersObj, &filters)) {
PyErr_Format(PyExc_Exception,
"Could not deserialize Python Filters");
- return NULL;
+ return nullptr;
}
}
@@ -613,30 +613,30 @@ PyObject* MesosSchedulerDriverImpl_acceptOffers(MesosSchedulerDriverImpl* self,
PyObject* MesosSchedulerDriverImpl_declineOffer(MesosSchedulerDriverImpl* self,
PyObject* args)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
- PyObject* offerIdObj = NULL;
- PyObject* filtersObj = NULL;
+ PyObject* offerIdObj = nullptr;
+ PyObject* filtersObj = nullptr;
OfferID offerId;
Filters filters;
if (!PyArg_ParseTuple(args, "O|O", &offerIdObj, &filtersObj)) {
- return NULL;
+ return nullptr;
}
if (!readPythonProtobuf(offerIdObj, &offerId)) {
PyErr_Format(PyExc_Exception, "Could not deserialize Python OfferID");
- return NULL;
+ return nullptr;
}
- if (filtersObj != NULL) {
+ if (filtersObj != nullptr) {
if (!readPythonProtobuf(filtersObj, &filters)) {
PyErr_Format(PyExc_Exception,
"Could not deserialize Python Filters");
- return NULL;
+ return nullptr;
}
}
@@ -647,9 +647,9 @@ PyObject* MesosSchedulerDriverImpl_declineOffer(MesosSchedulerDriverImpl* self,
PyObject* MesosSchedulerDriverImpl_reviveOffers(MesosSchedulerDriverImpl* self)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
Status status = self->driver->reviveOffers();
@@ -660,9 +660,9 @@ PyObject* MesosSchedulerDriverImpl_reviveOffers(MesosSchedulerDriverImpl* self)
PyObject* MesosSchedulerDriverImpl_suppressOffers(
MesosSchedulerDriverImpl* self)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
Status status = self->driver->suppressOffers();
@@ -674,21 +674,21 @@ PyObject* MesosSchedulerDriverImpl_acknowledgeStatusUpdate(
MesosSchedulerDriverImpl* self,
PyObject* args)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
- PyObject* taskStatusObj = NULL;
+ PyObject* taskStatusObj = nullptr;
TaskStatus taskStatus;
if (!PyArg_ParseTuple(args, "O", &taskStatusObj)) {
- return NULL;
+ return nullptr;
}
if (!readPythonProtobuf(taskStatusObj, &taskStatus)) {
PyErr_Format(PyExc_Exception, "Could not deserialize Python TaskStatus");
- return NULL;
+ return nullptr;
}
Status status = self->driver->acknowledgeStatusUpdate(taskStatus);
@@ -701,13 +701,13 @@ PyObject* MesosSchedulerDriverImpl_sendFrameworkMessage(
MesosSchedulerDriverImpl* self,
PyObject* args)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
- PyObject* slaveIdObj = NULL;
- PyObject* executorIdObj = NULL;
+ PyObject* slaveIdObj = nullptr;
+ PyObject* executorIdObj = nullptr;
SlaveID slaveId;
ExecutorID executorId;
const char* data;
@@ -715,17 +715,17 @@ PyObject* MesosSchedulerDriverImpl_sendFrameworkMessage(
if (!PyArg_ParseTuple(
args, "OOs#", &executorIdObj, &slaveIdObj, &data, &length)) {
- return NULL;
+ return nullptr;
}
if (!readPythonProtobuf(executorIdObj, &executorId)) {
PyErr_Format(PyExc_Exception, "Could not deserialize Python ExecutorID");
- return NULL;
+ return nullptr;
}
if (!readPythonProtobuf(slaveIdObj, &slaveId)) {
PyErr_Format(PyExc_Exception, "Could not deserialize Python SlaveID");
- return NULL;
+ return nullptr;
}
Status status = self->driver->sendFrameworkMessage(
@@ -739,37 +739,37 @@ PyObject* MesosSchedulerDriverImpl_reconcileTasks(
MesosSchedulerDriverImpl* self,
PyObject* args)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is nullptr");
+ return nullptr;
}
- PyObject* statusesObj = NULL;
+ PyObject* statusesObj = nullptr;
vector<TaskStatus> statuses;
if (!PyArg_ParseTuple(args, "O", &statusesObj)) {
- return NULL;
+ return nullptr;
}
if (!PyList_Check(statusesObj)) {
PyErr_Format(PyExc_Exception,
"Parameter 1 to reconcileTasks is not a list");
- return NULL;
+ return nullptr;
}
Py_ssize_t len = PyList_Size(statusesObj);
for (int i = 0; i < len; i++) {
PyObject* statusObj = PyList_GetItem(statusesObj, i);
- if (statusObj == NULL) {
- return NULL;
+ if (statusObj == nullptr) {
+ return nullptr;
}
TaskStatus status;
if (!readPythonProtobuf(statusObj, &status)) {
PyErr_Format(PyExc_Exception,
"Could not deserialize Python TaskStatus");
- return NULL;
+ return nullptr;
}
statuses.push_back(status);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/python/scheduler/src/mesos/scheduler/module.cpp
----------------------------------------------------------------------
diff --git a/src/python/scheduler/src/mesos/scheduler/module.cpp b/src/python/scheduler/src/mesos/scheduler/module.cpp
index 62eaf31..11bda19 100644
--- a/src/python/scheduler/src/mesos/scheduler/module.cpp
+++ b/src/python/scheduler/src/mesos/scheduler/module.cpp
@@ -50,7 +50,7 @@ using std::vector;
* The Python module object for mesos_pb2 (which contains the protobuf
* classes generated for Python).
*/
-PyObject* mesos::python::mesos_pb2 = NULL;
+PyObject* mesos::python::mesos_pb2 = nullptr;
namespace {
@@ -59,7 +59,7 @@ namespace {
* Method list for our Python module.
*/
PyMethodDef MODULE_METHODS[] = {
- {NULL, NULL, 0, NULL} /* Sentinel */
+ {nullptr, nullptr, 0, nullptr} /* Sentinel */
};
} // namespace {
@@ -75,7 +75,7 @@ PyMODINIT_FUNC init_scheduler()
// Import the mesos_pb2 module (on which we depend for protobuf classes)
mesos_pb2 = PyImport_ImportModule("mesos.interface.mesos_pb2");
- if (mesos_pb2 == NULL)
+ if (mesos_pb2 == nullptr)
return;
// Initialize our Python types.
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/python/scheduler/src/mesos/scheduler/proxy_scheduler.cpp
----------------------------------------------------------------------
diff --git a/src/python/scheduler/src/mesos/scheduler/proxy_scheduler.cpp b/src/python/scheduler/src/mesos/scheduler/proxy_scheduler.cpp
index 3d8f3bf..586b2e8 100644
--- a/src/python/scheduler/src/mesos/scheduler/proxy_scheduler.cpp
+++ b/src/python/scheduler/src/mesos/scheduler/proxy_scheduler.cpp
@@ -41,17 +41,17 @@ void ProxyScheduler::registered(SchedulerDriver* driver,
{
InterpreterLock lock;
- PyObject* fid = NULL;
- PyObject* minfo = NULL;
- PyObject* res = NULL;
+ PyObject* fid = nullptr;
+ PyObject* minfo = nullptr;
+ PyObject* res = nullptr;
fid = createPythonProtobuf(frameworkId, "FrameworkID");
- if (fid == NULL) {
+ if (fid == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
minfo = createPythonProtobuf(masterInfo, "MasterInfo");
- if (minfo == NULL) {
+ if (minfo == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
@@ -61,7 +61,7 @@ void ProxyScheduler::registered(SchedulerDriver* driver,
impl,
fid,
minfo);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call scheduler's registered" << endl;
goto cleanup;
}
@@ -82,11 +82,11 @@ void ProxyScheduler::reregistered(SchedulerDriver* driver,
{
InterpreterLock lock;
- PyObject* minfo = NULL;
- PyObject* res = NULL;
+ PyObject* minfo = nullptr;
+ PyObject* res = nullptr;
minfo = createPythonProtobuf(masterInfo, "MasterInfo");
- if (minfo == NULL) {
+ if (minfo == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
@@ -95,7 +95,7 @@ void ProxyScheduler::reregistered(SchedulerDriver* driver,
(char*) "OO",
impl,
minfo);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call scheduler's reregistered" << endl;
goto cleanup;
}
@@ -114,13 +114,13 @@ void ProxyScheduler::disconnected(SchedulerDriver* driver)
{
InterpreterLock lock;
- PyObject* res = NULL;
+ PyObject* res = nullptr;
res = PyObject_CallMethod(impl->pythonScheduler,
(char*) "disconnected",
(char*) "O",
impl);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call scheduler's disconnected" << endl;
goto cleanup;
}
@@ -139,16 +139,16 @@ void ProxyScheduler::resourceOffers(SchedulerDriver* driver,
{
InterpreterLock lock;
- PyObject* list = NULL;
- PyObject* res = NULL;
+ PyObject* list = nullptr;
+ PyObject* res = nullptr;
list = PyList_New(offers.size());
- if (list == NULL) {
+ if (list == nullptr) {
goto cleanup;
}
for (size_t i = 0; i < offers.size(); i++) {
PyObject* offer = createPythonProtobuf(offers[i], "Offer");
- if (offer == NULL) {
+ if (offer == nullptr) {
goto cleanup;
}
PyList_SetItem(list, i, offer); // Steals the reference to offer.
@@ -160,7 +160,7 @@ void ProxyScheduler::resourceOffers(SchedulerDriver* driver,
impl,
list);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call scheduler's resourceOffer" << endl;
goto cleanup;
}
@@ -180,11 +180,11 @@ void ProxyScheduler::offerRescinded(SchedulerDriver* driver,
{
InterpreterLock lock;
- PyObject* oid = NULL;
- PyObject* res = NULL;
+ PyObject* oid = nullptr;
+ PyObject* res = nullptr;
oid = createPythonProtobuf(offerId, "OfferID");
- if (oid == NULL) {
+ if (oid == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
@@ -193,7 +193,7 @@ void ProxyScheduler::offerRescinded(SchedulerDriver* driver,
(char*) "OO",
impl,
oid);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call scheduler's offerRescinded" << endl;
goto cleanup;
}
@@ -213,11 +213,11 @@ void ProxyScheduler::statusUpdate(SchedulerDriver* driver,
{
InterpreterLock lock;
- PyObject* stat = NULL;
- PyObject* res = NULL;
+ PyObject* stat = nullptr;
+ PyObject* res = nullptr;
stat = createPythonProtobuf(status, "TaskStatus");
- if (stat == NULL) {
+ if (stat == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
@@ -226,7 +226,7 @@ void ProxyScheduler::statusUpdate(SchedulerDriver* driver,
(char*) "OO",
impl,
stat);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call scheduler's statusUpdate" << endl;
goto cleanup;
}
@@ -248,17 +248,17 @@ void ProxyScheduler::frameworkMessage(SchedulerDriver* driver,
{
InterpreterLock lock;
- PyObject* eid = NULL;
- PyObject* sid = NULL;
- PyObject* res = NULL;
+ PyObject* eid = nullptr;
+ PyObject* sid = nullptr;
+ PyObject* res = nullptr;
eid = createPythonProtobuf(executorId, "ExecutorID");
- if (eid == NULL) {
+ if (eid == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
sid = createPythonProtobuf(slaveId, "SlaveID");
- if (sid == NULL) {
+ if (sid == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
@@ -270,7 +270,7 @@ void ProxyScheduler::frameworkMessage(SchedulerDriver* driver,
sid,
data.data(),
data.length());
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call scheduler's frameworkMessage" << endl;
goto cleanup;
}
@@ -290,11 +290,11 @@ void ProxyScheduler::slaveLost(SchedulerDriver* driver, const SlaveID& slaveId)
{
InterpreterLock lock;
- PyObject* sid = NULL;
- PyObject* res = NULL;
+ PyObject* sid = nullptr;
+ PyObject* res = nullptr;
sid = createPythonProtobuf(slaveId, "SlaveID");
- if (sid == NULL) {
+ if (sid == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
@@ -303,7 +303,7 @@ void ProxyScheduler::slaveLost(SchedulerDriver* driver, const SlaveID& slaveId)
(char*) "OO",
impl,
sid);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call scheduler's slaveLost" << endl;
goto cleanup;
}
@@ -325,14 +325,14 @@ void ProxyScheduler::executorLost(SchedulerDriver* driver,
{
InterpreterLock lock;
- PyObject* executorIdObj = NULL;
- PyObject* slaveIdObj = NULL;
- PyObject* res = NULL;
+ PyObject* executorIdObj = nullptr;
+ PyObject* slaveIdObj = nullptr;
+ PyObject* res = nullptr;
executorIdObj = createPythonProtobuf(executorId, "ExecutorID");
slaveIdObj = createPythonProtobuf(slaveId, "SlaveID");
- if (executorIdObj == NULL || slaveIdObj == NULL) {
+ if (executorIdObj == nullptr || slaveIdObj == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
@@ -343,7 +343,7 @@ void ProxyScheduler::executorLost(SchedulerDriver* driver,
executorIdObj,
slaveIdObj,
status);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call scheduler's executorLost" << endl;
goto cleanup;
}
@@ -368,7 +368,7 @@ void ProxyScheduler::error(SchedulerDriver* driver, const string& message)
impl,
message.data(),
message.length());
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call scheduler's error" << endl;
goto cleanup;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/sched/sched.cpp
----------------------------------------------------------------------
diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp
index 9f0c51d..80c5cfc 100644
--- a/src/sched/sched.cpp
+++ b/src/sched/sched.cpp
@@ -216,7 +216,7 @@ public:
flags(_flags),
implicitAcknowledgements(_implicitAcknowledgements),
credential(_credential),
- authenticatee(NULL),
+ authenticatee(nullptr),
authenticating(None()),
authenticated(false),
reauthenticate(false)
@@ -385,7 +385,7 @@ protected:
CHECK_SOME(credential);
- CHECK(authenticatee == NULL);
+ CHECK(authenticatee == nullptr);
if (flags.authenticatee == scheduler::DEFAULT_AUTHENTICATEE) {
LOG(INFO) << "Using default CRAM-MD5 authenticatee";
@@ -433,7 +433,7 @@ protected:
}
delete CHECK_NOTNULL(authenticatee);
- authenticatee = NULL;
+ authenticatee = nullptr;
CHECK_SOME(authenticating);
const Future<bool>& future = authenticating.get();
@@ -1707,7 +1707,7 @@ void MesosSchedulerDriver::initialize() {
pid = local::launch(flags);
}
- CHECK(process == NULL);
+ CHECK(process == nullptr);
url = pid.isSome() ? static_cast<string>(pid.get()) : master;
}
@@ -1731,14 +1731,14 @@ MesosSchedulerDriver::MesosSchedulerDriver(
Scheduler* _scheduler,
const FrameworkInfo& _framework,
const string& _master)
- : detector(NULL),
+ : detector(nullptr),
scheduler(_scheduler),
framework(_framework),
master(_master),
- process(NULL),
+ process(nullptr),
status(DRIVER_NOT_STARTED),
implicitAcknowlegements(true),
- credential(NULL),
+ credential(nullptr),
schedulerId("scheduler-" + UUID::random().toString())
{
initialize();
@@ -1750,11 +1750,11 @@ MesosSchedulerDriver::MesosSchedulerDriver(
const FrameworkInfo& _framework,
const string& _master,
const Credential& _credential)
- : detector(NULL),
+ : detector(nullptr),
scheduler(_scheduler),
framework(_framework),
master(_master),
- process(NULL),
+ process(nullptr),
status(DRIVER_NOT_STARTED),
implicitAcknowlegements(true),
credential(new Credential(_credential)),
@@ -1769,14 +1769,14 @@ MesosSchedulerDriver::MesosSchedulerDriver(
const FrameworkInfo& _framework,
const string& _master,
bool _implicitAcknowlegements)
- : detector(NULL),
+ : detector(nullptr),
scheduler(_scheduler),
framework(_framework),
master(_master),
- process(NULL),
+ process(nullptr),
status(DRIVER_NOT_STARTED),
implicitAcknowlegements(_implicitAcknowlegements),
- credential(NULL),
+ credential(nullptr),
schedulerId("scheduler-" + UUID::random().toString())
{
initialize();
@@ -1789,11 +1789,11 @@ MesosSchedulerDriver::MesosSchedulerDriver(
const string& _master,
bool _implicitAcknowlegements,
const Credential& _credential)
- : detector(NULL),
+ : detector(nullptr),
scheduler(_scheduler),
framework(_framework),
master(_master),
- process(NULL),
+ process(nullptr),
status(DRIVER_NOT_STARTED),
implicitAcknowlegements(_implicitAcknowlegements),
credential(new Credential(_credential)),
@@ -1820,7 +1820,7 @@ MesosSchedulerDriver::~MesosSchedulerDriver()
// to the user somehow. It might make sense to try and add some more
// debug output for the case where we wait indefinitely due to
// deadlock.
- if (process != NULL) {
+ if (process != nullptr) {
// We call 'terminate()' here to ensure that SchedulerProcess
// terminates even if the user forgot to call stop/abort on the
// driver.
@@ -1848,7 +1848,7 @@ Status MesosSchedulerDriver::start()
return status;
}
- if (detector == NULL) {
+ if (detector == nullptr) {
Try<shared_ptr<MasterDetector>> detector_ = DetectorPool::get(url);
if (detector_.isError()) {
@@ -1907,9 +1907,9 @@ Status MesosSchedulerDriver::start()
}
}
- CHECK(process == NULL);
+ CHECK(process == nullptr);
- if (credential == NULL) {
+ if (credential == nullptr) {
process = new SchedulerProcess(
this,
scheduler,
@@ -1954,10 +1954,10 @@ Status MesosSchedulerDriver::stop(bool failover)
return status;
}
- // 'process' might be NULL if the driver has failed to instantiate
+ // 'process' might be nullptr if the driver has failed to instantiate
// it due to bad parameters (e.g. error in creating the detector
// or loading flags).
- if (process != NULL) {
+ if (process != nullptr) {
process->running.store(false);
dispatch(process, &SchedulerProcess::stop, failover);
}
@@ -2007,7 +2007,7 @@ Status MesosSchedulerDriver::join()
// started properly. If it wasn't, we return the current status
// (which should either be DRIVER_NOT_STARTED or DRIVER_ABORTED).
synchronized (mutex) {
- if (process == NULL) {
+ if (process == nullptr) {
CHECK(status == DRIVER_NOT_STARTED || status == DRIVER_ABORTED);
return status;
@@ -2039,7 +2039,7 @@ Status MesosSchedulerDriver::killTask(const TaskID& taskId)
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(process, &SchedulerProcess::killTask, taskId);
@@ -2070,7 +2070,7 @@ Status MesosSchedulerDriver::launchTasks(
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(process, &SchedulerProcess::launchTasks, offerIds, tasks, filters);
@@ -2089,7 +2089,7 @@ Status MesosSchedulerDriver::acceptOffers(
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(
process,
@@ -2112,7 +2112,7 @@ Status MesosSchedulerDriver::declineOffer(
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(
process,
@@ -2132,7 +2132,7 @@ Status MesosSchedulerDriver::reviveOffers()
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(process, &SchedulerProcess::reviveOffers);
@@ -2148,7 +2148,7 @@ Status MesosSchedulerDriver::suppressOffers()
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(process, &SchedulerProcess::suppressOffers);
@@ -2171,7 +2171,7 @@ Status MesosSchedulerDriver::acknowledgeStatusUpdate(
" Implicit acknowledgements are enabled");
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(process, &SchedulerProcess::acknowledgeStatusUpdate, taskStatus);
@@ -2190,7 +2190,7 @@ Status MesosSchedulerDriver::sendFrameworkMessage(
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(process, &SchedulerProcess::sendFrameworkMessage,
executorId, slaveId, data);
@@ -2208,7 +2208,7 @@ Status MesosSchedulerDriver::reconcileTasks(
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(process, &SchedulerProcess::reconcileTasks, statuses);
@@ -2225,7 +2225,7 @@ Status MesosSchedulerDriver::requestResources(
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(process, &SchedulerProcess::requestResources, requests);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/scheduler/scheduler.cpp
----------------------------------------------------------------------
diff --git a/src/scheduler/scheduler.cpp b/src/scheduler/scheduler.cpp
index b66661b..c79837c 100644
--- a/src/scheduler/scheduler.cpp
+++ b/src/scheduler/scheduler.cpp
@@ -774,7 +774,7 @@ Mesos::Mesos(
Mesos::~Mesos()
{
- if (process != NULL) {
+ if (process != nullptr) {
stop();
}
}
@@ -794,12 +794,12 @@ void Mesos::reconnect()
void Mesos::stop()
{
- if (process != NULL) {
+ if (process != nullptr) {
terminate(process);
wait(process);
delete process;
- process = NULL;
+ process = nullptr;
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/container_logger.cpp
----------------------------------------------------------------------
diff --git a/src/slave/container_logger.cpp b/src/slave/container_logger.cpp
index 85b8c1d..3f4fa94 100644
--- a/src/slave/container_logger.cpp
+++ b/src/slave/container_logger.cpp
@@ -34,7 +34,7 @@ namespace slave {
Try<ContainerLogger*> ContainerLogger::create(const Option<string>& type)
{
- ContainerLogger* logger = NULL;
+ ContainerLogger* logger = nullptr;
if (type.isNone()) {
logger = new internal::slave::SandboxContainerLogger();
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/container_loggers/lib_logrotate.cpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/lib_logrotate.cpp b/src/slave/container_loggers/lib_logrotate.cpp
index 89d2bd0..d53847b 100644
--- a/src/slave/container_loggers/lib_logrotate.cpp
+++ b/src/slave/container_loggers/lib_logrotate.cpp
@@ -267,7 +267,7 @@ org_apache_mesos_LogrotateContainerLogger(
"Apache Mesos",
"modules@mesos.apache.org",
"Logrotate Container Logger module.",
- NULL,
+ nullptr,
[](const Parameters& parameters) -> ContainerLogger* {
// Convert `parameters` into a map.
std::map<std::string, std::string> values;
@@ -281,7 +281,7 @@ org_apache_mesos_LogrotateContainerLogger(
if (load.isError()) {
LOG(ERROR) << "Failed to parse parameters: " << load.error();
- return NULL;
+ return nullptr;
}
// Log any flag warnings.
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/container_loggers/logrotate.cpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/logrotate.cpp b/src/slave/container_loggers/logrotate.cpp
index 08abea9..b863d93 100644
--- a/src/slave/container_loggers/logrotate.cpp
+++ b/src/slave/container_loggers/logrotate.cpp
@@ -58,9 +58,9 @@ public:
virtual ~LogrotateLoggerProcess()
{
- if (buffer != NULL) {
+ if (buffer != nullptr) {
delete[] buffer;
- buffer = NULL;
+ buffer = nullptr;
}
if (leading.isSome()) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 7453e52..63efbe6 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -540,7 +540,7 @@ Try<Nothing> DockerContainerizerProcess::updatePersistentVolumes(
<< "' for persistent volume " << resource
<< " of container " << containerId;
- Try<Nothing> mount = fs::mount(source, target, None(), MS_BIND, NULL);
+ Try<Nothing> mount = fs::mount(source, target, None(), MS_BIND, nullptr);
if (mount.isError()) {
return Error(
"Failed to mount persistent volume from '" +
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp b/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
index 0b40627..35213ce 100644
--- a/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
+++ b/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
@@ -595,7 +595,7 @@ Future<Nothing> LinuxFilesystemIsolatorProcess::update(
<< "' for persistent volume " << resource
<< " of container " << containerId;
- Try<Nothing> mount = fs::mount(source, target, None(), MS_BIND, NULL);
+ Try<Nothing> mount = fs::mount(source, target, None(), MS_BIND, nullptr);
if (mount.isError()) {
return Failure(
"Failed to mount persistent volume from '" +
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/containerizer/mesos/isolators/namespaces/pid.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/namespaces/pid.cpp b/src/slave/containerizer/mesos/isolators/namespaces/pid.cpp
index 368fac7..bfc4698 100644
--- a/src/slave/containerizer/mesos/isolators/namespaces/pid.cpp
+++ b/src/slave/containerizer/mesos/isolators/namespaces/pid.cpp
@@ -199,7 +199,7 @@ Future<Nothing> NamespacesPidIsolatorProcess::isolate(
return Failure("Failed to create bind mount target: " + touch.error());
}
- Try<Nothing> mount = fs::mount(source, target, None(), MS_BIND, NULL);
+ Try<Nothing> mount = fs::mount(source, target, None(), MS_BIND, nullptr);
if (mount.isError()) {
return Failure(
"Failed to mount pid namespace handle from " +
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
index b9fcde4..106ff35 100644
--- a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
+++ b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
@@ -673,7 +673,7 @@ Future<Nothing> NetworkCniIsolatorProcess::isolate(
return Failure("Failed to create the bind mount point: " + touch.error());
}
- Try<Nothing> mount = fs::mount(source, target, None(), MS_BIND, NULL);
+ Try<Nothing> mount = fs::mount(source, target, None(), MS_BIND, nullptr);
if (mount.isError()) {
return Failure(
"Failed to mount the network namespace handle from '" +
@@ -1400,7 +1400,7 @@ int NetworkCniIsolatorSetup::execute()
"/",
None(),
MS_SLAVE | MS_REC,
- NULL);
+ nullptr);
if (mount.isError()) {
cerr << "Failed to mark `/` as a SLAVE mount: " << mount.error() << endl;
@@ -1435,7 +1435,7 @@ int NetworkCniIsolatorSetup::execute()
file,
None(),
MS_BIND,
- NULL);
+ nullptr);
if (mount.isError()) {
cerr << "Failed to bind mount from '" << source << "' to '"
@@ -1461,7 +1461,7 @@ int NetworkCniIsolatorSetup::execute()
target,
None(),
MS_BIND,
- NULL);
+ nullptr);
if (mount.isError()) {
cerr << "Failed to bind mount from '" << source << "' to '"
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp b/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
index 15fff94..5df5918 100644
--- a/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
+++ b/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
@@ -2418,7 +2418,7 @@ PortMappingIsolatorProcess::_recover(pid_t pid)
}
}
- Info* info = NULL;
+ Info* info = nullptr;
if (ephemeralPorts.empty()) {
// NOTE: This is possible because the slave may crash while
@@ -2564,7 +2564,7 @@ Future<Nothing> PortMappingIsolatorProcess::isolate(
return Failure("Failed to create the bind mount point: " + touch.error());
}
- Try<Nothing> mount = fs::mount(source, target, None(), MS_BIND, NULL);
+ Try<Nothing> mount = fs::mount(source, target, None(), MS_BIND, nullptr);
if (mount.isError()) {
return Failure(
"Failed to mount the network namespace handle from '" +
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/containerizer/mesos/launch.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launch.cpp b/src/slave/containerizer/mesos/launch.cpp
index 636921c..e6c83a3 100644
--- a/src/slave/containerizer/mesos/launch.cpp
+++ b/src/slave/containerizer/mesos/launch.cpp
@@ -298,14 +298,14 @@ int MesosContainerizerLaunch::execute()
if (command.get().shell()) {
// Execute the command using shell.
os::execlp(os::Shell::name, os::Shell::arg0,
- os::Shell::arg1, command.get().value().c_str(), (char*) NULL);
+ os::Shell::arg1, command.get().value().c_str(), (char*) nullptr);
} else {
// Use execvp to launch the command.
char** argv = new char*[command.get().arguments().size() + 1];
for (int i = 0; i < command.get().arguments().size(); i++) {
argv[i] = strdup(command.get().arguments(i).c_str());
}
- argv[command.get().arguments().size()] = NULL;
+ argv[command.get().arguments().size()] = nullptr;
execvp(command.get().value().c_str(), argv);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/containerizer/mesos/mount.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/mount.cpp b/src/slave/containerizer/mesos/mount.cpp
index bf17b01..dbd7853 100644
--- a/src/slave/containerizer/mesos/mount.cpp
+++ b/src/slave/containerizer/mesos/mount.cpp
@@ -69,7 +69,7 @@ int MesosContainerizerMount::execute()
flags.path.get(),
None(),
MS_SLAVE | MS_REC,
- NULL);
+ nullptr);
if (mount.isError()) {
cerr << "Failed to mark rslave with path '" << flags.path.get() << "': "
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/containerizer/mesos/provisioner/backends/bind.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/backends/bind.cpp b/src/slave/containerizer/mesos/provisioner/backends/bind.cpp
index ea7829b..af9544e 100644
--- a/src/slave/containerizer/mesos/provisioner/backends/bind.cpp
+++ b/src/slave/containerizer/mesos/provisioner/backends/bind.cpp
@@ -129,7 +129,7 @@ Future<Nothing> BindBackendProcess::provision(
rootfs,
None(),
MS_BIND,
- NULL);
+ nullptr);
if (mount.isError()) {
return Failure(
@@ -143,7 +143,7 @@ Future<Nothing> BindBackendProcess::provision(
rootfs,
None(),
MS_BIND | MS_RDONLY | MS_REMOUNT,
- NULL);
+ nullptr);
if (mount.isError()) {
return Failure(
@@ -157,7 +157,7 @@ Future<Nothing> BindBackendProcess::provision(
rootfs,
None(),
MS_SLAVE,
- NULL);
+ nullptr);
if (mount.isError()) {
return Failure(
@@ -170,7 +170,7 @@ Future<Nothing> BindBackendProcess::provision(
rootfs,
None(),
MS_SHARED,
- NULL);
+ nullptr);
if (mount.isError()) {
return Failure(
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/containerizer/mesos/provisioner/backends/overlay.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/backends/overlay.cpp b/src/slave/containerizer/mesos/provisioner/backends/overlay.cpp
index 86abf28..838c728 100644
--- a/src/slave/containerizer/mesos/provisioner/backends/overlay.cpp
+++ b/src/slave/containerizer/mesos/provisioner/backends/overlay.cpp
@@ -179,7 +179,7 @@ Future<Nothing> OverlayBackendProcess::provision(
rootfs,
None(),
MS_SLAVE,
- NULL);
+ nullptr);
if (mount.isError()) {
return Failure(
@@ -192,7 +192,7 @@ Future<Nothing> OverlayBackendProcess::provision(
rootfs,
None(),
MS_SHARED,
- NULL);
+ nullptr);
if (mount.isError()) {
return Failure(
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/containerizer/mesos/provisioner/provisioner.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/provisioner.cpp b/src/slave/containerizer/mesos/provisioner/provisioner.cpp
index 7540be6..4e3d3fa 100644
--- a/src/slave/containerizer/mesos/provisioner/provisioner.cpp
+++ b/src/slave/containerizer/mesos/provisioner/provisioner.cpp
@@ -109,7 +109,7 @@ Provisioner::Provisioner(Owned<ProvisionerProcess> _process)
Provisioner::~Provisioner()
{
- if (process.get() != NULL) {
+ if (process.get() != nullptr) {
terminate(process.get());
wait(process.get());
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/http.cpp
----------------------------------------------------------------------
diff --git a/src/slave/http.cpp b/src/slave/http.cpp
index b50775d..c4dfa8f 100644
--- a/src/slave/http.cpp
+++ b/src/slave/http.cpp
@@ -420,12 +420,12 @@ Future<Response> Slave::Http::executor(const Request& request) const
// We consolidate the framework/executor lookup logic here because
// it is common for all the call handlers.
Framework* framework = slave->getFramework(call.framework_id());
- if (framework == NULL) {
+ if (framework == nullptr) {
return BadRequest("Framework cannot be found");
}
Executor* executor = framework->getExecutor(call.executor_id());
- if (executor == NULL) {
+ if (executor == nullptr) {
return BadRequest("Executor cannot be found");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/posix_signalhandler.hpp
----------------------------------------------------------------------
diff --git a/src/slave/posix_signalhandler.hpp b/src/slave/posix_signalhandler.hpp
index 89ab29b..4a54117 100644
--- a/src/slave/posix_signalhandler.hpp
+++ b/src/slave/posix_signalhandler.hpp
@@ -21,11 +21,11 @@ namespace internal {
// Not using extern as this is used only by the executable. The signal handler
// should be configured once. Calling it multiple time or from multiple thread
// has undefined behavior.
-std::function<void(int, int)>* signaledWrapper = NULL;
+std::function<void(int, int)>* signaledWrapper = nullptr;
void signalHandler(int sig, siginfo_t* siginfo, void* context)
{
- if (signaledWrapper != NULL) {
+ if (signaledWrapper != nullptr) {
(*signaledWrapper)(sig, siginfo->si_uid);
}
}
@@ -47,7 +47,7 @@ int configureSignal(const std::function<void(int, int)>* signal)
action.sa_sigaction = signalHandler;
- return sigaction(SIGUSR1, &action, NULL);
+ return sigaction(SIGUSR1, &action, nullptr);
}
} // namespace internal {
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/qos_controllers/load.cpp
----------------------------------------------------------------------
diff --git a/src/slave/qos_controllers/load.cpp b/src/slave/qos_controllers/load.cpp
index 234ae1a..abc98fa 100644
--- a/src/slave/qos_controllers/load.cpp
+++ b/src/slave/qos_controllers/load.cpp
@@ -127,7 +127,7 @@ private:
LoadQoSController::~LoadQoSController()
{
- if (process.get() != NULL) {
+ if (process.get() != nullptr) {
terminate(process.get());
wait(process.get());
}
@@ -137,7 +137,7 @@ LoadQoSController::~LoadQoSController()
Try<Nothing> LoadQoSController::initialize(
const lambda::function<Future<ResourceUsage>()>& usage)
{
- if (process.get() != NULL) {
+ if (process.get() != nullptr) {
return Error("Load QoS Controller has already been initialized");
}
@@ -156,7 +156,7 @@ Try<Nothing> LoadQoSController::initialize(
process::Future<list<QoSCorrection>> LoadQoSController::corrections()
{
- if (process.get() == NULL) {
+ if (process.get() == nullptr) {
return Failure("Load QoS Controller is not initialized");
}
@@ -183,7 +183,7 @@ static QoSController* create(const Parameters& parameters)
if (thresholdParam.isError()) {
LOG(ERROR) << "Failed to parse 5 min load threshold: "
<< thresholdParam.error();
- return NULL;
+ return nullptr;
}
loadThreshold5Min = thresholdParam.get();
@@ -193,7 +193,7 @@ static QoSController* create(const Parameters& parameters)
if (thresholdParam.isError()) {
LOG(ERROR) << "Failed to parse 15 min load threshold: "
<< thresholdParam.error();
- return NULL;
+ return nullptr;
}
loadThreshold15Min = thresholdParam.get();
@@ -202,7 +202,7 @@ static QoSController* create(const Parameters& parameters)
if (loadThreshold5Min.isNone() && loadThreshold15Min.isNone()) {
LOG(ERROR) << "No load thresholds are configured for LoadQoSController";
- return NULL;
+ return nullptr;
}
return new mesos::internal::slave::LoadQoSController(
@@ -216,5 +216,5 @@ Module<QoSController> org_apache_mesos_LoadQoSController(
"Apache Mesos",
"modules@mesos.apache.org",
"System Load QoS Controller Module.",
- NULL,
+ nullptr,
create);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/qos_controllers/noop.cpp
----------------------------------------------------------------------
diff --git a/src/slave/qos_controllers/noop.cpp b/src/slave/qos_controllers/noop.cpp
index dc40f43..38b73bc 100644
--- a/src/slave/qos_controllers/noop.cpp
+++ b/src/slave/qos_controllers/noop.cpp
@@ -42,7 +42,7 @@ public:
NoopQoSController::~NoopQoSController()
{
- if (process.get() != NULL) {
+ if (process.get() != nullptr) {
terminate(process.get());
wait(process.get());
}
@@ -52,7 +52,7 @@ NoopQoSController::~NoopQoSController()
Try<Nothing> NoopQoSController::initialize(
const lambda::function<Future<ResourceUsage>()>& usage)
{
- if (process.get() != NULL) {
+ if (process.get() != nullptr) {
return Error("Noop QoS Controller has already been initialized");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/resource_estimators/fixed.cpp
----------------------------------------------------------------------
diff --git a/src/slave/resource_estimators/fixed.cpp b/src/slave/resource_estimators/fixed.cpp
index c858a48..767ba6a 100644
--- a/src/slave/resource_estimators/fixed.cpp
+++ b/src/slave/resource_estimators/fixed.cpp
@@ -78,7 +78,7 @@ public:
virtual ~FixedResourceEstimator()
{
- if (process.get() != NULL) {
+ if (process.get() != nullptr) {
terminate(process.get());
wait(process.get());
}
@@ -87,7 +87,7 @@ public:
virtual Try<Nothing> initialize(
const lambda::function<Future<ResourceUsage>()>& usage)
{
- if (process.get() != NULL) {
+ if (process.get() != nullptr) {
return Error("Fixed resource estimator has already been initialized");
}
@@ -99,7 +99,7 @@ public:
virtual Future<Resources> oversubscribable()
{
- if (process.get() == NULL) {
+ if (process.get() == nullptr) {
return Failure("Fixed resource estimator is not initialized");
}
@@ -129,7 +129,7 @@ static ResourceEstimator* create(const Parameters& parameters)
if (parameter.key() == "resources") {
Try<Resources> _resources = Resources::parse(parameter.value());
if (_resources.isError()) {
- return NULL;
+ return nullptr;
}
resources = _resources.get();
@@ -137,7 +137,7 @@ static ResourceEstimator* create(const Parameters& parameters)
}
if (resources.isNone()) {
- return NULL;
+ return nullptr;
}
return new FixedResourceEstimator(resources.get());
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/resource_estimators/noop.cpp
----------------------------------------------------------------------
diff --git a/src/slave/resource_estimators/noop.cpp b/src/slave/resource_estimators/noop.cpp
index 66c646d..ffc9a3e 100644
--- a/src/slave/resource_estimators/noop.cpp
+++ b/src/slave/resource_estimators/noop.cpp
@@ -40,7 +40,7 @@ public:
NoopResourceEstimator::~NoopResourceEstimator()
{
- if (process.get() != NULL) {
+ if (process.get() != nullptr) {
terminate(process.get());
wait(process.get());
}
@@ -50,7 +50,7 @@ NoopResourceEstimator::~NoopResourceEstimator()
Try<Nothing> NoopResourceEstimator::initialize(
const lambda::function<Future<ResourceUsage>()>& usage)
{
- if (process.get() != NULL) {
+ if (process.get() != nullptr) {
return Error("Noop resource estimator has already been initialized");
}
@@ -63,7 +63,7 @@ Try<Nothing> NoopResourceEstimator::initialize(
Future<Resources> NoopResourceEstimator::oversubscribable()
{
- if (process.get() == NULL) {
+ if (process.get() == nullptr) {
return Failure("Noop resource estimator is not initialized");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index c235c14..03a845e 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -161,7 +161,7 @@ Slave::Slave(const std::string& id,
metaDir(paths::getMetaRootDir(flags.work_dir)),
recoveryErrors(0),
credential(None()),
- authenticatee(NULL),
+ authenticatee(nullptr),
authenticating(None()),
authenticated(false),
reauthenticate(false),
@@ -366,7 +366,7 @@ void Slave::initialize()
}
if (flags.authenticate_http) {
- authentication::Authenticator* httpAuthenticator = NULL;
+ authentication::Authenticator* httpAuthenticator = nullptr;
if (httpAuthenticatorNames[0] == DEFAULT_HTTP_AUTHENTICATOR) {
// Load credentials for HTTP authentication.
@@ -427,7 +427,7 @@ void Slave::initialize()
httpAuthenticator = module.get();
}
- if (httpAuthenticator == NULL) {
+ if (httpAuthenticator == nullptr) {
EXIT(EXIT_FAILURE)
<< "An error occurred while initializing the '"
<< httpAuthenticatorNames[0] << "' HTTP authenticator";
@@ -1027,7 +1027,7 @@ void Slave::authenticate()
// communicating with it.
link(master.get());
- CHECK(authenticatee == NULL);
+ CHECK(authenticatee == nullptr);
if (authenticateeName == DEFAULT_AUTHENTICATEE) {
LOG(INFO) << "Using default CRAM-MD5 authenticatee";
@@ -1057,7 +1057,7 @@ void Slave::authenticate()
void Slave::_authenticate()
{
delete CHECK_NOTNULL(authenticatee);
- authenticatee = NULL;
+ authenticatee = nullptr;
CHECK_SOME(authenticating);
const Future<bool>& future = authenticating.get();
@@ -1298,7 +1298,7 @@ void Slave::reregistered(
bool known = false;
// Try to locate the task.
- if (framework != NULL) {
+ if (framework != nullptr) {
foreachkey (const ExecutorID& executorId, framework->pending) {
if (framework->pending[executorId].contains(taskId)) {
known = true;
@@ -1567,7 +1567,7 @@ void Slave::runTask(
// If we are about to create a new framework, unschedule the work
// and meta directories from getting gc'ed.
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
// Unschedule framework work directory.
string path = paths::getFrameworkPath(
flags.work_dir, info.id(), frameworkId);
@@ -1627,7 +1627,7 @@ void Slave::runTask(
// If we are about to create a new executor, unschedule the top
// level work and meta directories from getting gc'ed.
Executor* executor = framework->getExecutor(executorId);
- if (executor == NULL) {
+ if (executor == nullptr) {
// Unschedule executor work directory.
string path = paths::getExecutorPath(
flags.work_dir, info.id(), frameworkId, executorId);
@@ -1661,7 +1661,7 @@ void Slave::_runTask(
<< " for framework " << frameworkId;
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Ignoring run task " << task.task_id()
<< " because the framework " << frameworkId
<< " does not exist";
@@ -1841,7 +1841,7 @@ void Slave::_runTask(
// and queue the task until the executor has started.
Executor* executor = framework->getExecutor(executorId);
- if (executor == NULL) {
+ if (executor == nullptr) {
executor = framework->launchExecutor(executorInfo, task);
}
@@ -1959,7 +1959,7 @@ void Slave::runTasks(
containerizer->destroy(containerId);
Executor* executor = getExecutor(frameworkId, executorId);
- if (executor != NULL) {
+ if (executor != nullptr) {
containerizer::Termination termination;
termination.set_state(TASK_LOST);
termination.add_reasons(TaskStatus::REASON_CONTAINER_UPDATE_FAILED);
@@ -1976,7 +1976,7 @@ void Slave::runTasks(
}
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Ignoring sending queued tasks " << taskIds
<< " to executor '" << executorId
<< "' of framework " << frameworkId
@@ -1996,7 +1996,7 @@ void Slave::runTasks(
}
Executor* executor = framework->getExecutor(executorId);
- if (executor == NULL) {
+ if (executor == nullptr) {
LOG(WARNING) << "Ignoring sending queued tasks " << taskIds
<< " to executor '" << executorId
<< "' of framework " << frameworkId
@@ -2097,7 +2097,7 @@ void Slave::killTask(
}
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Ignoring kill task " << taskId
<< " of framework " << frameworkId
<< " because no such framework is running";
@@ -2145,7 +2145,7 @@ void Slave::killTask(
}
Executor* executor = framework->getExecutor(taskId);
- if (executor == NULL) {
+ if (executor == nullptr) {
LOG(WARNING) << "Cannot kill task " << taskId
<< " of framework " << frameworkId
<< " because no corresponding executor is running";
@@ -2275,7 +2275,7 @@ void Slave::shutdownFramework(
}
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Cannot shut down unknown framework " << frameworkId;
return;
}
@@ -2346,7 +2346,7 @@ void Slave::schedulerMessage(
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Dropping message from framework " << frameworkId
<< " because framework does not exist";
metrics.invalid_framework_messages++;
@@ -2365,7 +2365,7 @@ void Slave::schedulerMessage(
}
Executor* executor = framework->getExecutor(executorId);
- if (executor == NULL) {
+ if (executor == nullptr) {
LOG(WARNING) << "Dropping message for executor " << executorId
<< " because executor does not exist";
metrics.invalid_framework_messages++;
@@ -2418,7 +2418,7 @@ void Slave::updateFramework(
}
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Ignoring updating pid for framework " << frameworkId
<< " because it does not exist";
return;
@@ -2650,7 +2650,7 @@ void Slave::_statusUpdateAcknowledgement(
<< state;
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(ERROR) << "Status update acknowledgement (UUID: " << uuid
<< ") for task " << taskId
<< " of unknown framework " << frameworkId;
@@ -2663,7 +2663,7 @@ void Slave::_statusUpdateAcknowledgement(
// Find the executor that has this update.
Executor* executor = framework->getExecutor(taskId);
- if (executor == NULL) {
+ if (executor == nullptr) {
LOG(ERROR) << "Status update acknowledgement (UUID: " << uuid
<< ") for task " << taskId
<< " of unknown executor";
@@ -2896,7 +2896,7 @@ void Slave::registerExecutor(
}
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Shutting down executor '" << executorId
<< "' as the framework " << frameworkId
<< " does not exist";
@@ -2921,7 +2921,7 @@ void Slave::registerExecutor(
Executor* executor = framework->getExecutor(executorId);
// Check the status of the executor.
- if (executor == NULL) {
+ if (executor == nullptr) {
LOG(WARNING) << "Unexpected executor '" << executorId
<< "' registering for framework " << frameworkId;
reply(ShutdownExecutorMessage());
@@ -3174,7 +3174,7 @@ void Slave::_reregisterExecutor(
containerizer->destroy(containerId);
Executor* executor = getExecutor(frameworkId, executorId);
- if (executor != NULL) {
+ if (executor != nullptr) {
containerizer::Termination termination;
termination.set_state(TASK_LOST);
termination.add_reasons(TaskStatus::REASON_CONTAINER_UPDATE_FAILED);
@@ -3293,7 +3293,7 @@ void Slave::statusUpdate(StatusUpdate update, const Option<UPID>& pid)
}
Framework* framework = getFramework(update.framework_id());
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Ignoring status update " << update
<< " for unknown framework " << update.framework_id();
metrics.invalid_status_updates++;
@@ -3333,7 +3333,7 @@ void Slave::statusUpdate(StatusUpdate update, const Option<UPID>& pid)
const TaskStatus& status = update.status();
Executor* executor = framework->getExecutor(status.task_id());
- if (executor == NULL) {
+ if (executor == nullptr) {
LOG(WARNING) << "Could not find the executor for "
<< "status update " << update;
metrics.valid_status_updates++;
@@ -3445,7 +3445,7 @@ void Slave::_statusUpdate(
const TaskStatus& status = update.status();
Executor* executor = getExecutor(update.framework_id(), executorId);
- if (executor == NULL) {
+ if (executor == nullptr) {
LOG(WARNING) << "Ignoring container status update for framework "
<< update.framework_id()
<< "for a non-existent executor";
@@ -3513,7 +3513,7 @@ void Slave::__statusUpdate(
containerizer->destroy(containerId);
Executor* executor = getExecutor(update.framework_id(), executorId);
- if (executor != NULL) {
+ if (executor != nullptr) {
containerizer::Termination termination;
termination.set_state(TASK_LOST);
termination.add_reasons(TaskStatus::REASON_CONTAINER_UPDATE_FAILED);
@@ -3569,14 +3569,14 @@ void Slave::___statusUpdate(
} else {
// Acknowledge the HTTP based executor.
Framework* framework = getFramework(update.framework_id());
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Ignoring sending acknowledgement for status update "
<< update << " of unknown framework";
return;
}
Executor* executor = framework->getExecutor(update.status().task_id());
- if (executor == NULL) {
+ if (executor == nullptr) {
// Refer to the comments in 'statusUpdate()' on when this can
// happen.
LOG(WARNING) << "Ignoring sending acknowledgement for status update "
@@ -3616,22 +3616,22 @@ void Slave::forward(StatusUpdate update)
// Update the status update state of the task and include the latest
// state of the task in the status update.
Framework* framework = getFramework(update.framework_id());
- if (framework != NULL) {
+ if (framework != nullptr) {
const TaskID& taskId = update.status().task_id();
Executor* executor = framework->getExecutor(taskId);
- if (executor != NULL) {
+ if (executor != nullptr) {
// NOTE: We do not look for the task in queued tasks because
// no update is expected for it until it's launched. Similarly,
// we do not look for completed tasks because the state for a
// completed task shouldn't be changed.
- Task* task = NULL;
+ Task* task = nullptr;
if (executor->launchedTasks.contains(taskId)) {
task = executor->launchedTasks[taskId];
} else if (executor->terminatedTasks.contains(taskId)) {
task = executor->terminatedTasks[taskId];
}
- if (task != NULL) {
+ if (task != nullptr) {
// We set the status update state of the task here because in
// steady state master updates the status update state of the
// task when it receives this update. If the master fails over,
@@ -3691,7 +3691,7 @@ void Slave::executorMessage(
}
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Cannot send framework message from executor '"
<< executorId << "' to framework " << frameworkId
<< " because framework does not exist";
@@ -3797,7 +3797,7 @@ Framework* Slave::getFramework(const FrameworkID& frameworkId)
return frameworks[frameworkId];
}
- return NULL;
+ return nullptr;
}
@@ -3806,11 +3806,11 @@ Executor* Slave::getExecutor(
const ExecutorID& executorId)
{
Framework* framework = getFramework(frameworkId);
- if (framework != NULL) {
+ if (framework != nullptr) {
return framework->getExecutor(executorId);
}
- return NULL;
+ return nullptr;
}
@@ -4029,7 +4029,7 @@ void Slave::executorLaunched(
containerizer->destroy(containerId);
Executor* executor = getExecutor(frameworkId, executorId);
- if (executor != NULL) {
+ if (executor != nullptr) {
containerizer::Termination termination;
termination.set_state(TASK_FAILED);
termination.add_reasons(TaskStatus::REASON_CONTAINER_LAUNCH_FAILED);
@@ -4056,7 +4056,7 @@ void Slave::executorLaunched(
}
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Framework '" << frameworkId
<< "' for executor '" << executorId
<< "' is no longer valid";
@@ -4076,7 +4076,7 @@ void Slave::executorLaunched(
}
Executor* executor = framework->getExecutor(executorId);
- if (executor == NULL) {
+ if (executor == nullptr) {
LOG(WARNING) << "Killing unknown executor '" << executorId
<< "' of framework " << frameworkId;
containerizer->destroy(containerId);
@@ -4137,7 +4137,7 @@ void Slave::executorTerminated(
}
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Framework " << frameworkId
<< " for executor '" << executorId
<< "' does not exist";
@@ -4149,7 +4149,7 @@ void Slave::executorTerminated(
<< framework->state;
Executor* executor = framework->getExecutor(executorId);
- if (executor == NULL) {
+ if (executor == nullptr) {
LOG(WARNING) << "Executor '" << executorId
<< "' of framework " << frameworkId
<< " does not exist";
@@ -4396,7 +4396,7 @@ void Slave::shutdownExecutor(
}
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Cannot shut down executor '" << executorId
<< "' of unknown framework " << frameworkId;
return;
@@ -4489,7 +4489,7 @@ void Slave::shutdownExecutorTimeout(
const ContainerID& containerId)
{
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(INFO) << "Framework " << frameworkId
<< " seems to have exited. Ignoring shutdown timeout"
<< " for executor '" << executorId << "'";
@@ -4501,7 +4501,7 @@ void Slave::shutdownExecutorTimeout(
<< framework->state;
Executor* executor = framework->getExecutor(executorId);
- if (executor == NULL) {
+ if (executor == nullptr) {
VLOG(1) << "Executor '" << executorId
<< "' of framework " << frameworkId
<< " seems to have exited. Ignoring its shutdown timeout";
@@ -4540,7 +4540,7 @@ void Slave::registerExecutorTimeout(
const ContainerID& containerId)
{
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(INFO) << "Framework " << frameworkId
<< " seems to have exited. Ignoring registration timeout"
<< " for executor '" << executorId << "'";
@@ -4559,7 +4559,7 @@ void Slave::registerExecutorTimeout(
}
Executor* executor = framework->getExecutor(executorId);
- if (executor == NULL) {
+ if (executor == nullptr) {
VLOG(1) << "Executor '" << executorId
<< "' of framework " << frameworkId
<< " seems to have exited. Ignoring its registration timeout";
@@ -5118,7 +5118,7 @@ void Slave::_qosCorrections(const Future<list<QoSCorrection>>& future)
const ExecutorID& executorId = kill.executor_id();
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Ignoring QoS correction KILL on framework "
<< frameworkId << ": framework cannot be found";
continue;
@@ -5136,7 +5136,7 @@ void Slave::_qosCorrections(const Future<list<QoSCorrection>>& future)
}
Executor* executor = framework->getExecutor(executorId);
- if (executor == NULL) {
+ if (executor == nullptr) {
LOG(WARNING) << "Ignoring QoS correction KILL on executor '"
<< executorId << "' of framework " << frameworkId
<< ": executor cannot be found";
@@ -5796,7 +5796,7 @@ Executor* Framework::getExecutor(const ExecutorID& executorId)
return executors[executorId];
}
- return NULL;
+ return nullptr;
}
@@ -5809,7 +5809,7 @@ Executor* Framework::getExecutor(const TaskID& taskId)
return executor;
}
}
- return NULL;
+ return nullptr;
}
@@ -6031,7 +6031,7 @@ void Executor::terminateTask(
{
VLOG(1) << "Terminating task " << taskId;
- Task* task = NULL;
+ Task* task = nullptr;
// Remove the task if it's queued.
if (queuedTasks.contains(taskId)) {
task = new Task(
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/status_update_manager.cpp
----------------------------------------------------------------------
diff --git a/src/slave/status_update_manager.cpp b/src/slave/status_update_manager.cpp
index f3b4767..0e9891c 100644
--- a/src/slave/status_update_manager.cpp
+++ b/src/slave/status_update_manager.cpp
@@ -322,7 +322,7 @@ Future<Nothing> StatusUpdateManagerProcess::_update(
// Write the status update to disk and enqueue it to send it to the master.
// Create/Get the status update stream for this task.
StatusUpdateStream* stream = getStatusUpdateStream(taskId, frameworkId);
- if (stream == NULL) {
+ if (stream == nullptr) {
stream = createStatusUpdateStream(
taskId, frameworkId, slaveId, checkpoint, executorId, containerId);
}
@@ -397,7 +397,7 @@ Future<bool> StatusUpdateManagerProcess::acknowledgement(
// This might happen if we haven't completed recovery yet or if the
// acknowledgement is for a stream that has been cleaned up.
- if (stream == NULL) {
+ if (stream == nullptr) {
return Failure(
"Cannot find the status update stream for task " + stringify(taskId) +
" of framework " + stringify(frameworkId));
@@ -510,11 +510,11 @@ StatusUpdateStream* StatusUpdateManagerProcess::getStatusUpdateStream(
const FrameworkID& frameworkId)
{
if (!streams.contains(frameworkId)) {
- return NULL;
+ return nullptr;
}
if (!streams[frameworkId].contains(taskId)) {
- return NULL;
+ return nullptr;
}
return streams[frameworkId][taskId];
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/slave/windows_ctrlhandler.hpp
----------------------------------------------------------------------
diff --git a/src/slave/windows_ctrlhandler.hpp b/src/slave/windows_ctrlhandler.hpp
index e36a1f4..9481e0f 100644
--- a/src/slave/windows_ctrlhandler.hpp
+++ b/src/slave/windows_ctrlhandler.hpp
@@ -23,7 +23,7 @@ namespace internal {
// Not using extern as this is used only by the executable. The signal handler
// should be configured once. Calling it multiple time or from multiple thread
// has undefined behavior.
-std::function<void(int, int)>* signaledWrapper = NULL;
+std::function<void(int, int)>* signaledWrapper = nullptr;
BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
{
@@ -34,7 +34,7 @@ BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
case CTRL_BREAK_EVENT:
case CTRL_LOGOFF_EVENT:
case CTRL_SHUTDOWN_EVENT: {
- if (signaledWrapper != NULL) {
+ if (signaledWrapper != nullptr) {
(*signaledWrapper)(SIGUSR1, 0);
return TRUE;
}
@@ -48,12 +48,12 @@ BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
int installCtrlHandler(const std::function<void(int, int)>* signal)
{
- if (signal != NULL) {
+ if (signal != nullptr) {
signaledWrapper = new std::function<void(int, int)>(*signal);
return SetConsoleCtrlHandler(CtrlHandler, TRUE);
} else {
delete signaledWrapper;
- signaledWrapper = NULL;
+ signaledWrapper = nullptr;
return SetConsoleCtrlHandler(CtrlHandler, FALSE);
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/state/leveldb.cpp
----------------------------------------------------------------------
diff --git a/src/state/leveldb.cpp b/src/state/leveldb.cpp
index 60c18dd..6cd8655 100644
--- a/src/state/leveldb.cpp
+++ b/src/state/leveldb.cpp
@@ -78,12 +78,12 @@ private:
LevelDBStorageProcess::LevelDBStorageProcess(const string& _path)
- : path(_path), db(NULL) {}
+ : path(_path), db(nullptr) {}
LevelDBStorageProcess::~LevelDBStorageProcess()
{
- delete db; // NULL if open failed in LevelDBStorageProcess::initialize.
+ delete db; // nullptr if open failed in LevelDBStorageProcess::initialize.
}
@@ -99,7 +99,7 @@ void LevelDBStorageProcess::initialize()
error = status.ToString();
} else {
// TODO(benh): Conditionally compact to avoid long recovery times?
- db->CompactRange(NULL, NULL);
+ db->CompactRange(nullptr, nullptr);
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/state/zookeeper.cpp
----------------------------------------------------------------------
diff --git a/src/state/zookeeper.cpp b/src/state/zookeeper.cpp
index 1596637..1ba700e 100644
--- a/src/state/zookeeper.cpp
+++ b/src/state/zookeeper.cpp
@@ -186,8 +186,8 @@ ZooKeeperStorageProcess::ZooKeeperStorageProcess(
acl(_auth.isSome()
? zookeeper::EVERYONE_READ_CREATOR_ALL
: ZOO_OPEN_ACL_UNSAFE),
- watcher(NULL),
- zk(NULL),
+ watcher(nullptr),
+ zk(nullptr),
state(DISCONNECTED)
{}
@@ -508,7 +508,7 @@ Result<bool> ZooKeeperStorageProcess::doSet(const Entry& entry,
string prefix = znode.substr(0, index);
// Create the znode (even if it already exists).
- code = zk->create(prefix, "", acl, 0, NULL);
+ code = zk->create(prefix, "", acl, 0, nullptr);
if (code == ZINVALIDSTATE || (code != ZOK && zk->retryable(code))) {
CHECK(zk->getState() != ZOO_AUTH_FAILED_STATE);
@@ -520,7 +520,7 @@ Result<bool> ZooKeeperStorageProcess::doSet(const Entry& entry,
}
}
- code = zk->create(znode + "/" + entry.name(), data, acl, 0, NULL);
+ code = zk->create(znode + "/" + entry.name(), data, acl, 0, nullptr);
if (code == ZNODEEXISTS) {
return false; // Lost a race with someone else.
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/containerizer/cgroups_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/cgroups_tests.cpp b/src/tests/containerizer/cgroups_tests.cpp
index 4cb3d61..d766f0f 100644
--- a/src/tests/containerizer/cgroups_tests.cpp
+++ b/src/tests/containerizer/cgroups_tests.cpp
@@ -931,7 +931,7 @@ TEST_F(CgroupsAnyHierarchyWithFreezerTest, ROOT_CGROUPS_DestroyTracedProcess)
ASSERT_SOME(assign);
// Attach to the child process.
- ASSERT_EQ(0, ptrace(PT_ATTACH, pid, NULL, NULL));
+ ASSERT_EQ(0, ptrace(PT_ATTACH, pid, nullptr, nullptr));
// Wait until the process is in traced state ('t' or 'T').
Duration elapsed = Duration::zero();
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/containerizer/memory_test_helper.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/memory_test_helper.cpp b/src/tests/containerizer/memory_test_helper.cpp
index a8fdc19..e850b37 100644
--- a/src/tests/containerizer/memory_test_helper.cpp
+++ b/src/tests/containerizer/memory_test_helper.cpp
@@ -86,7 +86,7 @@ static Try<void*> allocateRSS(const Bytes& size)
}
#endif
- void* rss = NULL;
+ void* rss = nullptr;
if (posix_memalign(&rss, os::pagesize(), size.bytes()) != 0) {
return ErrnoError("Failed to increase RSS memory, posix_memalign");
}
@@ -230,7 +230,7 @@ void MemoryTestHelper::cleanup()
// it's stuck, but we don't care about its status. Any error
// should have been logged in the subprocess directly.
::kill(s.get().pid(), SIGKILL);
- ::waitpid(s.get().pid(), NULL, 0);
+ ::waitpid(s.get().pid(), nullptr, 0);
s = None();
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/containerizer/routing_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/routing_tests.cpp b/src/tests/containerizer/routing_tests.cpp
index 4ebb012..f329874 100644
--- a/src/tests/containerizer/routing_tests.cpp
+++ b/src/tests/containerizer/routing_tests.cpp
@@ -303,7 +303,7 @@ TEST_F(RoutingVethTest, ROOT_LinkCreatePid)
// Stack used in the child process.
unsigned long long stack[32];
- pid_t pid = ::clone(child, &stack[31], CLONE_NEWNET | SIGCHLD, NULL);
+ pid_t pid = ::clone(child, &stack[31], CLONE_NEWNET | SIGCHLD, nullptr);
ASSERT_NE(-1, pid);
// In parent process.
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/environment.cpp
----------------------------------------------------------------------
diff --git a/src/tests/environment.cpp b/src/tests/environment.cpp
index 011451b..849e9ce 100644
--- a/src/tests/environment.cpp
+++ b/src/tests/environment.cpp
@@ -95,7 +95,7 @@ public:
if (strings::contains(test->test_case_name(), pattern) ||
strings::contains(test->name(), pattern)) {
return true;
- } else if (test->type_param() != NULL &&
+ } else if (test->type_param() != nullptr &&
strings::contains(test->type_param(), pattern)) {
return true;
}
@@ -782,7 +782,7 @@ void Environment::SetUp()
{
// Clear any MESOS_ environment variables so they don't affect our tests.
char** environ = os::raw::environment();
- for (int i = 0; environ[i] != NULL; i++) {
+ for (int i = 0; environ[i] != nullptr; i++) {
string variable = environ[i];
if (variable.find("MESOS_") == 0) {
string key;
@@ -866,7 +866,7 @@ Try<string> Environment::TemporaryDirectoryEventListener::mkdtemp()
const ::testing::TestInfo* const testInfo =
::testing::UnitTest::GetInstance()->current_test_info();
- if (testInfo == NULL) {
+ if (testInfo == nullptr) {
return Error("Failed to determine the current test information");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/group_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/group_tests.cpp b/src/tests/group_tests.cpp
index 83fca11..193a158 100644
--- a/src/tests/group_tests.cpp
+++ b/src/tests/group_tests.cpp
@@ -301,7 +301,7 @@ TEST_F(GroupTest, GroupPathWithRestrictivePerms)
"42",
zookeeper::EVERYONE_READ_CREATOR_ALL,
0,
- NULL);
+ nullptr);
ASSERT_ZK_GET("42", &authenticatedZk, "/read-only");
@@ -310,7 +310,7 @@ TEST_F(GroupTest, GroupPathWithRestrictivePerms)
"37",
ZOO_OPEN_ACL_UNSAFE,
0,
- NULL);
+ nullptr);
ASSERT_ZK_GET("37", &authenticatedZk, "/read-only/writable");
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/master_contender_detector_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_contender_detector_tests.cpp b/src/tests/master_contender_detector_tests.cpp
index ef4786f..2970986 100644
--- a/src/tests/master_contender_detector_tests.cpp
+++ b/src/tests/master_contender_detector_tests.cpp
@@ -311,7 +311,7 @@ TEST_F(ZooKeeperMasterContenderDetectorTest, ContenderPendingElection)
EXPECT_TRUE(contended.isPending());
- process::filter(NULL);
+ process::filter(nullptr);
process::TestsFilter* filter =
process::FilterTestEventListener::instance()->install();
@@ -440,7 +440,7 @@ TEST_F(ZooKeeperMasterContenderDetectorTest, NonRetryableFrrors)
"42",
(ACL_vector) {1, onlyCreatorCanAccess},
0,
- NULL);
+ nullptr);
ASSERT_ZK_GET("42", &authenticatedZk, "/test");
// group3 cannot read the base path thus detector should fail.
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index 51d223a..e7792fd 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -73,7 +73,7 @@ namespace internal {
namespace tests {
#ifdef MESOS_HAS_JAVA
-ZooKeeperTestServer* MesosZooKeeperTest::server = NULL;
+ZooKeeperTestServer* MesosZooKeeperTest::server = nullptr;
Option<zookeeper::URL> MesosZooKeeperTest::url;
#endif // MESOS_HAS_JAVA
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 259c24d..6f28880 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -288,7 +288,7 @@ public:
static void TearDownTestCase()
{
delete server;
- server = NULL;
+ server = nullptr;
}
virtual void SetUp()
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/tests/module_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/module_tests.cpp b/src/tests/module_tests.cpp
index 54a22e3..6e003e5 100644
--- a/src/tests/module_tests.cpp
+++ b/src/tests/module_tests.cpp
@@ -112,7 +112,7 @@ protected:
DynamicLibrary ModuleTest::dynamicLibrary;
-ModuleBase* ModuleTest::moduleBase = NULL;
+ModuleBase* ModuleTest::moduleBase = nullptr;
Modules getModules(
[4/4] mesos git commit: Replaced `NULL` with `nullptr` in mesos.
Posted by mp...@apache.org.
Replaced `NULL` with `nullptr` in mesos.
`find . -name "*.[hc]pp" | xargs -P 4 sed -i 's/\bNULL\b/nullptr/g'`
Review: https://reviews.apache.org/r/44843/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/686e5013
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/686e5013
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/686e5013
Branch: refs/heads/master
Commit: 686e5013b378d440ff11577a425b3bfc892c0c3c
Parents: 39cd667
Author: Tomasz Janiszewski <ja...@gmail.com>
Authored: Sat Jun 4 12:00:12 2016 -0700
Committer: Michael Park <mp...@apache.org>
Committed: Sat Jun 4 13:49:50 2016 -0700
----------------------------------------------------------------------
src/authentication/cram_md5/authenticatee.cpp | 47 ++--
src/authentication/cram_md5/authenticator.cpp | 57 ++---
src/authentication/cram_md5/auxprop.cpp | 26 +-
src/authorizer/local/authorizer.cpp | 8 +-
src/examples/balloon_executor.cpp | 2 +-
src/examples/example_module_impl.cpp | 2 +-
src/examples/load_generator_framework.cpp | 8 +-
src/examples/test_allocator_module.cpp | 4 +-
src/examples/test_anonymous_module.cpp | 2 +-
src/examples/test_authorizer_module.cpp | 4 +-
src/examples/test_container_logger_module.cpp | 4 +-
src/examples/test_hook_module.cpp | 2 +-
src/examples/test_http_authenticator_module.cpp | 4 +-
src/examples/test_isolator_module.cpp | 6 +-
src/examples/test_master_contender_module.cpp | 2 +-
src/examples/test_master_detector_module.cpp | 2 +-
src/examples/test_qos_controller_module.cpp | 4 +-
src/examples/test_resource_estimator_module.cpp | 4 +-
src/exec/exec.cpp | 16 +-
src/files/files.hpp | 6 +-
src/java/jni/construct.cpp | 30 +--
src/java/jni/convert.cpp | 34 +--
src/java/jni/org_apache_mesos_Log.cpp | 26 +-
.../org_apache_mesos_MesosExecutorDriver.cpp | 20 +-
.../org_apache_mesos_MesosSchedulerDriver.cpp | 30 +--
.../org_apache_mesos_state_AbstractState.cpp | 44 ++--
.../jni/org_apache_mesos_state_Variable.cpp | 2 +-
.../org_apache_mesos_state_ZooKeeperState.cpp | 8 +-
src/jvm/jvm.cpp | 20 +-
src/jvm/jvm.hpp | 22 +-
src/jvm/org/apache/zookeeper.hpp | 2 +-
src/launcher/executor.cpp | 8 +-
src/linux/cgroups.cpp | 8 +-
src/linux/fs.cpp | 28 ++-
src/linux/fs.hpp | 4 +-
src/linux/perf.cpp | 2 +-
src/linux/routing/diagnosis/diagnosis.cpp | 6 +-
src/linux/routing/filter/internal.hpp | 20 +-
src/linux/routing/internal.hpp | 4 +-
src/linux/routing/link/internal.hpp | 8 +-
src/linux/routing/queueing/internal.hpp | 6 +-
src/linux/routing/route.cpp | 8 +-
src/linux/systemd.cpp | 4 +-
src/local/local.cpp | 62 ++---
src/local/local.hpp | 2 +-
src/log/leveldb.cpp | 4 +-
src/log/log.cpp | 10 +-
src/log/tool/benchmark.cpp | 2 +-
src/log/tool/benchmark.hpp | 2 +-
src/log/tool/initialize.cpp | 2 +-
src/log/tool/initialize.hpp | 2 +-
src/log/tool/read.cpp | 2 +-
src/log/tool/read.hpp | 2 +-
src/log/tool/replica.cpp | 2 +-
src/log/tool/replica.hpp | 2 +-
src/logging/logging.cpp | 2 +-
src/master/allocator/mesos/hierarchical.hpp | 4 +-
src/master/contender/standalone.cpp | 4 +-
src/master/contender/standalone.hpp | 2 +-
src/master/contender/zookeeper.cpp | 4 +-
src/master/http.cpp | 16 +-
src/master/main.cpp | 4 +-
src/master/master.cpp | 114 ++++-----
src/master/master.hpp | 10 +-
src/master/validation.cpp | 14 +-
src/module/manager.cpp | 14 +-
src/module/manager.hpp | 4 +-
.../executor/mesos_executor_driver_impl.cpp | 82 +++---
.../executor/src/mesos/executor/module.cpp | 6 +-
.../src/mesos/executor/proxy_executor.cpp | 50 ++--
src/python/native_common/common.hpp | 18 +-
.../scheduler/mesos_scheduler_driver_impl.cpp | 248 +++++++++----------
.../scheduler/src/mesos/scheduler/module.cpp | 6 +-
.../src/mesos/scheduler/proxy_scheduler.cpp | 82 +++---
src/sched/sched.cpp | 62 ++---
src/scheduler/scheduler.cpp | 6 +-
src/slave/container_logger.cpp | 2 +-
src/slave/container_loggers/lib_logrotate.cpp | 4 +-
src/slave/container_loggers/logrotate.cpp | 4 +-
src/slave/containerizer/docker.cpp | 2 +-
.../mesos/isolators/filesystem/linux.cpp | 2 +-
.../mesos/isolators/namespaces/pid.cpp | 2 +-
.../mesos/isolators/network/cni/cni.cpp | 8 +-
.../mesos/isolators/network/port_mapping.cpp | 4 +-
src/slave/containerizer/mesos/launch.cpp | 4 +-
src/slave/containerizer/mesos/mount.cpp | 2 +-
.../mesos/provisioner/backends/bind.cpp | 8 +-
.../mesos/provisioner/backends/overlay.cpp | 4 +-
.../mesos/provisioner/provisioner.cpp | 2 +-
src/slave/http.cpp | 4 +-
src/slave/posix_signalhandler.hpp | 6 +-
src/slave/qos_controllers/load.cpp | 14 +-
src/slave/qos_controllers/noop.cpp | 4 +-
src/slave/resource_estimators/fixed.cpp | 10 +-
src/slave/resource_estimators/noop.cpp | 6 +-
src/slave/slave.cpp | 106 ++++----
src/slave/status_update_manager.cpp | 8 +-
src/slave/windows_ctrlhandler.hpp | 8 +-
src/state/leveldb.cpp | 6 +-
src/state/zookeeper.cpp | 8 +-
src/tests/containerizer/cgroups_tests.cpp | 2 +-
src/tests/containerizer/memory_test_helper.cpp | 4 +-
src/tests/containerizer/routing_tests.cpp | 2 +-
src/tests/environment.cpp | 6 +-
src/tests/group_tests.cpp | 4 +-
src/tests/master_contender_detector_tests.cpp | 4 +-
src/tests/mesos.cpp | 2 +-
src/tests/mesos.hpp | 2 +-
src/tests/module_tests.cpp | 2 +-
src/tests/registrar_tests.cpp | 8 +-
src/tests/script.cpp | 6 +-
src/tests/slave_tests.cpp | 4 +-
src/tests/state_tests.cpp | 20 +-
src/tests/zookeeper.hpp | 2 +-
src/tests/zookeeper_test_server.cpp | 8 +-
src/tests/zookeeper_tests.cpp | 10 +-
src/zookeeper/group.cpp | 16 +-
src/zookeeper/zookeeper.cpp | 22 +-
118 files changed, 879 insertions(+), 873 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/authentication/cram_md5/authenticatee.cpp
----------------------------------------------------------------------
diff --git a/src/authentication/cram_md5/authenticatee.cpp b/src/authentication/cram_md5/authenticatee.cpp
index 7d49943..236de25 100644
--- a/src/authentication/cram_md5/authenticatee.cpp
+++ b/src/authentication/cram_md5/authenticatee.cpp
@@ -60,7 +60,7 @@ public:
credential(_credential),
client(_client),
status(READY),
- connection(NULL)
+ connection(nullptr)
{
const char* data = credential.secret().data();
size_t length = credential.secret().length();
@@ -69,7 +69,7 @@ public:
// expecting the data appended to the end of the struct. *sigh*
secret = (sasl_secret_t*) malloc(sizeof(sasl_secret_t) + length);
- CHECK(secret != NULL) << "Failed to allocate memory for secret";
+ CHECK(secret != nullptr) << "Failed to allocate memory for secret";
memcpy(secret->data, data, length);
secret->len = length;
@@ -77,7 +77,7 @@ public:
virtual ~CRAMMD5AuthenticateeProcess()
{
- if (connection != NULL) {
+ if (connection != nullptr) {
sasl_dispose(&connection);
}
free(secret);
@@ -95,10 +95,10 @@ public:
if (!initialize->once()) {
LOG(INFO) << "Initializing client SASL";
- int result = sasl_client_init(NULL);
+ int result = sasl_client_init(nullptr);
if (result != SASL_OK) {
status = ERROR;
- string error(sasl_errstring(result, NULL, NULL));
+ string error(sasl_errstring(result, nullptr, nullptr));
promise.fail("Failed to initialize SASL: " + error);
initialize->done();
return promise.future();
@@ -121,8 +121,8 @@ public:
LOG(INFO) << "Creating new client SASL connection";
callbacks[0].id = SASL_CB_GETREALM;
- callbacks[0].proc = NULL;
- callbacks[0].context = NULL;
+ callbacks[0].proc = nullptr;
+ callbacks[0].context = nullptr;
callbacks[1].id = SASL_CB_USER;
callbacks[1].proc = (int(*)()) &user;
@@ -144,13 +144,14 @@ public:
callbacks[3].context = (void*) secret;
callbacks[4].id = SASL_CB_LIST_END;
- callbacks[4].proc = NULL;
- callbacks[4].context = NULL;
+ callbacks[4].proc = nullptr;
+ callbacks[4].context = nullptr;
int result = sasl_client_new(
"mesos", // Registered name of service.
- NULL, // Server's FQDN.
- NULL, NULL, // IP Address information strings.
+ nullptr, // Server's FQDN.
+ nullptr, // IP Address information string.
+ nullptr, // IP Address information string.
callbacks, // Callbacks supported only for this connection.
0, // Security flags (security layers are enabled
// using security properties, separately).
@@ -158,7 +159,7 @@ public:
if (result != SASL_OK) {
status = ERROR;
- string error(sasl_errstring(result, NULL, NULL));
+ string error(sasl_errstring(result, nullptr, nullptr));
promise.fail("Failed to create client SASL connection: " + error);
return promise.future();
}
@@ -212,10 +213,10 @@ protected:
LOG(INFO) << "Received SASL authentication mechanisms: "
<< strings::join(",", mechanisms);
- sasl_interact_t* interact = NULL;
- const char* output = NULL;
+ sasl_interact_t* interact = nullptr;
+ const char* output = nullptr;
unsigned length = 0;
- const char* mechanism = NULL;
+ const char* mechanism = nullptr;
int result = sasl_client_start(
connection,
@@ -257,13 +258,13 @@ protected:
LOG(INFO) << "Received SASL authentication step";
- sasl_interact_t* interact = NULL;
- const char* output = NULL;
+ sasl_interact_t* interact = nullptr;
+ const char* output = nullptr;
unsigned length = 0;
int result = sasl_client_step(
connection,
- data.length() == 0 ? NULL : data.data(),
+ data.length() == 0 ? nullptr : data.data(),
data.length(),
&interact,
&output,
@@ -276,7 +277,7 @@ protected:
// We don't start the client with SASL_SUCCESS_DATA so we may
// need to send one more "empty" message to the server.
AuthenticationStepMessage message;
- if (output != NULL && length > 0) {
+ if (output != nullptr && length > 0) {
message.set_data(output, length);
}
reply(message);
@@ -328,7 +329,7 @@ private:
{
CHECK(SASL_CB_USER == id || SASL_CB_AUTHNAME == id);
*result = static_cast<const char*>(context);
- if (length != NULL) {
+ if (length != nullptr) {
*length = strlen(*result);
}
return SASL_OK;
@@ -377,12 +378,12 @@ Try<Authenticatee*> CRAMMD5Authenticatee::create()
}
-CRAMMD5Authenticatee::CRAMMD5Authenticatee() : process(NULL) {}
+CRAMMD5Authenticatee::CRAMMD5Authenticatee() : process(nullptr) {}
CRAMMD5Authenticatee::~CRAMMD5Authenticatee()
{
- if (process != NULL) {
+ if (process != nullptr) {
terminate(process);
wait(process);
delete process;
@@ -401,7 +402,7 @@ Future<bool> CRAMMD5Authenticatee::authenticate(
return false;
}
- CHECK(process == NULL);
+ CHECK(process == nullptr);
process = new CRAMMD5AuthenticateeProcess(credential, client);
spawn(process);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/authentication/cram_md5/authenticator.cpp
----------------------------------------------------------------------
diff --git a/src/authentication/cram_md5/authenticator.cpp b/src/authentication/cram_md5/authenticator.cpp
index 027eba4..4ec1568 100644
--- a/src/authentication/cram_md5/authenticator.cpp
+++ b/src/authentication/cram_md5/authenticator.cpp
@@ -62,11 +62,11 @@ public:
: ProcessBase(ID::generate("crammd5_authenticator_session")),
status(READY),
pid(_pid),
- connection(NULL) {}
+ connection(nullptr) {}
virtual ~CRAMMD5AuthenticatorSessionProcess()
{
- if (connection != NULL) {
+ if (connection != nullptr) {
sasl_dispose(&connection);
}
}
@@ -84,7 +84,7 @@ public:
callbacks[0].id = SASL_CB_GETOPT;
callbacks[0].proc = (int(*)()) &getopt;
- callbacks[0].context = NULL;
+ callbacks[0].context = nullptr;
callbacks[1].id = SASL_CB_CANON_USER;
callbacks[1].proc = (int(*)()) &canonicalize;
@@ -92,18 +92,19 @@ public:
callbacks[1].context = &principal;
callbacks[2].id = SASL_CB_LIST_END;
- callbacks[2].proc = NULL;
- callbacks[2].context = NULL;
+ callbacks[2].proc = nullptr;
+ callbacks[2].context = nullptr;
LOG(INFO) << "Creating new server SASL connection";
int result = sasl_server_new(
"mesos", // Registered name of service.
- NULL, // Server's FQDN; NULL uses gethostname().
- NULL, // The user realm used for password lookups;
- // NULL means default to FQDN.
+ nullptr, // Server's FQDN; nullptr uses gethostname().
+ nullptr, // The user realm used for password lookups;
+ // nullptr means default to FQDN.
// NOTE: This does not affect Kerberos.
- NULL, NULL, // IP address information strings.
+ nullptr, // IP address information string.
+ nullptr, // IP address information string.
callbacks, // Callbacks supported only for this connection.
0, // Security flags (security layers are enabled
// using security properties, separately).
@@ -111,7 +112,7 @@ public:
if (result != SASL_OK) {
string error = "Failed to create server SASL connection: ";
- error += sasl_errstring(result, NULL, NULL);
+ error += sasl_errstring(result, nullptr, nullptr);
LOG(ERROR) << error;
AuthenticationErrorMessage message;
message.set_error(error);
@@ -122,13 +123,13 @@ public:
}
// Get the list of mechanisms.
- const char* output = NULL;
+ const char* output = nullptr;
unsigned length = 0;
int count = 0;
result = sasl_listmech(
connection, // The context for this connection.
- NULL, // Not supported.
+ nullptr, // Not supported.
"", // What to prepend to the output string.
",", // What to separate mechanisms with.
"", // What to append to the output string.
@@ -138,7 +139,7 @@ public:
if (result != SASL_OK) {
string error = "Failed to get list of mechanisms: ";
- LOG(WARNING) << error << sasl_errstring(result, NULL, NULL);
+ LOG(WARNING) << error << sasl_errstring(result, nullptr, nullptr);
AuthenticationErrorMessage message;
error += sasl_errdetail(connection);
message.set_error(error);
@@ -203,13 +204,13 @@ public:
LOG(INFO) << "Received SASL authentication start";
// Start the server.
- const char* output = NULL;
+ const char* output = nullptr;
unsigned length = 0;
int result = sasl_server_start(
connection,
mechanism.c_str(),
- data.length() == 0 ? NULL : data.data(),
+ data.length() == 0 ? nullptr : data.data(),
data.length(),
&output,
&length);
@@ -230,12 +231,12 @@ public:
LOG(INFO) << "Received SASL authentication step";
- const char* output = NULL;
+ const char* output = nullptr;
unsigned length = 0;
int result = sasl_server_step(
connection,
- data.length() == 0 ? NULL : data.data(),
+ data.length() == 0 ? nullptr : data.data(),
data.length(),
&output,
&length);
@@ -269,7 +270,7 @@ private:
found = true;
}
- if (found && length != NULL) {
+ if (found && length != nullptr) {
*length = strlen(*result);
}
@@ -317,7 +318,7 @@ private:
LOG(INFO) << "Authentication success";
// Note that we're not using SASL_SUCCESS_DATA which means that
// we should not have any data to send when we get a SASL_OK.
- CHECK(output == NULL);
+ CHECK(output == nullptr);
send(pid, AuthenticationCompletedMessage());
status = COMPLETED;
promise.set(principal);
@@ -329,13 +330,13 @@ private:
status = STEPPING;
} else if (result == SASL_NOUSER || result == SASL_BADAUTH) {
LOG(WARNING) << "Authentication failure: "
- << sasl_errstring(result, NULL, NULL);
+ << sasl_errstring(result, nullptr, nullptr);
send(pid, AuthenticationFailedMessage());
status = FAILED;
promise.set(Option<string>::none());
} else {
LOG(ERROR) << "Authentication error: "
- << sasl_errstring(result, NULL, NULL);
+ << sasl_errstring(result, nullptr, nullptr);
AuthenticationErrorMessage message;
string error(sasl_errdetail(connection));
message.set_error(error);
@@ -475,12 +476,12 @@ Try<Authenticator*> CRAMMD5Authenticator::create()
}
-CRAMMD5Authenticator::CRAMMD5Authenticator() : process(NULL) {}
+CRAMMD5Authenticator::CRAMMD5Authenticator() : process(nullptr) {}
CRAMMD5Authenticator::~CRAMMD5Authenticator()
{
- if (process != NULL) {
+ if (process != nullptr) {
terminate(process);
wait(process);
delete process;
@@ -498,7 +499,7 @@ Try<Nothing> CRAMMD5Authenticator::initialize(
// object, we make this a static pointer.
static Option<Error>* error = new Option<Error>();
- if (process != NULL) {
+ if (process != nullptr) {
return Error("Authenticator initialized already");
}
@@ -517,12 +518,12 @@ Try<Nothing> CRAMMD5Authenticator::initialize(
if (!initialize->once()) {
LOG(INFO) << "Initializing server SASL";
- int result = sasl_server_init(NULL, "mesos");
+ int result = sasl_server_init(nullptr, "mesos");
if (result != SASL_OK) {
*error = Error(
string("Failed to initialize SASL: ") +
- sasl_errstring(result, NULL, NULL));
+ sasl_errstring(result, nullptr, nullptr));
} else {
result = sasl_auxprop_add_plugin(
InMemoryAuxiliaryPropertyPlugin::name(),
@@ -531,7 +532,7 @@ Try<Nothing> CRAMMD5Authenticator::initialize(
if (result != SASL_OK) {
*error = Error(
string("Failed to add in-memory auxiliary property plugin: ") +
- sasl_errstring(result, NULL, NULL));
+ sasl_errstring(result, nullptr, nullptr));
}
}
@@ -552,7 +553,7 @@ Try<Nothing> CRAMMD5Authenticator::initialize(
Future<Option<string>> CRAMMD5Authenticator::authenticate(
const UPID& pid)
{
- if (process == NULL) {
+ if (process == nullptr) {
return Failure("Authenticator not initialized");
}
return dispatch(
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/authentication/cram_md5/auxprop.cpp
----------------------------------------------------------------------
diff --git a/src/authentication/cram_md5/auxprop.cpp b/src/authentication/cram_md5/auxprop.cpp
index d82d2d2..5912b01 100644
--- a/src/authentication/cram_md5/auxprop.cpp
+++ b/src/authentication/cram_md5/auxprop.cpp
@@ -47,7 +47,7 @@ int InMemoryAuxiliaryPropertyPlugin::initialize(
sasl_auxprop_plug_t** plug,
const char* name)
{
- if (version == NULL || plug == NULL) {
+ if (version == nullptr || plug == nullptr) {
return SASL_BADPARAM;
}
@@ -60,11 +60,11 @@ int InMemoryAuxiliaryPropertyPlugin::initialize(
plugin.features = 0;
plugin.spare_int1 = 0;
- plugin.glob_context = NULL;
- plugin.auxprop_free = NULL;
+ plugin.glob_context = nullptr;
+ plugin.auxprop_free = nullptr;
plugin.auxprop_lookup = &InMemoryAuxiliaryPropertyPlugin::lookup;
plugin.name = const_cast<char*>(InMemoryAuxiliaryPropertyPlugin::name());
- plugin.auxprop_store = NULL;
+ plugin.auxprop_store = nullptr;
*plug = &plugin;
@@ -94,13 +94,13 @@ int InMemoryAuxiliaryPropertyPlugin::initialize(
// flags (see below).
const propval* properties = utils->prop_get(sparams->propctx);
- CHECK(properties != NULL)
+ CHECK(properties != nullptr)
<< "Invalid auxiliary properties requested for lookup";
// TODO(benh): Consider "parsing" 'user' if it has an '@' separating
// the actual user and a realm.
- string realm = sparams->user_realm != NULL
+ string realm = sparams->user_realm != nullptr
? sparams->user_realm
: sparams->serverFQDN;
@@ -120,7 +120,7 @@ int InMemoryAuxiliaryPropertyPlugin::initialize(
// Now iterate through each property requested.
const propval* property = properties;
- for (; property->name != NULL; property++) {
+ for (; property->name != nullptr; property++) {
const char* name = property->name;
// Skip properties that don't apply to this lookup given the flags.
@@ -145,7 +145,7 @@ int InMemoryAuxiliaryPropertyPlugin::initialize(
}
// Don't override already set values unless instructed otherwise.
- if (property->values != NULL && !(flags & SASL_AUXPROP_OVERRIDE)) {
+ if (property->values != nullptr && !(flags & SASL_AUXPROP_OVERRIDE)) {
#ifdef SASL_AUXPROP_VERIFY_AGAINST_HASH
// Regardless of SASL_AUXPROP_OVERRIDE we're expected to
// override property 'userPassword' when the
@@ -169,7 +169,7 @@ int InMemoryAuxiliaryPropertyPlugin::initialize(
<< "and value(s) already set";
continue;
#endif
- } else if (property->values != NULL) {
+ } else if (property->values != nullptr) {
CHECK(flags & SASL_AUXPROP_OVERRIDE);
VLOG(1) << "Erasing auxiliary property '" << name
<< "' since SASL_AUXPROP_OVERRIDE == true";
@@ -182,10 +182,10 @@ int InMemoryAuxiliaryPropertyPlugin::initialize(
if (values.isSome()) {
if (values.get().empty()) {
- // Add the 'NULL' value to indicate there were no values.
- utils->prop_set(sparams->propctx, property->name, NULL, 0);
+ // Add the 'nullptr' value to indicate there were no values.
+ utils->prop_set(sparams->propctx, property->name, nullptr, 0);
} else {
- // Add all the values. Note that passing NULL as the property
+ // Add all the values. Note that passing nullptr as the property
// name for 'prop_set' will append values to the same name as
// the previous 'prop_set' calls which is the behavior we want
// after adding the first value.
@@ -193,7 +193,7 @@ int InMemoryAuxiliaryPropertyPlugin::initialize(
foreach (const string& value, values.get()) {
sparams->utils->prop_set(
sparams->propctx,
- append ? NULL : property->name,
+ append ? nullptr : property->name,
value.c_str(),
-1); // Let 'prop_set' use strlen.
append = true;
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/authorizer/local/authorizer.cpp
----------------------------------------------------------------------
diff --git a/src/authorizer/local/authorizer.cpp b/src/authorizer/local/authorizer.cpp
index 32346bb..2186f0e 100644
--- a/src/authorizer/local/authorizer.cpp
+++ b/src/authorizer/local/authorizer.cpp
@@ -262,15 +262,15 @@ public:
break;
}
case authorization::VIEW_TASK: {
- CHECK(object->task != NULL || object->task_info != NULL);
+ CHECK(object->task != nullptr || object->task_info != nullptr);
CHECK_NOTNULL(object->framework_info);
// First we consider either whether `Task` or `TaskInfo`
// have `user` set. As fallback we use `FrameworkInfo.user`.
Option<string> taskUser = None();
- if (object->task != NULL && object->task->has_user()) {
+ if (object->task != nullptr && object->task->has_user()) {
taskUser = object->task->user();
- } else if (object->task_info != NULL) {
+ } else if (object->task_info != nullptr) {
// Within TaskInfo the user can be either set in `command`
// or `executor.command`.
if (object->task_info->has_command() &&
@@ -775,7 +775,7 @@ LocalAuthorizer::LocalAuthorizer(const ACLs& acls)
LocalAuthorizer::~LocalAuthorizer()
{
- if (process != NULL) {
+ if (process != nullptr) {
terminate(process);
wait(process);
delete process;
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/balloon_executor.cpp
----------------------------------------------------------------------
diff --git a/src/examples/balloon_executor.cpp b/src/examples/balloon_executor.cpp
index 108ebd9..2a79c35 100644
--- a/src/examples/balloon_executor.cpp
+++ b/src/examples/balloon_executor.cpp
@@ -51,7 +51,7 @@ static void balloon(size_t limit)
<< BALLOON_STEP_MB << " MB" << std::endl;
// Allocate page-aligned virtual memory.
- void* buffer = NULL;
+ void* buffer = nullptr;
if (posix_memalign(&buffer, os::pagesize(), chunk) != 0) {
perror("Failed to allocate page-aligned memory, posix_memalign");
abort();
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/example_module_impl.cpp
----------------------------------------------------------------------
diff --git a/src/examples/example_module_impl.cpp b/src/examples/example_module_impl.cpp
index aeffdc0..b84ff73 100644
--- a/src/examples/example_module_impl.cpp
+++ b/src/examples/example_module_impl.cpp
@@ -103,7 +103,7 @@ static TestModule* create(const mesos::Parameters& parameters)
delete testModule;
// TODO(karya): make the return type Try<TestModule*> to pass the
// error message as well.
- return NULL;
+ return nullptr;
}
return testModule;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/load_generator_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/load_generator_framework.cpp b/src/examples/load_generator_framework.cpp
index 5fac65f..5402e31 100644
--- a/src/examples/load_generator_framework.cpp
+++ b/src/examples/load_generator_framework.cpp
@@ -132,7 +132,7 @@ class LoadGeneratorScheduler : public Scheduler
{
public:
LoadGeneratorScheduler(double _qps, const Option<Duration>& _duration)
- : generator(NULL), qps(_qps), duration(_duration) {}
+ : generator(nullptr), qps(_qps), duration(_duration) {}
virtual ~LoadGeneratorScheduler()
{
@@ -145,7 +145,7 @@ public:
{
LOG(INFO) << "Registered with " << masterInfo.pid();
- if (generator == NULL) {
+ if (generator == nullptr) {
LOG(INFO) << "Starting LoadGenerator at QPS: " << qps;
generator = new LoadGenerator(driver, qps, duration);
@@ -158,7 +158,7 @@ public:
{
LOG(INFO) << "Reregistered with " << masterInfo.pid();
- if (generator == NULL) {
+ if (generator == nullptr) {
LOG(INFO) << "Starting LoadGenerator at QPS: " << qps;
generator = new LoadGenerator(driver, qps, duration);
}
@@ -169,7 +169,7 @@ public:
LOG(INFO) << "Disconnected!";
delete generator;
- generator = NULL;
+ generator = nullptr;
LOG(INFO) << "Stopped LoadGenerator";
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/test_allocator_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_allocator_module.cpp b/src/examples/test_allocator_module.cpp
index 1255a4a..bc28eb4 100644
--- a/src/examples/test_allocator_module.cpp
+++ b/src/examples/test_allocator_module.cpp
@@ -37,7 +37,7 @@ static Allocator* createDRFAllocator(const Parameters& parameters)
{
Try<Allocator*> allocator = HierarchicalDRFAllocator::create();
if (allocator.isError()) {
- return NULL;
+ return nullptr;
}
return allocator.get();
@@ -52,5 +52,5 @@ mesos::modules::Module<Allocator> org_apache_mesos_TestDRFAllocator(
"Apache Mesos",
"modules@mesos.apache.org",
"Test DRFAllocator module.",
- NULL,
+ nullptr,
createDRFAllocator);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/test_anonymous_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_anonymous_module.cpp b/src/examples/test_anonymous_module.cpp
index dd291cf..c41b7fc 100644
--- a/src/examples/test_anonymous_module.cpp
+++ b/src/examples/test_anonymous_module.cpp
@@ -61,5 +61,5 @@ mesos::modules::Module<Anonymous> org_apache_mesos_TestAnonymous(
"Apache Mesos",
"modules@mesos.apache.org",
"Test anonymous module.",
- NULL,
+ nullptr,
createAnonymous);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/test_authorizer_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_authorizer_module.cpp b/src/examples/test_authorizer_module.cpp
index 19ec7cd..2154f5c 100644
--- a/src/examples/test_authorizer_module.cpp
+++ b/src/examples/test_authorizer_module.cpp
@@ -41,7 +41,7 @@ static Authorizer* createLocalAuthorizer(const Parameters& parameters)
{
Try<Authorizer*> local = mesos::internal::LocalAuthorizer::create(parameters);
if (local.isError()) {
- return NULL;
+ return nullptr;
}
return local.get();
@@ -56,5 +56,5 @@ mesos::modules::Module<Authorizer> org_apache_mesos_TestLocalAuthorizer(
"Apache Mesos",
"modules@mesos.apache.org",
"Test Authorizer module.",
- NULL,
+ nullptr,
createLocalAuthorizer);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/test_container_logger_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_container_logger_module.cpp b/src/examples/test_container_logger_module.cpp
index 76dd494..90ef3ac 100644
--- a/src/examples/test_container_logger_module.cpp
+++ b/src/examples/test_container_logger_module.cpp
@@ -41,12 +41,12 @@ org_apache_mesos_TestSandboxContainerLogger(
"Apache Mesos",
"modules@mesos.apache.org",
"Test Sandbox Container Logger module.",
- NULL,
+ nullptr,
[](const Parameters& paramters) -> ContainerLogger* {
Try<ContainerLogger*> result = SandboxContainerLogger::create(None());
if (result.isError()) {
- return NULL;
+ return nullptr;
}
return result.get();
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/test_hook_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_hook_module.cpp b/src/examples/test_hook_module.cpp
index bc0bcb9..0f5f015 100644
--- a/src/examples/test_hook_module.cpp
+++ b/src/examples/test_hook_module.cpp
@@ -367,5 +367,5 @@ mesos::modules::Module<Hook> org_apache_mesos_TestHook(
"Apache Mesos",
"modules@mesos.apache.org",
"Test Hook module.",
- NULL,
+ nullptr,
createHook);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/test_http_authenticator_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_http_authenticator_module.cpp b/src/examples/test_http_authenticator_module.cpp
index 8affdb6..a2fdc28 100644
--- a/src/examples/test_http_authenticator_module.cpp
+++ b/src/examples/test_http_authenticator_module.cpp
@@ -43,7 +43,7 @@ static Authenticator* createHttpAuthenticator(const Parameters& parameters)
LOG(ERROR) << "Failed to create basic HTTP authenticator: "
<< authenticator.error();
- return NULL;
+ return nullptr;
}
return authenticator.get();
@@ -59,5 +59,5 @@ org_apache_mesos_TestHttpBasicAuthenticator(
"Apache Mesos",
"modules@mesos.apache.org",
"Test HTTP Authenticator module.",
- NULL,
+ nullptr,
createHttpAuthenticator);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/test_isolator_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_isolator_module.cpp b/src/examples/test_isolator_module.cpp
index a4a2103..5677a4b 100644
--- a/src/examples/test_isolator_module.cpp
+++ b/src/examples/test_isolator_module.cpp
@@ -48,7 +48,7 @@ static Isolator* createCpuIsolator(const Parameters& parameters)
Flags flags;
Try<Isolator*> result = PosixCpuIsolatorProcess::create(flags);
if (result.isError()) {
- return NULL;
+ return nullptr;
}
return result.get();
}
@@ -59,7 +59,7 @@ static Isolator* createMemIsolator(const Parameters& parameters)
Flags flags;
Try<Isolator*> result = PosixMemIsolatorProcess::create(flags);
if (result.isError()) {
- return NULL;
+ return nullptr;
}
return result.get();
}
@@ -83,5 +83,5 @@ mesos::modules::Module<Isolator> org_apache_mesos_TestMemIsolator(
"Apache Mesos",
"modules@mesos.apache.org",
"Test Memory Isolator module.",
- NULL, // Do not perform any compatibility check.
+ nullptr, // Do not perform any compatibility check.
createMemIsolator);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/test_master_contender_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_master_contender_module.cpp b/src/examples/test_master_contender_module.cpp
index d50d9d8..40fa27c 100644
--- a/src/examples/test_master_contender_module.cpp
+++ b/src/examples/test_master_contender_module.cpp
@@ -37,7 +37,7 @@ mesos::modules::Module<MasterContender> org_apache_mesos_TestMasterContender(
"Apache Mesos",
"modules@mesos.apache.org",
"Test MasterContender module.",
- NULL,
+ nullptr,
[](const Parameters& parameters) -> MasterContender* {
return new StandaloneMasterContender();
});
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/test_master_detector_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_master_detector_module.cpp b/src/examples/test_master_detector_module.cpp
index ff362db..3650d7e 100644
--- a/src/examples/test_master_detector_module.cpp
+++ b/src/examples/test_master_detector_module.cpp
@@ -37,7 +37,7 @@ mesos::modules::Module<MasterDetector> org_apache_mesos_TestMasterDetector(
"Apache Mesos",
"modules@mesos.apache.org",
"Test MasterDetector module.",
- NULL,
+ nullptr,
[](const Parameters& parameters) -> MasterDetector* {
return new StandaloneMasterDetector();
});
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/test_qos_controller_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_qos_controller_module.cpp b/src/examples/test_qos_controller_module.cpp
index f382fc4..4f6a273 100644
--- a/src/examples/test_qos_controller_module.cpp
+++ b/src/examples/test_qos_controller_module.cpp
@@ -35,7 +35,7 @@ static QoSController* createQoSController(const Parameters& parameters)
{
Try<QoSController*> result = NoopQoSController::create(None());
if (result.isError()) {
- return NULL;
+ return nullptr;
}
return result.get();
}
@@ -50,5 +50,5 @@ mesos::modules::Module<QoSController>
"Apache Mesos",
"modules@mesos.apache.org",
"Test Noop QoS Controller module.",
- NULL,
+ nullptr,
createQoSController);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/examples/test_resource_estimator_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_resource_estimator_module.cpp b/src/examples/test_resource_estimator_module.cpp
index 229b293..faee1ae 100644
--- a/src/examples/test_resource_estimator_module.cpp
+++ b/src/examples/test_resource_estimator_module.cpp
@@ -38,7 +38,7 @@ static ResourceEstimator* createResourceEstimator(const Parameters& parameters)
Try<ResourceEstimator*> result =
NoopResourceEstimator::create(None());
if (result.isError()) {
- return NULL;
+ return nullptr;
}
return result.get();
}
@@ -53,5 +53,5 @@ mesos::modules::Module<ResourceEstimator>
"Apache Mesos",
"modules@mesos.apache.org",
"Test Noop Resource Estimator module.",
- NULL,
+ nullptr,
createResourceEstimator);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/exec/exec.cpp
----------------------------------------------------------------------
diff --git a/src/exec/exec.cpp b/src/exec/exec.cpp
index 666b1f4..15ebb74 100644
--- a/src/exec/exec.cpp
+++ b/src/exec/exec.cpp
@@ -588,7 +588,7 @@ private:
MesosExecutorDriver::MesosExecutorDriver(Executor* _executor)
: executor(_executor),
- process(NULL),
+ process(nullptr),
status(DRIVER_NOT_STARTED)
{
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -658,8 +658,8 @@ Status MesosExecutorDriver::start()
#else // __WINDOWS__
0;
#endif // __WINDOWS__
- setvbuf(stdout, NULL, _IOLBF, bufferSize);
- setvbuf(stderr, NULL, _IOLBF, bufferSize);
+ setvbuf(stdout, nullptr, _IOLBF, bufferSize);
+ setvbuf(stderr, nullptr, _IOLBF, bufferSize);
bool local;
@@ -759,7 +759,7 @@ Status MesosExecutorDriver::start()
}
}
- CHECK(process == NULL);
+ CHECK(process == nullptr);
process = new ExecutorProcess(
slave,
@@ -790,7 +790,7 @@ Status MesosExecutorDriver::stop()
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(process, &ExecutorProcess::stop);
@@ -810,7 +810,7 @@ Status MesosExecutorDriver::abort()
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
// We set the atomic aborted to true here to prevent any further
// messages from being processed in the ExecutorProcess. However,
@@ -865,7 +865,7 @@ Status MesosExecutorDriver::sendStatusUpdate(const TaskStatus& taskStatus)
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(process, &ExecutorProcess::sendStatusUpdate, taskStatus);
@@ -881,7 +881,7 @@ Status MesosExecutorDriver::sendFrameworkMessage(const string& data)
return status;
}
- CHECK(process != NULL);
+ CHECK(process != nullptr);
dispatch(process, &ExecutorProcess::sendFrameworkMessage, data);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/files/files.hpp
----------------------------------------------------------------------
diff --git a/src/files/files.hpp b/src/files/files.hpp
index a41c203..b767d5b 100644
--- a/src/files/files.hpp
+++ b/src/files/files.hpp
@@ -134,16 +134,16 @@ inline JSON::Object jsonFileInfo(const std::string& path,
permissions.others.w ? 'w' : '-',
permissions.others.x ? 'x' : '-').get();
- // NOTE: `getpwuid` and `getgrgid` return `NULL` on Windows.
+ // NOTE: `getpwuid` and `getgrgid` return `nullptr` on Windows.
passwd* p = getpwuid(s.st_uid);
- if (p != NULL) {
+ if (p != nullptr) {
file.values["uid"] = p->pw_name;
} else {
file.values["uid"] = stringify(s.st_uid);
}
struct group* g = getgrgid(s.st_gid);
- if (g != NULL) {
+ if (g != nullptr) {
file.values["gid"] = g->gr_name;
} else {
file.values["gid"] = stringify(s.st_gid);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/java/jni/construct.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/construct.cpp b/src/java/jni/construct.cpp
index 0bfe629..e5c070c 100644
--- a/src/java/jni/construct.cpp
+++ b/src/java/jni/construct.cpp
@@ -58,8 +58,8 @@ template <>
string construct(JNIEnv* env, jobject jobj)
{
jstring js = (jstring) jobj;
- const char* s = env->GetStringUTFChars(js, NULL);
- CHECK(s != NULL) << "Out of memory!";
+ const char* s = env->GetStringUTFChars(js, nullptr);
+ CHECK(s != nullptr) << "Out of memory!";
string result(s);
env->ReleaseStringUTFChars(js, s);
return result;
@@ -124,7 +124,7 @@ FrameworkInfo construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const FrameworkInfo& framework = parse<FrameworkInfo>(data, length);
@@ -145,7 +145,7 @@ Credential construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const Credential& credential = parse<Credential>(data, length);
@@ -166,7 +166,7 @@ Filters construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const Filters& filters = parse<Filters>(data, length);
@@ -187,7 +187,7 @@ FrameworkID construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const FrameworkID& frameworkId = parse<FrameworkID>(data, length);
@@ -208,7 +208,7 @@ ExecutorID construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const ExecutorID& executorId = parse<ExecutorID>(data, length);
@@ -229,7 +229,7 @@ TaskID construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const TaskID& taskId = parse<TaskID>(data, length);
@@ -250,7 +250,7 @@ SlaveID construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const SlaveID& slaveId = parse<SlaveID>(data, length);
@@ -271,7 +271,7 @@ OfferID construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const OfferID& offerId = parse<OfferID>(data, length);
@@ -306,7 +306,7 @@ TaskInfo construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const TaskInfo& task = parse<TaskInfo>(data, length);
@@ -327,7 +327,7 @@ TaskStatus construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const TaskStatus& status = parse<TaskStatus>(data, length);
@@ -348,7 +348,7 @@ ExecutorInfo construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const ExecutorInfo& executor = parse<ExecutorInfo>(data, length);
@@ -369,7 +369,7 @@ Request construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const Request& request = parse<Request>(data, length);
@@ -390,7 +390,7 @@ Offer::Operation construct(JNIEnv* env, jobject jobj)
jbyteArray jdata = (jbyteArray) env->CallObjectMethod(jobj, toByteArray);
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
const Offer::Operation& operation = parse<Offer::Operation>(data, length);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/java/jni/convert.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/convert.cpp b/src/java/jni/convert.cpp
index f1a486d..5c48ca8 100644
--- a/src/java/jni/convert.cpp
+++ b/src/java/jni/convert.cpp
@@ -50,17 +50,17 @@ using std::string;
// http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/jni/AndroidRuntime.cpp;h=f61e2476c71191aa6eabc93bcb26b3c15ccf6136;hb=HEAD
namespace {
-jweak mesosClassLoader = NULL; // Initialized in JNI_OnLoad later in this file.
+jweak mesosClassLoader = nullptr; // Initialized in JNI_OnLoad later in this file.
jclass FindMesosClass(JNIEnv* env, const char* className)
{
if (env->ExceptionCheck()) {
fprintf(stderr, "ERROR: exception pending on entry to "
"FindMesosClass()\n");
- return NULL;
+ return nullptr;
}
- if (mesosClassLoader == NULL) {
+ if (mesosClassLoader == nullptr) {
return env->FindClass(className);
}
@@ -74,19 +74,19 @@ jclass FindMesosClass(JNIEnv* env, const char* className)
}
jclass javaLangClassLoader = env->FindClass("java/lang/ClassLoader");
- assert(javaLangClassLoader != NULL);
+ assert(javaLangClassLoader != nullptr);
jmethodID loadClass =
env->GetMethodID(javaLangClassLoader,
"loadClass",
"(Ljava/lang/String;)Ljava/lang/Class;");
- assert(loadClass != NULL);
+ assert(loadClass != nullptr);
// Create an object for the class name string; alloc could fail.
jstring strClassName = env->NewStringUTF(convName.c_str());
if (env->ExceptionCheck()) {
fprintf(stderr, "ERROR: unable to convert '%s' to string\n",
convName.c_str());
- return NULL;
+ return nullptr;
}
// Try to find the named class.
@@ -98,7 +98,7 @@ jclass FindMesosClass(JNIEnv* env, const char* className)
env->ExceptionDescribe();
fprintf(stderr, "ERROR: unable to load class '%s' from %p\n",
className, mesosClassLoader);
- return NULL;
+ return nullptr;
}
return cls;
@@ -118,25 +118,25 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* jvm, void* reserved)
// Find thread's context class loader.
jclass javaLangThread = env->FindClass("java/lang/Thread");
- assert(javaLangThread != NULL);
+ assert(javaLangThread != nullptr);
jclass javaLangClassLoader = env->FindClass("java/lang/ClassLoader");
- assert(javaLangClassLoader != NULL);
+ assert(javaLangClassLoader != nullptr);
jmethodID currentThread = env->GetStaticMethodID(
javaLangThread, "currentThread", "()Ljava/lang/Thread;");
- assert(currentThread != NULL);
+ assert(currentThread != nullptr);
jmethodID getContextClassLoader = env->GetMethodID(
javaLangThread, "getContextClassLoader", "()Ljava/lang/ClassLoader;");
- assert(getContextClassLoader != NULL);
+ assert(getContextClassLoader != nullptr);
jobject thread = env->CallStaticObjectMethod(javaLangThread, currentThread);
- assert(thread != NULL);
+ assert(thread != nullptr);
jobject classLoader = env->CallObjectMethod(thread, getContextClassLoader);
- if (classLoader != NULL) {
+ if (classLoader != nullptr) {
mesosClassLoader = env->NewWeakGlobalRef(classLoader);
}
@@ -152,7 +152,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* jvm, void* reserved)
if (jarMajorVersion != nativeMajorVersion) {
env->DeleteWeakGlobalRef(mesosClassLoader);
- mesosClassLoader = NULL;
+ mesosClassLoader = nullptr;
const string& error =
"Mesos JAR version " + jarVersion +
" is not backwards compatible with Mesos native library version " +
@@ -185,9 +185,9 @@ JNIEXPORT void JNICALL JNI_OnUnLoad(JavaVM* jvm, void* reserved)
// TODO(benh): Must we set 'MesosNativeLibrary.loaded' to false?
- if (mesosClassLoader != NULL) {
+ if (mesosClassLoader != nullptr) {
env->DeleteWeakGlobalRef(mesosClassLoader);
- mesosClassLoader = NULL;
+ mesosClassLoader = nullptr;
}
}
@@ -522,7 +522,7 @@ Result<jfieldID> getFieldID(
{
jfieldID jfield = env->GetFieldID(clazz, name, signature);
jthrowable jexception = env->ExceptionOccurred();
- if (jexception != NULL) {
+ if (jexception != nullptr) {
env->ExceptionClear(); // Clear the exception first before proceeding.
jclass noSuchFieldError = env->FindClass("java/lang/NoSuchFieldError");
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/java/jni/org_apache_mesos_Log.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_Log.cpp b/src/java/jni/org_apache_mesos_Log.cpp
index 341df13..04f8afd 100644
--- a/src/java/jni/org_apache_mesos_Log.cpp
+++ b/src/java/jni/org_apache_mesos_Log.cpp
@@ -158,7 +158,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_Log_00024Reader_read
entries.discard();
clazz = env->FindClass("java/util/concurrent/TimeoutException");
env->ThrowNew(clazz, "Timed out while attempting to read");
- return NULL;
+ return nullptr;
} else if (!entries.isReady()) {
// Failed to read the log.
clazz = env->FindClass("org/apache/mesos/Log$OperationFailedException");
@@ -167,7 +167,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_Log_00024Reader_read
(entries.isFailed()
? entries.failure().c_str()
: "Discarded future"));
- return NULL;
+ return nullptr;
}
// List entries = new ArrayList();
@@ -294,7 +294,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_Log_00024Writer_append
Log::Writer* writer = (Log::Writer*) env->GetLongField(thiz, __writer);
- jbyte* temp = env->GetByteArrayElements(jdata, NULL);
+ jbyte* temp = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
std::string data((char*) temp, (size_t) length);
@@ -314,7 +314,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_Log_00024Writer_append
env->ReleaseByteArrayElements(jdata, temp, 0);
clazz = env->FindClass("java/util/concurrent/TimeoutException");
env->ThrowNew(clazz, "Timed out while attempting to append");
- return NULL;
+ return nullptr;
} else if (!position.isReady()) {
// Failed to append the log.
env->ReleaseByteArrayElements(jdata, temp, 0);
@@ -324,7 +324,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_Log_00024Writer_append
(position.isFailed()
? position.failure().c_str()
: "Discarded future"));
- return NULL;
+ return nullptr;
} else if (position.get().isNone()) {
// Lost exclusive write promise.
env->ReleaseByteArrayElements(jdata, temp, 0);
@@ -332,7 +332,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_Log_00024Writer_append
env->ThrowNew(
clazz,
"Exclusive write promise lost");
- return NULL;
+ return nullptr;
}
env->ReleaseByteArrayElements(jdata, temp, 0);
@@ -379,7 +379,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_Log_00024Writer_truncate
position.discard();
clazz = env->FindClass("java/util/concurrent/TimeoutException");
env->ThrowNew(clazz, "Timed out while attempting to truncate");
- return NULL;
+ return nullptr;
} else if (!position.isReady()) {
// Failed to truncate the log.
clazz = env->FindClass("org/apache/mesos/Log$WriterFailedException");
@@ -388,14 +388,14 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_Log_00024Writer_truncate
(position.isFailed()
? position.failure().c_str()
: "Discarded future"));
- return NULL;
+ return nullptr;
} else if (position.get().isNone()) {
// Lost exclusive write promise.
clazz = env->FindClass("org/apache/mesos/Log$WriterFailedException");
env->ThrowNew(
clazz,
"Exclusive write promise lost");
- return NULL;
+ return nullptr;
}
jobject jposition = convert<Log::Position>(env, position.get().get());
@@ -615,12 +615,12 @@ JNIEXPORT void JNICALL Java_org_apache_mesos_Log_initialize__ILjava_lang_String_
std::string znode = construct<std::string>(env, jznode);
// Create the C++ Log.
- Log* log = NULL;
+ Log* log = nullptr;
- if (jscheme != NULL && jcredentials != NULL) {
+ if (jscheme != nullptr && jcredentials != nullptr) {
std::string scheme = construct<std::string>(env, jscheme);
- jbyte* temp = env->GetByteArrayElements(jcredentials, NULL);
+ jbyte* temp = env->GetByteArrayElements(jcredentials, nullptr);
jsize length = env->GetArrayLength(jcredentials);
std::string credentials((char*) temp, (size_t) length);
@@ -634,7 +634,7 @@ JNIEXPORT void JNICALL Java_org_apache_mesos_Log_initialize__ILjava_lang_String_
log = new Log(quorum, path, servers, seconds, znode);
}
- CHECK(log != NULL);
+ CHECK(log != nullptr);
// Initialize the __log variable.
clazz = env->GetObjectClass(thiz);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/java/jni/org_apache_mesos_MesosExecutorDriver.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_MesosExecutorDriver.cpp b/src/java/jni/org_apache_mesos_MesosExecutorDriver.cpp
index 9a92ade..39dba40 100644
--- a/src/java/jni/org_apache_mesos_MesosExecutorDriver.cpp
+++ b/src/java/jni/org_apache_mesos_MesosExecutorDriver.cpp
@@ -33,7 +33,7 @@ class JNIExecutor : public Executor
{
public:
JNIExecutor(JNIEnv* _env, jweak _jdriver)
- : jvm(NULL), env(_env), jdriver(_jdriver)
+ : jvm(nullptr), env(_env), jdriver(_jdriver)
{
env->GetJavaVM(&jvm);
}
@@ -63,7 +63,7 @@ void JNIExecutor::registered(ExecutorDriver* driver,
const FrameworkInfo& frameworkInfo,
const SlaveInfo& slaveInfo)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -104,7 +104,7 @@ void JNIExecutor::registered(ExecutorDriver* driver,
void JNIExecutor::reregistered(ExecutorDriver* driver,
const SlaveInfo& slaveInfo)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -139,7 +139,7 @@ void JNIExecutor::reregistered(ExecutorDriver* driver,
void JNIExecutor::disconnected(ExecutorDriver* driver)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -171,7 +171,7 @@ void JNIExecutor::disconnected(ExecutorDriver* driver)
void JNIExecutor::launchTask(ExecutorDriver* driver, const TaskInfo& desc)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -206,7 +206,7 @@ void JNIExecutor::launchTask(ExecutorDriver* driver, const TaskInfo& desc)
void JNIExecutor::killTask(ExecutorDriver* driver, const TaskID& taskId)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -241,7 +241,7 @@ void JNIExecutor::killTask(ExecutorDriver* driver, const TaskID& taskId)
void JNIExecutor::frameworkMessage(ExecutorDriver* driver, const string& data)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -278,7 +278,7 @@ void JNIExecutor::frameworkMessage(ExecutorDriver* driver, const string& data)
void JNIExecutor::shutdown(ExecutorDriver* driver)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -310,7 +310,7 @@ void JNIExecutor::shutdown(ExecutorDriver* driver)
void JNIExecutor::error(ExecutorDriver* driver, const string& message)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -518,7 +518,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_MesosExecutorDriver_sendFramewor
(JNIEnv* env, jobject thiz, jbyteArray jdata)
{
// Construct a C++ string from the Java byte array.
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
string temp((char*) data, (size_t) length);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp b/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp
index c723e2d..1f9572c 100644
--- a/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp
+++ b/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp
@@ -41,7 +41,7 @@ class JNIScheduler : public Scheduler
{
public:
JNIScheduler(JNIEnv* _env, jweak _jdriver)
- : jvm(NULL), env(_env), jdriver(_jdriver)
+ : jvm(nullptr), env(_env), jdriver(_jdriver)
{
env->GetJavaVM(&jvm);
}
@@ -78,7 +78,7 @@ void JNIScheduler::registered(SchedulerDriver* driver,
const FrameworkID& frameworkId,
const MasterInfo& masterInfo)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -117,7 +117,7 @@ void JNIScheduler::registered(SchedulerDriver* driver,
void JNIScheduler::reregistered(SchedulerDriver* driver,
const MasterInfo& masterInfo)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -152,7 +152,7 @@ void JNIScheduler::reregistered(SchedulerDriver* driver,
void JNIScheduler::disconnected(SchedulerDriver* driver)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -185,7 +185,7 @@ void JNIScheduler::disconnected(SchedulerDriver* driver)
void JNIScheduler::resourceOffers(SchedulerDriver* driver,
const vector<Offer>& offers)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -233,7 +233,7 @@ void JNIScheduler::resourceOffers(SchedulerDriver* driver,
void JNIScheduler::offerRescinded(SchedulerDriver* driver,
const OfferID& offerId)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -269,7 +269,7 @@ void JNIScheduler::offerRescinded(SchedulerDriver* driver,
void JNIScheduler::statusUpdate(SchedulerDriver* driver,
const TaskStatus& status)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -307,7 +307,7 @@ void JNIScheduler::frameworkMessage(SchedulerDriver* driver,
const SlaveID& slaveId,
const string& data)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -349,7 +349,7 @@ void JNIScheduler::frameworkMessage(SchedulerDriver* driver,
void JNIScheduler::slaveLost(SchedulerDriver* driver, const SlaveID& slaveId)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -387,7 +387,7 @@ void JNIScheduler::executorLost(SchedulerDriver* driver,
const SlaveID& slaveId,
int status)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -429,7 +429,7 @@ void JNIScheduler::executorLost(SchedulerDriver* driver,
void JNIScheduler::error(SchedulerDriver* driver, const string& message)
{
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
jclass clazz = env->GetObjectClass(jdriver);
@@ -523,15 +523,15 @@ JNIEXPORT void JNICALL Java_org_apache_mesos_MesosSchedulerDriver_initialize
return; // Exception has been thrown.
}
- jobject jcredential = NULL;
+ jobject jcredential = nullptr;
if (credential.isSome()) {
// Credential might exist but set to 'null'.
jcredential = env->GetObjectField(thiz, credential.get());
}
// Create the C++ driver.
- MesosSchedulerDriver* driver = NULL;
- if (jcredential != NULL) {
+ MesosSchedulerDriver* driver = nullptr;
+ if (jcredential != nullptr) {
driver = new MesosSchedulerDriver(
scheduler,
construct<FrameworkInfo>(env, jframework),
@@ -703,7 +703,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_MesosSchedulerDriver_sendFramewo
const SlaveID& slaveId = construct<SlaveID>(env, jslaveId);
// Construct a C++ string from the Java byte array.
- jbyte* data = env->GetByteArrayElements(jdata, NULL);
+ jbyte* data = env->GetByteArrayElements(jdata, nullptr);
jsize length = env->GetArrayLength(jdata);
string temp((char*) data, (size_t) length);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/java/jni/org_apache_mesos_state_AbstractState.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_state_AbstractState.cpp b/src/java/jni/org_apache_mesos_state_AbstractState.cpp
index 728e935..3101352 100644
--- a/src/java/jni/org_apache_mesos_state_AbstractState.cpp
+++ b/src/java/jni/org_apache_mesos_state_AbstractState.cpp
@@ -161,13 +161,13 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1fetch_1g
if (future->isFailed()) {
jclass clazz = env->FindClass("java/util/concurrent/ExecutionException");
env->ThrowNew(clazz, future->failure().c_str());
- return NULL;
+ return nullptr;
} else if (future->isDiscarded()) {
// TODO(benh): Consider throwing an ExecutionException since we
// never return true for 'isCancelled'.
jclass clazz = env->FindClass("java/util/concurrent/CancellationException");
env->ThrowNew(clazz, "Future was discarded");
- return NULL;
+ return nullptr;
}
CHECK_READY(*future);
@@ -210,13 +210,13 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1fetch_1g
if (future->isFailed()) {
clazz = env->FindClass("java/util/concurrent/ExecutionException");
env->ThrowNew(clazz, future->failure().c_str());
- return NULL;
+ return nullptr;
} else if (future->isDiscarded()) {
// TODO(benh): Consider throwing an ExecutionException since we
// never return true for 'isCancelled'.
clazz = env->FindClass("java/util/concurrent/CancellationException");
env->ThrowNew(clazz, "Future was discarded");
- return NULL;
+ return nullptr;
}
CHECK_READY(*future);
@@ -237,7 +237,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1fetch_1g
clazz = env->FindClass("java/util/concurrent/TimeoutException");
env->ThrowNew(clazz, "Failed to wait for future within timeout");
- return NULL;
+ return nullptr;
}
@@ -472,13 +472,13 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1store_1g
if (future->isFailed()) {
jclass clazz = env->FindClass("java/util/concurrent/ExecutionException");
env->ThrowNew(clazz, future->failure().c_str());
- return NULL;
+ return nullptr;
} else if (future->isDiscarded()) {
// TODO(benh): Consider throwing an ExecutionException since we
// never return true for 'isCancelled'.
jclass clazz = env->FindClass("java/util/concurrent/CancellationException");
env->ThrowNew(clazz, "Future was discarded");
- return NULL;
+ return nullptr;
}
CHECK_READY(*future);
@@ -498,7 +498,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1store_1g
return jvariable;
}
- return NULL;
+ return nullptr;
}
@@ -525,13 +525,13 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1store_1g
if (future->isFailed()) {
clazz = env->FindClass("java/util/concurrent/ExecutionException");
env->ThrowNew(clazz, future->failure().c_str());
- return NULL;
+ return nullptr;
} else if (future->isDiscarded()) {
// TODO(benh): Consider throwing an ExecutionException since we
// never return true for 'isCancelled'.
clazz = env->FindClass("java/util/concurrent/CancellationException");
env->ThrowNew(clazz, "Future was discarded");
- return NULL;
+ return nullptr;
}
CHECK_READY(*future);
@@ -551,13 +551,13 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1store_1g
return jvariable;
}
- return NULL;
+ return nullptr;
}
clazz = env->FindClass("java/util/concurrent/TimeoutException");
env->ThrowNew(clazz, "Failed to wait for future within timeout");
- return NULL;
+ return nullptr;
}
@@ -791,13 +791,13 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1expunge_
if (future->isFailed()) {
jclass clazz = env->FindClass("java/util/concurrent/ExecutionException");
env->ThrowNew(clazz, future->failure().c_str());
- return NULL;
+ return nullptr;
} else if (future->isDiscarded()) {
// TODO(benh): Consider throwing an ExecutionException since we
// never return true for 'isCancelled'.
jclass clazz = env->FindClass("java/util/concurrent/CancellationException");
env->ThrowNew(clazz, "Future was discarded");
- return NULL;
+ return nullptr;
}
CHECK_READY(*future);
@@ -837,13 +837,13 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1expunge_
if (future->isFailed()) {
clazz = env->FindClass("java/util/concurrent/ExecutionException");
env->ThrowNew(clazz, future->failure().c_str());
- return NULL;
+ return nullptr;
} else if (future->isDiscarded()) {
// TODO(benh): Consider throwing an ExecutionException since we
// never return true for 'isCancelled'.
clazz = env->FindClass("java/util/concurrent/CancellationException");
env->ThrowNew(clazz, "Future was discarded");
- return NULL;
+ return nullptr;
}
CHECK_READY(*future);
@@ -862,7 +862,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1expunge_
clazz = env->FindClass("java/util/concurrent/TimeoutException");
env->ThrowNew(clazz, "Failed to wait for future within timeout");
- return NULL;
+ return nullptr;
}
@@ -1090,13 +1090,13 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1names_1g
if (future->isFailed()) {
jclass clazz = env->FindClass("java/util/concurrent/ExecutionException");
env->ThrowNew(clazz, future->failure().c_str());
- return NULL;
+ return nullptr;
} else if (future->isDiscarded()) {
// TODO(benh): Consider throwing an ExecutionException since we
// never return true for 'isCancelled'.
jclass clazz = env->FindClass("java/util/concurrent/CancellationException");
env->ThrowNew(clazz, "Future was discarded");
- return NULL;
+ return nullptr;
}
CHECK_READY(*future);
@@ -1146,13 +1146,13 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1names_1g
if (future->isFailed()) {
clazz = env->FindClass("java/util/concurrent/ExecutionException");
env->ThrowNew(clazz, future->failure().c_str());
- return NULL;
+ return nullptr;
} else if (future->isDiscarded()) {
// TODO(benh): Consider throwing an ExecutionException since we
// never return true for 'isCancelled'.
clazz = env->FindClass("java/util/concurrent/CancellationException");
env->ThrowNew(clazz, "Future was discarded");
- return NULL;
+ return nullptr;
}
CHECK_READY(*future);
@@ -1181,7 +1181,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_AbstractState__1_1names_1g
clazz = env->FindClass("java/util/concurrent/TimeoutException");
env->ThrowNew(clazz, "Failed to wait for future within timeout");
- return NULL;
+ return nullptr;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/java/jni/org_apache_mesos_state_Variable.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_state_Variable.cpp b/src/java/jni/org_apache_mesos_state_Variable.cpp
index 5a3805f..3380075 100644
--- a/src/java/jni/org_apache_mesos_state_Variable.cpp
+++ b/src/java/jni/org_apache_mesos_state_Variable.cpp
@@ -62,7 +62,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_state_Variable_mutate
Variable* variable = (Variable*) env->GetLongField(thiz, __variable);
- jbyte* value = env->GetByteArrayElements(jvalue, NULL);
+ jbyte* value = env->GetByteArrayElements(jvalue, nullptr);
jsize length = env->GetArrayLength(jvalue);
// Mutate the variable and save a copy of the result.
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/java/jni/org_apache_mesos_state_ZooKeeperState.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_state_ZooKeeperState.cpp b/src/java/jni/org_apache_mesos_state_ZooKeeperState.cpp
index 5cce558..b2734c6 100644
--- a/src/java/jni/org_apache_mesos_state_ZooKeeperState.cpp
+++ b/src/java/jni/org_apache_mesos_state_ZooKeeperState.cpp
@@ -106,11 +106,11 @@ JNIEXPORT void JNICALL Java_org_apache_mesos_state_ZooKeeperState_initialize__Lj
string znode = construct<string>(env, jznode);
// Create the C++ State.
- Storage* storage = NULL;
- if (jscheme != NULL && jcredentials != NULL) {
+ Storage* storage = nullptr;
+ if (jscheme != nullptr && jcredentials != nullptr) {
string scheme = construct<string>(env, jscheme);
- jbyte* temp = env->GetByteArrayElements(jcredentials, NULL);
+ jbyte* temp = env->GetByteArrayElements(jcredentials, nullptr);
jsize length = env->GetArrayLength(jcredentials);
string credentials((char*) temp, (size_t) length);
@@ -124,7 +124,7 @@ JNIEXPORT void JNICALL Java_org_apache_mesos_state_ZooKeeperState_initialize__Lj
storage = new ZooKeeperStorage(servers, timeout, znode);
}
- CHECK(storage != NULL);
+ CHECK(storage != nullptr);
State* state = new State(storage);
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/jvm/jvm.cpp
----------------------------------------------------------------------
diff --git a/src/jvm/jvm.cpp b/src/jvm/jvm.cpp
index 779f8b9..62f7857 100644
--- a/src/jvm/jvm.cpp
+++ b/src/jvm/jvm.cpp
@@ -35,7 +35,7 @@
#include "jvm/java/lang.hpp"
// Static storage and initialization.
-Jvm* Jvm::instance = NULL;
+Jvm* Jvm::instance = nullptr;
Try<Jvm*> Jvm::create(
const std::vector<std::string>& _options,
@@ -43,7 +43,7 @@ Try<Jvm*> Jvm::create(
bool exceptions)
{
// TODO(benh): Make this thread-safe.
- if (instance != NULL) {
+ if (instance != nullptr) {
return Error("Java Virtual Machine already created");
}
@@ -72,8 +72,8 @@ Try<Jvm*> Jvm::create(
vmArgs.nOptions = options.size();
vmArgs.options = opts;
- JavaVM* jvm = NULL;
- JNIEnv* env = NULL;
+ JavaVM* jvm = nullptr;
+ JNIEnv* env = nullptr;
Option<std::string> libJvmPath = os::getenv("JAVA_JVM_LIBRARY");
if (libJvmPath.isNone()) {
@@ -115,13 +115,13 @@ Try<Jvm*> Jvm::create(
bool Jvm::created()
{
- return instance != NULL;
+ return instance != nullptr;
}
Jvm* Jvm::get()
{
- if (instance == NULL) {
+ if (instance == nullptr) {
create();
}
return CHECK_NOTNULL(instance);
@@ -242,7 +242,7 @@ Jvm::Field::Field(const Class& _clazz, const jfieldID _id)
Jvm::Env::Env(bool daemon)
- : env(NULL), detach(false)
+ : env(nullptr), detach(false)
{
JavaVM* jvm = Jvm::get()->jvm;
@@ -252,9 +252,9 @@ Jvm::Env::Env(bool daemon)
// If we're not attached, attach now.
if (result == JNI_EDETACHED) {
if (daemon) {
- jvm->AttachCurrentThreadAsDaemon(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThreadAsDaemon(JNIENV_CAST(&env), nullptr);
} else {
- jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
+ jvm->AttachCurrentThread(JNIENV_CAST(&env), nullptr);
}
detach = true;
}
@@ -546,7 +546,7 @@ jobject Jvm::newGlobalRef(const jobject object)
void Jvm::deleteGlobalRef(const jobject object)
{
Env env;
- if (object != NULL) {
+ if (object != nullptr) {
env->DeleteGlobalRef(object);
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/jvm/jvm.hpp
----------------------------------------------------------------------
diff --git a/src/jvm/jvm.hpp b/src/jvm/jvm.hpp
index d5023e4..06565a8 100644
--- a/src/jvm/jvm.hpp
+++ b/src/jvm/jvm.hpp
@@ -244,33 +244,33 @@ public:
class Object
{
public:
- Object() : object(NULL) {}
+ Object() : object(nullptr) {}
explicit Object(jobject _object)
: object(Jvm::get()->newGlobalRef(_object)) {}
Object(const Object& that)
- : object(NULL)
+ : object(nullptr)
{
- if (that.object != NULL) {
+ if (that.object != nullptr) {
object = Jvm::get()->newGlobalRef(that.object);
}
}
~Object()
{
- if (object != NULL) {
+ if (object != nullptr) {
Jvm::get()->deleteGlobalRef(object);
}
}
Object& operator=(const Object& that)
{
- if (object != NULL) {
+ if (object != nullptr) {
Jvm::get()->deleteGlobalRef(object);
- object = NULL;
+ object = nullptr;
}
- if (that.object != NULL) {
+ if (that.object != nullptr) {
object = Jvm::get()->newGlobalRef(that.object);
}
return *this;
@@ -299,14 +299,14 @@ public:
: clazz(_clazz)
{
// Check that T extends Object.
- { T* t = NULL; Object* o = t; (void) o; }
+ { T* t = nullptr; Object* o = t; (void) o; }
}
Variable(const Class& _clazz, const Object& _object)
: clazz(_clazz), object(_object)
{
// Check that T extends Object.
- { T* t = NULL; Object* o = t; (void) o; }
+ { T* t = nullptr; Object* o = t; (void) o; }
}
// TODO(benh): Implement cast operator (like in StaticVariable).
@@ -317,7 +317,7 @@ public:
{
// Check that U extends Object (but not necessarily T since U
// might be 'Null').
- { U* u = NULL; Object* o = u; (void) o; }
+ { U* u = nullptr; Object* o = u; (void) o; }
// Note that we actually look up the field lazily (upon first
// assignment operator) so that we don't possibly create the JVM
@@ -351,7 +351,7 @@ public:
: clazz(_clazz)
{
// Check that T extends Object.
- { T* t = NULL; Object* o = t; (void) o; }
+ { T* t = nullptr; Object* o = t; (void) o; }
}
operator T() const
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/jvm/org/apache/zookeeper.hpp
----------------------------------------------------------------------
diff --git a/src/jvm/org/apache/zookeeper.hpp b/src/jvm/org/apache/zookeeper.hpp
index 7e9c3aa..2776a1c 100644
--- a/src/jvm/org/apache/zookeeper.hpp
+++ b/src/jvm/org/apache/zookeeper.hpp
@@ -101,7 +101,7 @@ public:
// We need to "bind" the 'sessionTracker' Variable after we assign
// 'object' above so that '*this' is a Jvm::Object instance that
- // doesn't point to a NULL jobject.
+ // doesn't point to a nullptr jobject.
sessionTracker.bind(*this);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/launcher/executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp
index e4c3b75..ffebb3a 100644
--- a/src/launcher/executor.cpp
+++ b/src/launcher/executor.cpp
@@ -411,15 +411,15 @@ protected:
for (int i = 0; i < command.arguments().size(); i++) {
argv[i] = (char*) command.arguments(i).c_str();
}
- argv[command.arguments().size()] = NULL;
+ argv[command.arguments().size()] = nullptr;
// Prepare the command log message.
string commandString;
if (override.isSome()) {
char** argv = override.get();
- // argv is guaranteed to be NULL terminated and we rely on
+ // argv is guaranteed to be nullptr terminated and we rely on
// that fact to print command to be executed.
- for (int i = 0; argv[i] != NULL; i++) {
+ for (int i = 0; argv[i] != nullptr; i++) {
commandString += string(argv[i]) + " ";
}
} else if (command.shell()) {
@@ -528,7 +528,7 @@ protected:
"sh",
"-c",
command.value().c_str(),
- (char*) NULL);
+ (char*) nullptr);
} else {
execvp(command.value().c_str(), argv);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/linux/cgroups.cpp
----------------------------------------------------------------------
diff --git a/src/linux/cgroups.cpp b/src/linux/cgroups.cpp
index b57ec05..95ceb37 100644
--- a/src/linux/cgroups.cpp
+++ b/src/linux/cgroups.cpp
@@ -897,17 +897,17 @@ Try<vector<string>> get(const string& hierarchy, const string& cgroup)
: "No such file or directory"));
}
- char* paths[] = { const_cast<char*>(destAbsPath.get().c_str()), NULL };
+ char* paths[] = { const_cast<char*>(destAbsPath.get().c_str()), nullptr };
- FTS* tree = fts_open(paths, FTS_NOCHDIR, NULL);
- if (tree == NULL) {
+ FTS* tree = fts_open(paths, FTS_NOCHDIR, nullptr);
+ if (tree == nullptr) {
return ErrnoError("Failed to start traversing file system");
}
vector<string> cgroups;
FTSENT* node;
- while ((node = fts_read(tree)) != NULL) {
+ while ((node = fts_read(tree)) != nullptr) {
// Use post-order walk here. fts_level is the depth of the traversal,
// numbered from -1 to N, where the file/dir was found. The traversal root
// itself is numbered 0. fts_info includes flags for the current node.
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/linux/fs.cpp
----------------------------------------------------------------------
diff --git a/src/linux/fs.cpp b/src/linux/fs.cpp
index 3190fce..cb8295e 100644
--- a/src/linux/fs.cpp
+++ b/src/linux/fs.cpp
@@ -232,7 +232,7 @@ bool MountTable::Entry::hasOption(const string& option) const
mntent.mnt_opts = const_cast<char*>(opts.c_str());
mntent.mnt_freq = freq;
mntent.mnt_passno = passno;
- return ::hasmntopt(&mntent, option.c_str()) != NULL;
+ return ::hasmntopt(&mntent, option.c_str()) != nullptr;
}
@@ -241,7 +241,7 @@ Try<MountTable> MountTable::read(const string& path)
MountTable table;
FILE* file = ::setmntent(path.c_str(), "r");
- if (file == NULL) {
+ if (file == nullptr) {
return Error("Failed to open '" + path + "'");
}
@@ -252,8 +252,8 @@ Try<MountTable> MountTable::read(const string& path)
char strBuffer[PATH_MAX];
struct mntent* mntent =
::getmntent_r(file, &mntentBuffer, strBuffer, sizeof(strBuffer));
- if (mntent == NULL) {
- // NULL means the end of enties.
+ if (mntent == nullptr) {
+ // nullptr means the end of enties.
break;
}
@@ -272,8 +272,8 @@ Try<MountTable> MountTable::read(const string& path)
synchronized (mutex) {
struct mntent* mntent = ::getmntent(file);
- if (mntent == NULL) {
- // NULL means the end of enties.
+ if (mntent == nullptr) {
+ // nullptr means the end of enties.
break;
}
@@ -311,8 +311,8 @@ Try<FileSystemTable> FileSystemTable::read()
while (true) {
struct fstab* fstab = ::getfsent();
- if (fstab == NULL) {
- break; // NULL means the end of enties.
+ if (fstab == nullptr) {
+ break; // nullptr means the end of enties.
}
FileSystemTable::Entry entry(
@@ -347,9 +347,9 @@ Try<Nothing> mount(const Option<string>& source,
// unsigned long mountflags,
// const void *data);
if (::mount(
- (source.isSome() ? source.get().c_str() : NULL),
+ (source.isSome() ? source.get().c_str() : nullptr),
target.c_str(),
- (type.isSome() ? type.get().c_str() : NULL),
+ (type.isSome() ? type.get().c_str() : nullptr),
flags,
data) < 0) {
return ErrnoError();
@@ -370,7 +370,7 @@ Try<Nothing> mount(const Option<string>& source,
target,
type,
flags,
- options.isSome() ? options.get().c_str() : NULL);
+ options.isSome() ? options.get().c_str() : nullptr);
}
@@ -599,14 +599,16 @@ Try<Nothing> createStandardDevices(const string& root)
Try<Nothing> enter(const string& root)
{
// Recursively mark current mounts as slaves to prevent propagation.
- Try<Nothing> mount = fs::mount(None(), "/", None(), MS_REC | MS_SLAVE, NULL);
+ Try<Nothing> mount =
+ fs::mount(None(), "/", None(), MS_REC | MS_SLAVE, nullptr);
+
if (mount.isError()) {
return Error("Failed to make slave mounts: " + mount.error());
}
// Bind mount 'root' itself. This is because pivot_root requires
// 'root' to be not on the same filesystem as process' current root.
- mount = fs::mount(root, root, None(), MS_REC | MS_BIND, NULL);
+ mount = fs::mount(root, root, None(), MS_REC | MS_BIND, nullptr);
if (mount.isError()) {
return Error("Failed to bind mount root itself: " + mount.error());
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/linux/fs.hpp
----------------------------------------------------------------------
diff --git a/src/linux/fs.hpp b/src/linux/fs.hpp
index 5951f3f..0359e28 100644
--- a/src/linux/fs.hpp
+++ b/src/linux/fs.hpp
@@ -310,14 +310,14 @@ struct FileSystemTable {
// Mount a file system.
// @param source Specify the file system (often a device name but
// it can also be a directory for a bind mount).
-// If None(), NULL will be passed as a dummy
+// If None(), nullptr will be passed as a dummy
// argument to mount(), i.e., it is not used for
// the specified mount operation. For example, you
// can mount a filesystem specified in /etc/fstab
// by just specifying the target.
// @param target Directory to be attached to.
// @param type File system type (listed in /proc/filesystems).
-// If None(), NULL will be passed as a dummy
+// If None(), nullptr will be passed as a dummy
// argument to mount(), i.e., it is not used for
// the specified mount operation. For example, it
// should be None() for a bind mount as it will
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/linux/perf.cpp
----------------------------------------------------------------------
diff --git a/src/linux/perf.cpp b/src/linux/perf.cpp
index 2364ab5..ea823b3 100644
--- a/src/linux/perf.cpp
+++ b/src/linux/perf.cpp
@@ -390,7 +390,7 @@ Try<hashmap<string, mesos::PerfStatistics>> parse(
statistics[sample->cgroup].GetDescriptor()->FindFieldByName(
sample->event);
- if (field == NULL) {
+ if (field == nullptr) {
return Error("Unexpected event '" + sample->event + "'"
" in perf output at line: " + line);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/linux/routing/diagnosis/diagnosis.cpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/diagnosis/diagnosis.cpp b/src/linux/routing/diagnosis/diagnosis.cpp
index 8b86a88..ce54697 100644
--- a/src/linux/routing/diagnosis/diagnosis.cpp
+++ b/src/linux/routing/diagnosis/diagnosis.cpp
@@ -36,7 +36,7 @@ namespace socket {
static Option<net::IP> IP(nl_addr* _ip)
{
Option<net::IP> result;
- if (_ip != NULL && nl_addr_get_len(_ip) != 0) {
+ if (_ip != nullptr && nl_addr_get_len(_ip) != 0) {
struct in_addr* addr = (struct in_addr*) nl_addr_get_binary_addr(_ip);
result = net::IP(*addr);
}
@@ -52,7 +52,7 @@ Try<vector<Info>> infos(int family, int states)
return Error(socket.error());
}
- struct nl_cache* c = NULL;
+ struct nl_cache* c = nullptr;
int error = idiagnl_msg_alloc_cache(socket.get().get(), family, states, &c);
if (error != 0) {
return Error(nl_geterror(error));
@@ -62,7 +62,7 @@ Try<vector<Info>> infos(int family, int states)
vector<Info> results;
for (struct nl_object* o = nl_cache_get_first(cache.get());
- o != NULL; o = nl_cache_get_next(o)) {
+ o != nullptr; o = nl_cache_get_next(o)) {
struct idiagnl_msg* msg = (struct idiagnl_msg*)o;
// For 'state', libnl-idiag only returns the number of left
[3/4] mesos git commit: Replaced `NULL` with `nullptr` in mesos.
Posted by mp...@apache.org.
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/linux/routing/filter/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/filter/internal.hpp b/src/linux/routing/filter/internal.hpp
index 8690bf5..6c174e1 100644
--- a/src/linux/routing/filter/internal.hpp
+++ b/src/linux/routing/filter/internal.hpp
@@ -100,7 +100,7 @@ inline Try<Nothing> attach(
// because libnl has a refcount issue for rtnl_act. Clean this up
// once the bug is fixed in libnl.
struct rtnl_act* act = rtnl_act_alloc();
- if (act == NULL) {
+ if (act == nullptr) {
return Error("Failed to allocate a libnl action (rtnl_act)");
}
@@ -168,7 +168,7 @@ inline Try<Nothing> attach(
// 'act' because libnl has a refcount issue for rtnl_act. Clean
// this up once libnl fixes the bug.
struct rtnl_act* act = rtnl_act_alloc();
- if (act == NULL) {
+ if (act == nullptr) {
return Error("Failed to allocate a libnl action (rtnl_act)");
}
@@ -251,19 +251,19 @@ inline Try<Nothing> attach(
{
const action::Redirect* redirect =
dynamic_cast<const action::Redirect*>(action.get());
- if (redirect != NULL) {
+ if (redirect != nullptr) {
return attach(cls, *redirect);
}
const action::Mirror* mirror =
dynamic_cast<const action::Mirror*>(action.get());
- if (mirror != NULL) {
+ if (mirror != nullptr) {
return attach(cls, *mirror);
}
const action::Terminal* terminal =
dynamic_cast<const action::Terminal*>(action.get());
- if (terminal != NULL) {
+ if (terminal != nullptr) {
return attach(cls, *terminal);
}
@@ -293,7 +293,7 @@ Result<U32Handle> generateU32Handle(
// Dump all the libnl filters (i.e., rtnl_cls) attached to the given
// parent on the link.
- struct nl_cache* c = NULL;
+ struct nl_cache* c = nullptr;
int error = rtnl_cls_alloc_cache(
socket.get().get(),
rtnl_link_get_ifindex(link.get()),
@@ -315,7 +315,7 @@ Result<U32Handle> generateU32Handle(
hashmap<uint32_t, hashset<uint32_t>> nodes;
for (struct nl_object* o = nl_cache_get_first(cache.get());
- o != NULL; o = nl_cache_get_next(o)) {
+ o != nullptr; o = nl_cache_get_next(o)) {
struct rtnl_cls* cls = (struct rtnl_cls*) o;
// Only look at u32 filters. For other type of filters, their
@@ -359,7 +359,7 @@ Try<Netlink<struct rtnl_cls>> encodeFilter(
const Filter<Classifier>& filter)
{
struct rtnl_cls* c = rtnl_cls_alloc();
- if (c == NULL) {
+ if (c == nullptr) {
return Error("Failed to allocate a libnl filter (rtnl_cls)");
}
@@ -496,7 +496,7 @@ inline Try<std::vector<Netlink<struct rtnl_cls>>> getClses(
// Dump all the libnl filters (i.e., rtnl_cls) attached to the given
// parent on the link.
- struct nl_cache* c = NULL;
+ struct nl_cache* c = nullptr;
int error = rtnl_cls_alloc_cache(
socket.get().get(),
rtnl_link_get_ifindex(link.get()),
@@ -514,7 +514,7 @@ inline Try<std::vector<Netlink<struct rtnl_cls>>> getClses(
std::vector<Netlink<struct rtnl_cls>> results;
for (struct nl_object* o = nl_cache_get_first(cache.get());
- o != NULL; o = nl_cache_get_next(o)) {
+ o != nullptr; o = nl_cache_get_next(o)) {
// NOTE: We increment the reference counter here because 'cache'
// will be freed when this function finishes and we want this
// object's life to be longer than this function.
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/linux/routing/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/internal.hpp b/src/linux/routing/internal.hpp
index 8f68119..9396346 100644
--- a/src/linux/routing/internal.hpp
+++ b/src/linux/routing/internal.hpp
@@ -69,7 +69,7 @@ private:
~Data()
{
- if (object != NULL) {
+ if (object != nullptr) {
cleanup(object);
}
}
@@ -94,7 +94,7 @@ inline Try<Netlink<struct nl_sock>> socket(int protocol = NETLINK_ROUTE)
}
struct nl_sock* s = nl_socket_alloc();
- if (s == NULL) {
+ if (s == nullptr) {
return Error("Failed to allocate netlink socket");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/linux/routing/link/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/link/internal.hpp b/src/linux/routing/link/internal.hpp
index 8f05e5f..eb89b9a 100644
--- a/src/linux/routing/link/internal.hpp
+++ b/src/linux/routing/link/internal.hpp
@@ -56,7 +56,7 @@ inline Result<Netlink<struct rtnl_link>> get(const std::string& link)
// Dump all the netlink link objects from kernel. Note that the flag
// AF_UNSPEC means all available families.
- struct nl_cache* c = NULL;
+ struct nl_cache* c = nullptr;
int error = rtnl_link_alloc_cache(socket.get().get(), AF_UNSPEC, &c);
if (error != 0) {
return Error(nl_geterror(error));
@@ -64,7 +64,7 @@ inline Result<Netlink<struct rtnl_link>> get(const std::string& link)
Netlink<struct nl_cache> cache(c);
struct rtnl_link* l = rtnl_link_get_by_name(cache.get(), link.c_str());
- if (l == NULL) {
+ if (l == nullptr) {
return None();
}
@@ -83,7 +83,7 @@ inline Result<Netlink<struct rtnl_link>> get(int index)
// Dump all the netlink link objects from kernel. Note that the flag
// AF_UNSPEC means all available families.
- struct nl_cache* c = NULL;
+ struct nl_cache* c = nullptr;
int error = rtnl_link_alloc_cache(socket.get().get(), AF_UNSPEC, &c);
if (error != 0) {
return Error(nl_geterror(error));
@@ -91,7 +91,7 @@ inline Result<Netlink<struct rtnl_link>> get(int index)
Netlink<struct nl_cache> cache(c);
struct rtnl_link* l = rtnl_link_get(cache.get(), index);
- if (l == NULL) {
+ if (l == nullptr) {
return None();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/linux/routing/queueing/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/queueing/internal.hpp b/src/linux/routing/queueing/internal.hpp
index 768ed32..151d1b1 100644
--- a/src/linux/routing/queueing/internal.hpp
+++ b/src/linux/routing/queueing/internal.hpp
@@ -79,7 +79,7 @@ Try<Netlink<struct rtnl_qdisc>> encodeDiscipline(
const Discipline<Config>& discipline)
{
struct rtnl_qdisc* q = rtnl_qdisc_alloc();
- if (q == NULL) {
+ if (q == nullptr) {
return Error("Failed to allocate a libnl qdisc");
}
@@ -124,7 +124,7 @@ inline Try<std::vector<Netlink<struct rtnl_qdisc>>> getQdiscs(
}
// Dump all the queueing discipline from kernel.
- struct nl_cache* c = NULL;
+ struct nl_cache* c = nullptr;
int error = rtnl_qdisc_alloc_cache(socket.get().get(), &c);
if (error != 0) {
return Error(
@@ -137,7 +137,7 @@ inline Try<std::vector<Netlink<struct rtnl_qdisc>>> getQdiscs(
std::vector<Netlink<struct rtnl_qdisc>> results;
for (struct nl_object* o = nl_cache_get_first(cache.get());
- o != NULL; o = nl_cache_get_next(o)) {
+ o != nullptr; o = nl_cache_get_next(o)) {
if (rtnl_tc_get_ifindex(TC_CAST(o)) == rtnl_link_get_ifindex(link.get())) {
// NOTE: We increment the reference counter here because 'cache'
// will be freed when this function finishes and we want this
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/linux/routing/route.cpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/route.cpp b/src/linux/routing/route.cpp
index 4b33350..ceeaf8e 100644
--- a/src/linux/routing/route.cpp
+++ b/src/linux/routing/route.cpp
@@ -53,7 +53,7 @@ Try<vector<Rule>> table()
}
// Dump all the routes (for IPv4) from kernel.
- struct nl_cache* c = NULL;
+ struct nl_cache* c = nullptr;
int error = rtnl_route_alloc_cache(socket.get().get(), AF_INET, 0, &c);
if (error != 0) {
return Error(nl_geterror(error));
@@ -65,7 +65,7 @@ Try<vector<Rule>> table()
// Scan the routes and look for entries in the main routing table.
for (struct nl_object* o = nl_cache_get_first(cache.get());
- o != NULL; o = nl_cache_get_next(o)) {
+ o != nullptr; o = nl_cache_get_next(o)) {
struct rtnl_route* route = (struct rtnl_route*) o;
// TODO(jieyu): Currently, we assume each route in the routing
@@ -77,7 +77,7 @@ Try<vector<Rule>> table()
// Get the destination IP network if exists.
Option<net::IPNetwork> destination;
struct nl_addr* dst = rtnl_route_get_dst(route);
- if (dst != NULL && nl_addr_get_len(dst) != 0) {
+ if (dst != nullptr && nl_addr_get_len(dst) != 0) {
struct in_addr* addr = (struct in_addr*) nl_addr_get_binary_addr(dst);
Try<net::IPNetwork> network = net::IPNetwork::create(
net::IP(*addr),
@@ -96,7 +96,7 @@ Try<vector<Rule>> table()
Option<net::IP> gateway;
struct rtnl_nexthop* hop = rtnl_route_nexthop_n(route, 0);
struct nl_addr* gw = rtnl_route_nh_get_gateway(CHECK_NOTNULL(hop));
- if (gw != NULL && nl_addr_get_len(gw) != 0) {
+ if (gw != nullptr && nl_addr_get_len(gw) != 0) {
struct in_addr* addr = (struct in_addr*) nl_addr_get_binary_addr(gw);
gateway = net::IP(*addr);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/linux/systemd.cpp
----------------------------------------------------------------------
diff --git a/src/linux/systemd.cpp b/src/linux/systemd.cpp
index 9f6e06c..3e1ba93 100644
--- a/src/linux/systemd.cpp
+++ b/src/linux/systemd.cpp
@@ -58,7 +58,7 @@ Flags::Flags()
}
-static Flags* systemd_flags = NULL;
+static Flags* systemd_flags = nullptr;
const Flags& flags()
@@ -259,7 +259,7 @@ bool exists()
bool enabled()
{
- return systemd_flags != NULL && flags().enabled && exists();
+ return systemd_flags != nullptr && flags().enabled && exists();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/local/local.cpp
----------------------------------------------------------------------
diff --git a/src/local/local.cpp b/src/local/local.cpp
index d5dc49f..8f84b54 100644
--- a/src/local/local.cpp
+++ b/src/local/local.cpp
@@ -122,31 +122,31 @@ namespace mesos {
namespace internal {
namespace local {
-static Allocator* allocator = NULL;
-static Log* log = NULL;
-static mesos::state::Storage* storage = NULL;
-static mesos::state::protobuf::State* state = NULL;
-static Registrar* registrar = NULL;
-static Master* master = NULL;
+static Allocator* allocator = nullptr;
+static Log* log = nullptr;
+static mesos::state::Storage* storage = nullptr;
+static mesos::state::protobuf::State* state = nullptr;
+static Registrar* registrar = nullptr;
+static Master* master = nullptr;
static map<Containerizer*, Slave*> slaves;
-static StandaloneMasterDetector* detector = NULL;
-static MasterContender* contender = NULL;
+static StandaloneMasterDetector* detector = nullptr;
+static MasterContender* contender = nullptr;
static Option<Authorizer*> authorizer_ = None();
-static Files* files = NULL;
-static vector<GarbageCollector*>* garbageCollectors = NULL;
-static vector<StatusUpdateManager*>* statusUpdateManagers = NULL;
-static vector<Fetcher*>* fetchers = NULL;
-static vector<ResourceEstimator*>* resourceEstimators = NULL;
-static vector<QoSController*>* qosControllers = NULL;
+static Files* files = nullptr;
+static vector<GarbageCollector*>* garbageCollectors = nullptr;
+static vector<StatusUpdateManager*>* statusUpdateManagers = nullptr;
+static vector<Fetcher*>* fetchers = nullptr;
+static vector<ResourceEstimator*>* resourceEstimators = nullptr;
+static vector<QoSController*>* qosControllers = nullptr;
PID<Master> launch(const Flags& flags, Allocator* _allocator)
{
- if (master != NULL) {
+ if (master != nullptr) {
LOG(FATAL) << "Can only launch one local cluster at a time (for now)";
}
- if (_allocator == NULL) {
+ if (_allocator == nullptr) {
// Create a default allocator.
Try<Allocator*> defaultAllocator = HierarchicalDRFAllocator::create();
if (defaultAllocator.isError()) {
@@ -163,7 +163,7 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
} else {
// TODO(benh): Figure out the behavior of allocator pointer and remove the
// else block.
- allocator = NULL;
+ allocator = nullptr;
}
files = new Files();
@@ -439,12 +439,12 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
void shutdown()
{
- if (master != NULL) {
+ if (master != nullptr) {
process::terminate(master->self());
process::wait(master->self());
delete master;
delete allocator;
- master = NULL;
+ master = nullptr;
// TODO(benh): Ugh! Because the isolator calls back into the slave
// (not the best design) we can't delete the slave until we have
@@ -467,60 +467,60 @@ void shutdown()
}
delete detector;
- detector = NULL;
+ detector = nullptr;
delete contender;
- contender = NULL;
+ contender = nullptr;
delete files;
- files = NULL;
+ files = nullptr;
foreach (GarbageCollector* gc, *garbageCollectors) {
delete gc;
}
delete garbageCollectors;
- garbageCollectors = NULL;
+ garbageCollectors = nullptr;
foreach (StatusUpdateManager* statusUpdateManager, *statusUpdateManagers) {
delete statusUpdateManager;
}
delete statusUpdateManagers;
- statusUpdateManagers = NULL;
+ statusUpdateManagers = nullptr;
foreach (Fetcher* fetcher, *fetchers) {
delete fetcher;
}
delete fetchers;
- fetchers = NULL;
+ fetchers = nullptr;
foreach (ResourceEstimator* estimator, *resourceEstimators) {
delete estimator;
}
delete resourceEstimators;
- resourceEstimators = NULL;
+ resourceEstimators = nullptr;
foreach (QoSController* controller, *qosControllers) {
delete controller;
}
delete qosControllers;
- qosControllers = NULL;
+ qosControllers = nullptr;
delete registrar;
- registrar = NULL;
+ registrar = nullptr;
delete state;
- state = NULL;
+ state = nullptr;
delete storage;
- storage = NULL;
+ storage = nullptr;
delete log;
- log = NULL;
+ log = nullptr;
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/local/local.hpp
----------------------------------------------------------------------
diff --git a/src/local/local.hpp b/src/local/local.hpp
index f4ae285..0c86f97 100644
--- a/src/local/local.hpp
+++ b/src/local/local.hpp
@@ -38,7 +38,7 @@ namespace local {
// Launch a local cluster with the given flags.
process::PID<master::Master> launch(
const Flags& flags,
- mesos::master::allocator::Allocator* _allocator = NULL);
+ mesos::master::allocator::Allocator* _allocator = nullptr);
void shutdown();
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/log/leveldb.cpp
----------------------------------------------------------------------
diff --git a/src/log/leveldb.cpp b/src/log/leveldb.cpp
index ba2f62b..f389d74 100644
--- a/src/log/leveldb.cpp
+++ b/src/log/leveldb.cpp
@@ -127,7 +127,7 @@ static string encode(uint64_t position, bool adjust = true)
LevelDBStorage::LevelDBStorage()
- : db(NULL), first(None())
+ : db(nullptr), first(None())
{
// Nothing to see here.
}
@@ -176,7 +176,7 @@ Try<Storage::State> LevelDBStorage::restore(const string& path)
stopwatch.start(); // Restart the stopwatch.
// TODO(benh): Conditionally compact to avoid long recovery times?
- db->CompactRange(NULL, NULL);
+ db->CompactRange(nullptr, nullptr);
LOG(INFO) << "Compacted db in " << stopwatch.elapsed();
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/log/log.cpp
----------------------------------------------------------------------
diff --git a/src/log/log.cpp b/src/log/log.cpp
index a52b35c..c0f1cb3 100644
--- a/src/log/log.cpp
+++ b/src/log/log.cpp
@@ -70,7 +70,7 @@ LogProcess::LogProcess(
replica(new Replica(path)),
network(new Network(pids + (UPID) replica->pid())),
autoInitialize(_autoInitialize),
- group(NULL) {}
+ group(nullptr) {}
LogProcess::LogProcess(
@@ -96,7 +96,7 @@ LogProcess::LogProcess(
void LogProcess::initialize()
{
- if (group != NULL) {
+ if (group != nullptr) {
// Need to add our replica to the ZooKeeper group!
LOG(INFO) << "Attempting to join replica to ZooKeeper group";
@@ -435,7 +435,7 @@ LogWriterProcess::LogWriterProcess(Log* log)
quorum(log->process->quorum),
network(log->process->network),
recovering(dispatch(log->process, &LogProcess::recover)),
- coordinator(NULL),
+ coordinator(nullptr),
error(None()) {}
@@ -547,7 +547,7 @@ Future<Option<Log::Position> > LogWriterProcess::append(const string& bytes)
{
LOG(INFO) << "Attempting to append " << bytes.size() << " bytes to the log";
- if (coordinator == NULL) {
+ if (coordinator == nullptr) {
return Failure("No election has been performed");
}
@@ -566,7 +566,7 @@ Future<Option<Log::Position> > LogWriterProcess::truncate(
{
LOG(INFO) << "Attempting to truncate the log to " << to.value;
- if (coordinator == NULL) {
+ if (coordinator == nullptr) {
return Failure("No election has been performed");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/log/tool/benchmark.cpp
----------------------------------------------------------------------
diff --git a/src/log/tool/benchmark.cpp b/src/log/tool/benchmark.cpp
index 7e13506..da35b08 100644
--- a/src/log/tool/benchmark.cpp
+++ b/src/log/tool/benchmark.cpp
@@ -112,7 +112,7 @@ Try<Nothing> Benchmark::execute(int argc, char** argv)
"\n");
// Configure the tool by parsing command line arguments.
- if (argc > 0 && argv != NULL) {
+ if (argc > 0 && argv != nullptr) {
Try<flags::Warnings> load = flags.load(None(), argc, argv);
if (load.isError()) {
return Error(flags.usage(load.error()));
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/log/tool/benchmark.hpp
----------------------------------------------------------------------
diff --git a/src/log/tool/benchmark.hpp b/src/log/tool/benchmark.hpp
index 3051b6f..e905e85 100644
--- a/src/log/tool/benchmark.hpp
+++ b/src/log/tool/benchmark.hpp
@@ -49,7 +49,7 @@ public:
};
virtual std::string name() const { return "benchmark"; }
- virtual Try<Nothing> execute(int argc = 0, char** argv = NULL);
+ virtual Try<Nothing> execute(int argc = 0, char** argv = nullptr);
// Users can change the default configuration by setting this flags.
Flags flags;
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/log/tool/initialize.cpp
----------------------------------------------------------------------
diff --git a/src/log/tool/initialize.cpp b/src/log/tool/initialize.cpp
index e980772..6a12505 100644
--- a/src/log/tool/initialize.cpp
+++ b/src/log/tool/initialize.cpp
@@ -53,7 +53,7 @@ Try<Nothing> Initialize::execute(int argc, char** argv)
"\n");
// Configure the tool by parsing command line arguments.
- if (argc > 0 && argv != NULL) {
+ if (argc > 0 && argv != nullptr) {
Try<flags::Warnings> load = flags.load(None(), argc, argv);
if (load.isError()) {
return Error(flags.usage(load.error()));
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/log/tool/initialize.hpp
----------------------------------------------------------------------
diff --git a/src/log/tool/initialize.hpp b/src/log/tool/initialize.hpp
index 99c8006..33d2c5c 100644
--- a/src/log/tool/initialize.hpp
+++ b/src/log/tool/initialize.hpp
@@ -44,7 +44,7 @@ public:
};
virtual std::string name() const { return "initialize"; }
- virtual Try<Nothing> execute(int argc = 0, char** argv = NULL);
+ virtual Try<Nothing> execute(int argc = 0, char** argv = nullptr);
// Users can change the default configuration by setting this flags.
Flags flags;
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/log/tool/read.cpp
----------------------------------------------------------------------
diff --git a/src/log/tool/read.cpp b/src/log/tool/read.cpp
index 415038d..7b30898 100644
--- a/src/log/tool/read.cpp
+++ b/src/log/tool/read.cpp
@@ -69,7 +69,7 @@ Try<Nothing> Read::execute(int argc, char** argv)
"\n");
// Configure the tool by parsing command line arguments.
- if (argc > 0 && argv != NULL) {
+ if (argc > 0 && argv != nullptr) {
Try<flags::Warnings> load = flags.load(None(), argc, argv);
if (load.isError()) {
return Error(flags.usage(load.error()));
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/log/tool/read.hpp
----------------------------------------------------------------------
diff --git a/src/log/tool/read.hpp b/src/log/tool/read.hpp
index 937ae8f..7ec8275 100644
--- a/src/log/tool/read.hpp
+++ b/src/log/tool/read.hpp
@@ -48,7 +48,7 @@ public:
};
virtual std::string name() const { return "read"; }
- virtual Try<Nothing> execute(int argc = 0, char** argv = NULL);
+ virtual Try<Nothing> execute(int argc = 0, char** argv = nullptr);
// Users can change the default configuration by setting this flags.
Flags flags;
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/log/tool/replica.cpp
----------------------------------------------------------------------
diff --git a/src/log/tool/replica.cpp b/src/log/tool/replica.cpp
index 11aef65..45bd1f4 100644
--- a/src/log/tool/replica.cpp
+++ b/src/log/tool/replica.cpp
@@ -71,7 +71,7 @@ Try<Nothing> Replica::execute(int argc, char** argv)
"\n");
// Configure the tool by parsing command line arguments.
- if (argc > 0 && argv != NULL) {
+ if (argc > 0 && argv != nullptr) {
Try<flags::Warnings> load = flags.load(None(), argc, argv);
if (load.isError()) {
return Error(flags.usage(load.error()));
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/log/tool/replica.hpp
----------------------------------------------------------------------
diff --git a/src/log/tool/replica.hpp b/src/log/tool/replica.hpp
index c25bb09..9ca92ae 100644
--- a/src/log/tool/replica.hpp
+++ b/src/log/tool/replica.hpp
@@ -49,7 +49,7 @@ public:
};
virtual std::string name() const { return "replica"; }
- virtual Try<Nothing> execute(int argc = 0, char** argv = NULL);
+ virtual Try<Nothing> execute(int argc = 0, char** argv = nullptr);
// Users can change the default configuration by setting this flags.
Flags flags;
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/logging/logging.cpp
----------------------------------------------------------------------
diff --git a/src/logging/logging.cpp b/src/logging/logging.cpp
index 7ea1899..7f2d843 100644
--- a/src/logging/logging.cpp
+++ b/src/logging/logging.cpp
@@ -225,7 +225,7 @@ void initialize(
// We also do not want SIGTERM to dump a stacktrace, as this
// can imply that we crashed, when we were in fact terminated
// by user request.
- if (sigaction(SIGTERM, &action, NULL) < 0) {
+ if (sigaction(SIGTERM, &action, nullptr) < 0) {
PLOG(FATAL) << "Failed to set sigaction";
}
#endif // __WINDOWS__
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/master/allocator/mesos/hierarchical.hpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/hierarchical.hpp b/src/master/allocator/mesos/hierarchical.hpp
index 3f5dff7..9c6b23a 100644
--- a/src/master/allocator/mesos/hierarchical.hpp
+++ b/src/master/allocator/mesos/hierarchical.hpp
@@ -78,8 +78,8 @@ public:
initialized(false),
paused(true),
metrics(*this),
- roleSorter(NULL),
- quotaRoleSorter(NULL),
+ roleSorter(nullptr),
+ quotaRoleSorter(nullptr),
roleSorterFactory(_roleSorterFactory),
frameworkSorterFactory(_frameworkSorterFactory),
quotaRoleSorterFactory(_quotaRoleSorterFactory) {}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/master/contender/standalone.cpp
----------------------------------------------------------------------
diff --git a/src/master/contender/standalone.cpp b/src/master/contender/standalone.cpp
index 5db792f..6d6d527 100644
--- a/src/master/contender/standalone.cpp
+++ b/src/master/contender/standalone.cpp
@@ -28,7 +28,7 @@ namespace contender {
StandaloneMasterContender::~StandaloneMasterContender()
{
- if (promise != NULL) {
+ if (promise != nullptr) {
promise->set(Nothing()); // Leadership lost.
delete promise;
}
@@ -50,7 +50,7 @@ Future<Future<Nothing>> StandaloneMasterContender::contend()
return Failure("Initialize the contender first");
}
- if (promise != NULL) {
+ if (promise != nullptr) {
LOG(INFO) << "Withdrawing the previous membership before recontending";
promise->set(Nothing());
delete promise;
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/master/contender/standalone.hpp
----------------------------------------------------------------------
diff --git a/src/master/contender/standalone.hpp b/src/master/contender/standalone.hpp
index 256a4bc..7f68d27 100644
--- a/src/master/contender/standalone.hpp
+++ b/src/master/contender/standalone.hpp
@@ -36,7 +36,7 @@ class StandaloneMasterContender : public MasterContender
public:
StandaloneMasterContender()
: initialized(false),
- promise(NULL) {}
+ promise(nullptr) {}
virtual ~StandaloneMasterContender();
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/master/contender/zookeeper.cpp
----------------------------------------------------------------------
diff --git a/src/master/contender/zookeeper.cpp b/src/master/contender/zookeeper.cpp
index 6c9305c..e1a69d3 100644
--- a/src/master/contender/zookeeper.cpp
+++ b/src/master/contender/zookeeper.cpp
@@ -112,7 +112,7 @@ ZooKeeperMasterContenderProcess::ZooKeeperMasterContenderProcess(
Owned<Group> _group)
: ProcessBase(ID::generate("zookeeper-master-contender")),
group(_group),
- contender(NULL) {}
+ contender(nullptr) {}
ZooKeeperMasterContenderProcess::~ZooKeeperMasterContenderProcess()
@@ -137,7 +137,7 @@ Future<Future<Nothing>> ZooKeeperMasterContenderProcess::contend()
return candidacy.get();
}
- if (contender != NULL) {
+ if (contender != nullptr) {
LOG(INFO) << "Withdrawing the previous membership before recontending";
delete contender;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 824c6e5..4fbf563 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -848,7 +848,7 @@ Future<Response> Master::Http::scheduler(
// common for all the call handlers.
Framework* framework = master->getFramework(call.framework_id());
- if (framework == NULL) {
+ if (framework == nullptr) {
return BadRequest("Framework cannot be found");
}
@@ -1017,7 +1017,7 @@ Future<Response> Master::Http::createVolumes(
slaveId.set_value(value.get());
Slave* slave = master->slaves.registered.get(slaveId);
- if (slave == NULL) {
+ if (slave == nullptr) {
return BadRequest("No agent found with specified ID");
}
@@ -1127,7 +1127,7 @@ Future<Response> Master::Http::destroyVolumes(
slaveId.set_value(value.get());
Slave* slave = master->slaves.registered.get(slaveId);
- if (slave == NULL) {
+ if (slave == nullptr) {
return BadRequest("No agent found with specified ID");
}
@@ -1500,7 +1500,7 @@ Future<Response> Master::Http::reserve(
slaveId.set_value(value.get());
Slave* slave = master->slaves.registered.get(slaveId);
- if (slave == NULL) {
+ if (slave == nullptr) {
return BadRequest("No agent found with specified ID");
}
@@ -2510,7 +2510,7 @@ Future<Response> Master::Http::teardown(
Framework* framework = master->getFramework(id);
- if (framework == NULL) {
+ if (framework == nullptr) {
return BadRequest("No framework found with specified ID");
}
@@ -2544,7 +2544,7 @@ Future<Response> Master::Http::_teardown(const FrameworkID& id) const
{
Framework* framework = master->getFramework(id);
- if (framework == NULL) {
+ if (framework == nullptr) {
return BadRequest("No framework found with ID " + stringify(id));
}
@@ -3273,7 +3273,7 @@ Future<Response> Master::Http::unreserve(
slaveId.set_value(value.get());
Slave* slave = master->slaves.registered.get(slaveId);
- if (slave == NULL) {
+ if (slave == nullptr) {
return BadRequest("No agent found with specified ID");
}
@@ -3329,7 +3329,7 @@ Future<Response> Master::Http::_operation(
const Offer::Operation& operation) const
{
Slave* slave = master->slaves.registered.get(slaveId);
- if (slave == NULL) {
+ if (slave == nullptr) {
return BadRequest("No agent found with specified ID");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index 294b35d..ce6291f 100644
--- a/src/master/main.cpp
+++ b/src/master/main.cpp
@@ -307,8 +307,8 @@ int main(int argc, char** argv)
CHECK_NOTNULL(allocator.get());
LOG(INFO) << "Using '" << allocatorName << "' allocator";
- Storage* storage = NULL;
- Log* log = NULL;
+ Storage* storage = nullptr;
+ Log* log = nullptr;
if (flags.registry == "in_memory") {
if (flags.registry_strict) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 36e12c4..e5c84ac 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -586,7 +586,7 @@ void Master::initialize()
}
}
- if (httpAuthenticator.isSome() && httpAuthenticator.get() != NULL) {
+ if (httpAuthenticator.isSome() && httpAuthenticator.get() != nullptr) {
// Ownership of the `httpAuthenticator` is passed to libprocess.
process::http::authentication::setAuthenticator(
DEFAULT_HTTP_AUTHENTICATION_REALM,
@@ -672,7 +672,7 @@ void Master::initialize()
CHECK_SOME(httpFrameworkAuthenticator);
- if (httpFrameworkAuthenticator.get() != NULL) {
+ if (httpFrameworkAuthenticator.get() != nullptr) {
// Ownership of the `httpFrameworkAuthenticator` is passed to libprocess.
process::http::authentication::setAuthenticator(
DEFAULT_HTTP_FRAMEWORK_AUTHENTICATION_REALM,
@@ -1364,7 +1364,7 @@ void Master::exited(const UPID& pid)
foreach (const FrameworkID& frameworkId, frameworkIds) {
Framework* framework = getFramework(frameworkId);
- if (framework != NULL && !framework->info.checkpoint()) {
+ if (framework != nullptr && !framework->info.checkpoint()) {
LOG(INFO) << "Removing framework " << *framework
<< " from disconnected agent " << *slave
<< " because the framework is not checkpointing";
@@ -2084,7 +2084,7 @@ void Master::receive(
// because they are common for all the call handlers.
Framework* framework = getFramework(call.framework_id());
- if (framework == NULL) {
+ if (framework == nullptr) {
drop(from, call, "Framework cannot be found");
return;
}
@@ -2777,7 +2777,7 @@ void Master::unregisterFramework(
LOG(INFO) << "Asked to unregister framework " << frameworkId;
Framework* framework = getFramework(frameworkId);
- if (framework != NULL) {
+ if (framework != nullptr) {
if (framework->pid == from) {
teardown(framework);
} else {
@@ -2797,7 +2797,7 @@ void Master::deactivateFramework(
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING)
<< "Ignoring deactivate framework message for framework " << frameworkId
<< " because the framework cannot be found";
@@ -2933,7 +2933,7 @@ void Master::resourceRequest(
{
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING)
<< "Ignoring resource request message from framework " << frameworkId
<< " because the framework cannot be found";
@@ -3003,7 +3003,7 @@ void Master::launchTasks(
{
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING)
<< "Ignoring launch tasks message for offers " << stringify(offerIds)
<< " of framework " << frameworkId
@@ -3371,7 +3371,7 @@ void Master::accept(
// validation failed, return resources to the allocator.
foreach (const OfferID& offerId, accept.offer_ids()) {
Offer* offer = getOffer(offerId);
- if (offer != NULL) {
+ if (offer != nullptr) {
slaveId = offer->slave_id();
offeredResources += offer->resources();
@@ -3545,7 +3545,7 @@ void Master::_accept(
// TODO(jieyu): Consider using the 'drop' overload mentioned in
// 'accept' to consistently handle dropping ACCEPT calls.
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING)
<< "Ignoring ACCEPT call for framework " << frameworkId
<< " because the framework cannot be found";
@@ -3562,7 +3562,7 @@ void Master::_accept(
Slave* slave = slaves.registered.get(slaveId);
- if (slave == NULL || !slave->connected) {
+ if (slave == nullptr || !slave->connected) {
foreach (const Offer::Operation& operation, accept.operations()) {
if (operation.type() != Offer::Operation::LAUNCH) {
continue;
@@ -3570,7 +3570,7 @@ void Master::_accept(
foreach (const TaskInfo& task, operation.launch().task_infos()) {
const TaskStatus::Reason reason =
- slave == NULL ? TaskStatus::REASON_SLAVE_REMOVED
+ slave == nullptr ? TaskStatus::REASON_SLAVE_REMOVED
: TaskStatus::REASON_SLAVE_DISCONNECTED;
const StatusUpdate& update = protobuf::createStatusUpdate(
framework->id(),
@@ -3579,7 +3579,7 @@ void Master::_accept(
TASK_LOST,
TaskStatus::SOURCE_MASTER,
None(),
- slave == NULL ? "Agent removed" : "Agent disconnected",
+ slave == nullptr ? "Agent removed" : "Agent disconnected",
reason);
metrics->tasks_lost++;
@@ -3994,7 +3994,7 @@ void Master::acceptInverseOffers(
// filter.
foreach (const OfferID& offerId, accept.inverse_offer_ids()) {
InverseOffer* inverseOffer = getInverseOffer(offerId);
- if (inverseOffer != NULL) {
+ if (inverseOffer != nullptr) {
CHECK(inverseOffer->has_slave_id());
slaveId = inverseOffer->slave_id();
@@ -4053,7 +4053,7 @@ void Master::decline(
// Return resources to the allocator.
foreach (const OfferID& offerId, decline.offer_ids()) {
Offer* offer = getOffer(offerId);
- if (offer != NULL) {
+ if (offer != nullptr) {
allocator->recoverResources(
offer->framework_id(),
offer->slave_id(),
@@ -4087,7 +4087,7 @@ void Master::declineInverseOffers(
// Try it as an inverse offer. If this fails then the offer is no
// longer valid.
InverseOffer* inverseOffer = getInverseOffer(offerId);
- if (inverseOffer != NULL) { // If this is an inverse offer.
+ if (inverseOffer != nullptr) { // If this is an inverse offer.
mesos::master::InverseOfferStatus status;
status.set_status(mesos::master::InverseOfferStatus::DECLINE);
status.mutable_framework_id()->CopyFrom(inverseOffer->framework_id());
@@ -4118,7 +4118,7 @@ void Master::reviveOffers(const UPID& from, const FrameworkID& frameworkId)
{
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING)
<< "Ignoring revive offers message for framework " << frameworkId
<< " because the framework cannot be found";
@@ -4158,7 +4158,7 @@ void Master::killTask(
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING)
<< "Ignoring kill task message for task " << taskId << " of framework "
<< frameworkId << " because the framework cannot be found";
@@ -4210,7 +4210,7 @@ void Master::kill(Framework* framework, const scheduler::Call::Kill& kill)
}
Task* task = framework->getTask(taskId);
- if (task == NULL) {
+ if (task == nullptr) {
LOG(WARNING) << "Cannot kill task " << taskId
<< " of framework " << *framework
<< " because it is unknown; performing reconciliation";
@@ -4235,7 +4235,7 @@ void Master::kill(Framework* framework, const scheduler::Call::Kill& kill)
}
Slave* slave = slaves.registered.get(task->slave_id());
- CHECK(slave != NULL) << "Unknown agent " << task->slave_id();
+ CHECK(slave != nullptr) << "Unknown agent " << task->slave_id();
// We add the task to 'killedTasks' here because the slave
// might be partitioned or disconnected but the master
@@ -4285,7 +4285,7 @@ void Master::statusUpdateAcknowledgement(
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING)
<< "Ignoring status update acknowledgement " << UUID::fromBytes(uuid)
<< " for task " << taskId << " of framework " << frameworkId
@@ -4326,7 +4326,7 @@ void Master::acknowledge(
Slave* slave = slaves.registered.get(slaveId);
- if (slave == NULL) {
+ if (slave == nullptr) {
LOG(WARNING)
<< "Cannot send status update acknowledgement " << uuid
<< " for task " << taskId << " of framework " << *framework
@@ -4349,7 +4349,7 @@ void Master::acknowledge(
Task* task = slave->getTask(framework->id(), taskId);
- if (task != NULL) {
+ if (task != nullptr) {
// Status update state and uuid should be either set or unset
// together.
CHECK_EQ(task->has_status_update_uuid(), task->has_status_update_state());
@@ -4400,7 +4400,7 @@ void Master::schedulerMessage(
{
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Ignoring framework message"
<< " for executor '" << executorId << "'"
<< " of framework " << frameworkId
@@ -4469,7 +4469,7 @@ void Master::executorMessage(
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Not forwarding executor message"
<< " for executor '" << executorId << "'"
<< " of framework " << frameworkId
@@ -4501,7 +4501,7 @@ void Master::message(
Slave* slave = slaves.registered.get(message.slave_id());
- if (slave == NULL) {
+ if (slave == nullptr) {
LOG(WARNING) << "Cannot send framework message for framework "
<< *framework << " to agent " << message.slave_id()
<< " because agent is not registered";
@@ -4782,7 +4782,7 @@ void Master::reregisterSlave(
Slave* slave = slaves.registered.get(slaveInfo.id());
- if (slave != NULL) {
+ if (slave != nullptr) {
slave->reregisteredTime = Clock::now();
// NOTE: This handles the case where a slave tries to
@@ -4966,7 +4966,7 @@ void Master::__reregisterSlave(Slave* slave, const vector<Task>& tasks)
foreach (const Task& task, tasks) {
Framework* framework = getFramework(task.framework_id());
- if (framework != NULL && !ids.contains(framework->id())) {
+ if (framework != nullptr && !ids.contains(framework->id())) {
UpdateFrameworkMessage message;
message.mutable_framework_id()->MergeFrom(framework->id());
@@ -5002,7 +5002,7 @@ void Master::unregisterSlave(const UPID& from, const SlaveID& slaveId)
Slave* slave = slaves.registered.get(slaveId);
- if (slave != NULL) {
+ if (slave != nullptr) {
if (slave->pid != from) {
LOG(WARNING) << "Ignoring unregister agent message from " << from
<< " because it is not the agent " << slave->pid;
@@ -5172,7 +5172,7 @@ void Master::statusUpdate(StatusUpdate update, const UPID& pid)
Slave* slave = slaves.registered.get(update.slave_id());
- if (slave == NULL) {
+ if (slave == nullptr) {
LOG(WARNING) << "Ignoring status update " << update
<< " from unknown agent " << pid
<< " with id " << update.slave_id();
@@ -5182,7 +5182,7 @@ void Master::statusUpdate(StatusUpdate update, const UPID& pid)
Framework* framework = getFramework(update.framework_id());
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Ignoring status update " << update
<< " from agent " << *slave
<< " because the framework is unknown";
@@ -5206,7 +5206,7 @@ void Master::statusUpdate(StatusUpdate update, const UPID& pid)
// Lookup the task and see if we need to update anything locally.
Task* task = slave->getTask(update.framework_id(), update.status().task_id());
- if (task == NULL) {
+ if (task == nullptr) {
LOG(WARNING) << "Could not lookup task for status update " << update
<< " from agent " << *slave;
metrics->invalid_status_updates++;
@@ -5301,7 +5301,7 @@ void Master::exitedExecutor(
// TODO(vinod): Reliably forward this message to the scheduler.
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING)
<< "Not forwarding exited executor message for executor '" << executorId
<< "' of framework " << frameworkId << " on agent " << *slave
@@ -5397,7 +5397,7 @@ void Master::reconcileTasks(
const vector<TaskStatus>& statuses)
{
Framework* framework = getFramework(frameworkId);
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Unknown framework " << frameworkId << " at " << from
<< " attempted to reconcile tasks";
return;
@@ -5526,7 +5526,7 @@ void Master::_reconcileTasks(
None(),
"Reconciliation: Latest task state",
TaskStatus::REASON_RECONCILIATION);
- } else if (task != NULL) {
+ } else if (task != nullptr) {
// (2) Task is known: send the latest status update state.
const TaskState& state = task->has_status_update_state()
? task->status_update_state()
@@ -5599,7 +5599,7 @@ void Master::frameworkFailoverTimeout(const FrameworkID& frameworkId,
{
Framework* framework = getFramework(frameworkId);
- if (framework != NULL && !framework->connected) {
+ if (framework != nullptr && !framework->connected) {
// If the re-registration time has not changed, then the framework
// has not re-registered within the failover timeout.
if (framework->reregisteredTime == reregisteredTime) {
@@ -6358,7 +6358,7 @@ void Master::removeFramework(Framework* framework)
// Since we only find out about tasks when the slave re-registers,
// it must be the case that the slave exists!
- CHECK(slave != NULL)
+ CHECK(slave != nullptr)
<< "Unknown agent " << task->slave_id()
<< " for task " << task->task_id();
@@ -6416,7 +6416,7 @@ void Master::removeFramework(Framework* framework)
foreachkey (const SlaveID& slaveId, utils::copy(framework->executors)) {
Slave* slave = slaves.registered.get(slaveId);
- if (slave != NULL) {
+ if (slave != nullptr) {
foreachkey (const ExecutorID& executorId,
utils::copy(framework->executors[slaveId])) {
removeExecutor(slave, framework->id(), executorId);
@@ -6554,7 +6554,8 @@ void Master::addSlave(
foreachvalue (const ExecutorInfo& executorInfo,
slave->executors[frameworkId]) {
Framework* framework = getFramework(frameworkId);
- if (framework != NULL) { // The framework might not be re-registered yet.
+ // The framework might not be re-registered yet.
+ if (framework != nullptr) {
framework->addExecutor(slave->id, executorInfo);
}
}
@@ -6564,7 +6565,8 @@ void Master::addSlave(
foreachkey (const FrameworkID& frameworkId, slave->tasks) {
foreachvalue (Task* task, slave->tasks[frameworkId]) {
Framework* framework = getFramework(task->framework_id());
- if (framework != NULL) { // The framework might not be re-registered yet.
+ // The framework might not be re-registered yet.
+ if (framework != nullptr) {
framework->addTask(task);
} else {
// TODO(benh): We should really put a timeout on how long we
@@ -6588,7 +6590,7 @@ void Master::addSlave(
completedFramework.framework_info().id());
foreach (const Task& task, completedFramework.tasks()) {
- if (framework != NULL) {
+ if (framework != nullptr) {
VLOG(2) << "Re-adding completed task " << task.task_id()
<< " of framework " << *framework
<< " that ran on agent " << *slave;
@@ -6760,7 +6762,7 @@ void Master::_removeSlave(
foreach (const StatusUpdate& update, updates) {
Framework* framework = getFramework(update.framework_id());
- if (framework == NULL) {
+ if (framework == nullptr) {
LOG(WARNING) << "Dropping update " << update << " from unknown framework "
<< update.framework_id();
} else {
@@ -6861,14 +6863,14 @@ void Master::updateTask(Task* task, const StatusUpdate& update)
task->resources(),
None());
- // The slave owns the Task object and cannot be NULL.
+ // The slave owns the Task object and cannot be nullptr.
Slave* slave = slaves.registered.get(task->slave_id());
CHECK_NOTNULL(slave);
slave->taskTerminated(task);
Framework* framework = getFramework(task->framework_id());
- if (framework != NULL) {
+ if (framework != nullptr) {
framework->taskTerminated(task);
}
@@ -6895,7 +6897,7 @@ void Master::removeTask(Task* task)
{
CHECK_NOTNULL(task);
- // The slave owns the Task object and cannot be NULL.
+ // The slave owns the Task object and cannot be nullptr.
Slave* slave = slaves.registered.get(task->slave_id());
CHECK_NOTNULL(slave);
@@ -6922,7 +6924,7 @@ void Master::removeTask(Task* task)
// Remove from framework.
Framework* framework = getFramework(task->framework_id());
- if (framework != NULL) { // A framework might not be re-connected yet.
+ if (framework != nullptr) { // A framework might not be re-connected yet.
framework->removeTask(task);
}
@@ -6951,7 +6953,7 @@ void Master::removeExecutor(
frameworkId, slave->id, executor.resources(), None());
Framework* framework = getFramework(frameworkId);
- if (framework != NULL) { // The framework might not be re-registered yet.
+ if (framework != nullptr) { // The framework might not be re-registered yet.
framework->removeExecutor(slave->id, executorId);
}
@@ -7001,7 +7003,7 @@ void Master::_apply(Slave* slave, const Offer::Operation& operation) {
void Master::offerTimeout(const OfferID& offerId)
{
Offer* offer = getOffer(offerId);
- if (offer != NULL) {
+ if (offer != nullptr) {
allocator->recoverResources(
offer->framework_id(), offer->slave_id(), offer->resources(), None());
removeOffer(offer, true);
@@ -7015,7 +7017,7 @@ void Master::removeOffer(Offer* offer, bool rescind)
{
// Remove from framework.
Framework* framework = getFramework(offer->framework_id());
- CHECK(framework != NULL)
+ CHECK(framework != nullptr)
<< "Unknown framework " << offer->framework_id()
<< " in the offer " << offer->id();
@@ -7024,7 +7026,7 @@ void Master::removeOffer(Offer* offer, bool rescind)
// Remove from slave.
Slave* slave = slaves.registered.get(offer->slave_id());
- CHECK(slave != NULL)
+ CHECK(slave != nullptr)
<< "Unknown agent " << offer->slave_id()
<< " in the offer " << offer->id();
@@ -7052,7 +7054,7 @@ void Master::removeOffer(Offer* offer, bool rescind)
void Master::inverseOfferTimeout(const OfferID& inverseOfferId)
{
InverseOffer* inverseOffer = getInverseOffer(inverseOfferId);
- if (inverseOffer != NULL) {
+ if (inverseOffer != nullptr) {
allocator->updateInverseOffer(
inverseOffer->slave_id(),
inverseOffer->framework_id(),
@@ -7070,7 +7072,7 @@ void Master::removeInverseOffer(InverseOffer* inverseOffer, bool rescind)
{
// Remove from framework.
Framework* framework = getFramework(inverseOffer->framework_id());
- CHECK(framework != NULL)
+ CHECK(framework != nullptr)
<< "Unknown framework " << inverseOffer->framework_id()
<< " in the inverse offer " << inverseOffer->id();
@@ -7079,7 +7081,7 @@ void Master::removeInverseOffer(InverseOffer* inverseOffer, bool rescind)
// Remove from slave.
Slave* slave = slaves.registered.get(inverseOffer->slave_id());
- CHECK(slave != NULL)
+ CHECK(slave != nullptr)
<< "Unknown agent " << inverseOffer->slave_id()
<< " in the inverse offer " << inverseOffer->id();
@@ -7109,14 +7111,14 @@ Framework* Master::getFramework(const FrameworkID& frameworkId)
{
return frameworks.registered.contains(frameworkId)
? frameworks.registered[frameworkId]
- : NULL;
+ : nullptr;
}
// TODO(bmahler): Consider killing this.
Offer* Master::getOffer(const OfferID& offerId)
{
- return offers.contains(offerId) ? offers[offerId] : NULL;
+ return offers.contains(offerId) ? offers[offerId] : nullptr;
}
@@ -7124,7 +7126,7 @@ Offer* Master::getOffer(const OfferID& offerId)
InverseOffer* Master::getInverseOffer(const OfferID& inverseOfferId)
{
return inverseOffers.contains(inverseOfferId) ?
- inverseOffers[inverseOfferId] : NULL;
+ inverseOffers[inverseOfferId] : nullptr;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 846edf3..790da3c 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -129,7 +129,7 @@ struct Slave
connected(true),
active(true),
checkpointedResources(_checkpointedResources),
- observer(NULL)
+ observer(nullptr)
{
CHECK(_info.has_id());
@@ -158,7 +158,7 @@ struct Slave
if (tasks.contains(frameworkId) && tasks[frameworkId].contains(taskId)) {
return tasks[frameworkId][taskId];
}
- return NULL;
+ return nullptr;
}
void addTask(Task* task)
@@ -1405,12 +1405,12 @@ private:
Slave* get(const SlaveID& slaveId) const
{
- return ids.get(slaveId).getOrElse(NULL);
+ return ids.get(slaveId).getOrElse(nullptr);
}
Slave* get(const process::UPID& pid) const
{
- return pids.get(pid).getOrElse(NULL);
+ return pids.get(pid).getOrElse(nullptr);
}
void put(Slave* slave)
@@ -1860,7 +1860,7 @@ struct Framework
return tasks[taskId];
}
- return NULL;
+ return nullptr;
}
void addTask(Task* task)
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/master/validation.cpp
----------------------------------------------------------------------
diff --git a/src/master/validation.cpp b/src/master/validation.cpp
index 309fbed..7b9c228 100644
--- a/src/master/validation.cpp
+++ b/src/master/validation.cpp
@@ -783,12 +783,12 @@ Try<SlaveID> getSlaveId(Master* master, const OfferID& offerId)
{
// Try as an offer.
Offer* offer = getOffer(master, offerId);
- if (offer != NULL) {
+ if (offer != nullptr) {
return offer->slave_id();
}
InverseOffer* inverseOffer = getInverseOffer(master, offerId);
- if (inverseOffer != NULL) {
+ if (inverseOffer != nullptr) {
return inverseOffer->slave_id();
}
@@ -800,12 +800,12 @@ Try<FrameworkID> getFrameworkId(Master* master, const OfferID& offerId)
{
// Try as an offer.
Offer* offer = getOffer(master, offerId);
- if (offer != NULL) {
+ if (offer != nullptr) {
return offer->framework_id();
}
InverseOffer* inverseOffer = getInverseOffer(master, offerId);
- if (inverseOffer != NULL) {
+ if (inverseOffer != nullptr) {
return inverseOffer->framework_id();
}
@@ -819,7 +819,7 @@ Option<Error> validateOfferIds(
{
foreach (const OfferID& offerId, offerIds) {
Offer* offer = getOffer(master, offerId);
- if (offer == NULL) {
+ if (offer == nullptr) {
return Error("Offer " + stringify(offerId) + " is no longer valid");
}
}
@@ -834,7 +834,7 @@ Option<Error> validateInverseOfferIds(
{
foreach (const OfferID& offerId, offerIds) {
InverseOffer* inverseOffer = getInverseOffer(master, offerId);
- if (inverseOffer == NULL) {
+ if (inverseOffer == nullptr) {
return Error(
"Inverse offer " + stringify(offerId) + " is no longer valid");
}
@@ -900,7 +900,7 @@ Option<Error> validateSlave(
Slave* slave = getSlave(master, offerSlaveId.get());
// This is not possible because the offer should've been removed.
- CHECK(slave != NULL)
+ CHECK(slave != nullptr)
<< "Offer " << offerId
<< " outlived agent " << offerSlaveId.get();
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/module/manager.cpp
----------------------------------------------------------------------
diff --git a/src/module/manager.cpp b/src/module/manager.cpp
index 725f085..8b408bf 100644
--- a/src/module/manager.cpp
+++ b/src/module/manager.cpp
@@ -132,12 +132,12 @@ Try<Nothing> ModuleManager::verifyModule(
const ModuleBase* moduleBase)
{
CHECK_NOTNULL(moduleBase);
- if (moduleBase->mesosVersion == NULL ||
- moduleBase->moduleApiVersion == NULL ||
- moduleBase->authorName == NULL ||
- moduleBase->authorEmail == NULL ||
- moduleBase->description == NULL ||
- moduleBase->kind == NULL) {
+ if (moduleBase->mesosVersion == nullptr ||
+ moduleBase->moduleApiVersion == nullptr ||
+ moduleBase->authorName == nullptr ||
+ moduleBase->authorEmail == nullptr ||
+ moduleBase->description == nullptr ||
+ moduleBase->kind == nullptr) {
return Error("Error loading module '" + moduleName + "'; missing fields");
}
@@ -170,7 +170,7 @@ Try<Nothing> ModuleManager::verifyModule(
"with version " + stringify(moduleMesosVersion.get()));
}
- if (moduleBase->compatible == NULL) {
+ if (moduleBase->compatible == nullptr) {
if (moduleMesosVersion.get() != mesosVersion.get()) {
return Error(
"Mesos has version " + stringify(mesosVersion.get()) +
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/module/manager.hpp
----------------------------------------------------------------------
diff --git a/src/module/manager.hpp b/src/module/manager.hpp
index 4a9e6a3..78aea44 100644
--- a/src/module/manager.hpp
+++ b/src/module/manager.hpp
@@ -86,7 +86,7 @@ public:
}
Module<T>* module = (Module<T>*) moduleBases[moduleName];
- if (module->create == NULL) {
+ if (module->create == nullptr) {
return Error(
"Error creating module instance for '" + moduleName + "': "
"create() method not found");
@@ -103,7 +103,7 @@ public:
T* instance =
module->create(
params.isSome() ? params.get() : moduleParameters[moduleName]);
- if (instance == NULL) {
+ if (instance == nullptr) {
return Error("Error creating Module instance for '" + moduleName + "'");
}
return instance;
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/python/executor/src/mesos/executor/mesos_executor_driver_impl.cpp
----------------------------------------------------------------------
diff --git a/src/python/executor/src/mesos/executor/mesos_executor_driver_impl.cpp b/src/python/executor/src/mesos/executor/mesos_executor_driver_impl.cpp
index f2477d3..0055793 100644
--- a/src/python/executor/src/mesos/executor/mesos_executor_driver_impl.cpp
+++ b/src/python/executor/src/mesos/executor/mesos_executor_driver_impl.cpp
@@ -40,7 +40,7 @@ namespace mesos { namespace python {
* Python type object for MesosExecutorDriverImpl.
*/
PyTypeObject MesosExecutorDriverImplType = {
- PyObject_HEAD_INIT(NULL)
+ PyObject_HEAD_INIT(nullptr)
0, /* ob_size */
"_mesos.MesosExecutorDriverImpl", /* tp_name */
sizeof(MesosExecutorDriverImpl), /* tp_basicsize */
@@ -121,7 +121,7 @@ PyMethodDef MesosExecutorDriverImpl_methods[] = {
METH_VARARGS,
"Send a FrameworkMessage to an agent"
},
- { NULL } /* Sentinel */
+ { nullptr } /* Sentinel */
};
@@ -135,10 +135,10 @@ PyObject* MesosExecutorDriverImpl_new(PyTypeObject *type,
{
MesosExecutorDriverImpl *self;
self = (MesosExecutorDriverImpl *) type->tp_alloc(type, 0);
- if (self != NULL) {
- self->driver = NULL;
- self->proxyExecutor = NULL;
- self->pythonExecutor = NULL;
+ if (self != nullptr) {
+ self->driver = nullptr;
+ self->proxyExecutor = nullptr;
+ self->pythonExecutor = nullptr;
}
return (PyObject*) self;
}
@@ -151,27 +151,27 @@ int MesosExecutorDriverImpl_init(MesosExecutorDriverImpl *self,
PyObject *args,
PyObject *kwds)
{
- PyObject *pythonExecutor = NULL;
+ PyObject *pythonExecutor = nullptr;
if (!PyArg_ParseTuple(args, "O", &pythonExecutor)) {
return -1;
}
- if (pythonExecutor != NULL) {
+ if (pythonExecutor != nullptr) {
PyObject* tmp = self->pythonExecutor;
Py_INCREF(pythonExecutor);
self->pythonExecutor = pythonExecutor;
Py_XDECREF(tmp);
}
- if (self->driver != NULL) {
+ if (self->driver != nullptr) {
delete self->driver;
- self->driver = NULL;
+ self->driver = nullptr;
}
- if (self->proxyExecutor != NULL) {
+ if (self->proxyExecutor != nullptr) {
delete self->proxyExecutor;
- self->proxyExecutor = NULL;
+ self->proxyExecutor = nullptr;
}
self->proxyExecutor = new ProxyExecutor(self);
@@ -186,7 +186,7 @@ int MesosExecutorDriverImpl_init(MesosExecutorDriverImpl *self,
*/
void MesosExecutorDriverImpl_dealloc(MesosExecutorDriverImpl* self)
{
- if (self->driver != NULL) {
+ if (self->driver != nullptr) {
// We need to wrap the driver destructor in an "allow threads"
// macro since the MesosExecutorDriver destructor waits for the
// ExecutorProcess to terminate and there might be a thread that
@@ -196,12 +196,12 @@ void MesosExecutorDriverImpl_dealloc(MesosExecutorDriverImpl* self)
Py_BEGIN_ALLOW_THREADS
delete self->driver;
Py_END_ALLOW_THREADS
- self->driver = NULL;
+ self->driver = nullptr;
}
- if (self->proxyExecutor != NULL) {
+ if (self->proxyExecutor != nullptr) {
delete self->proxyExecutor;
- self->proxyExecutor = NULL;
+ self->proxyExecutor = nullptr;
}
MesosExecutorDriverImpl_clear(self);
@@ -235,9 +235,9 @@ int MesosExecutorDriverImpl_clear(MesosExecutorDriverImpl* self)
PyObject* MesosExecutorDriverImpl_start(MesosExecutorDriverImpl* self)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is nullptr");
+ return nullptr;
}
Status status = self->driver->start();
@@ -247,9 +247,9 @@ PyObject* MesosExecutorDriverImpl_start(MesosExecutorDriverImpl* self)
PyObject* MesosExecutorDriverImpl_stop(MesosExecutorDriverImpl* self)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is nullptr");
+ return nullptr;
}
Status status = self->driver->stop();
@@ -259,9 +259,9 @@ PyObject* MesosExecutorDriverImpl_stop(MesosExecutorDriverImpl* self)
PyObject* MesosExecutorDriverImpl_abort(MesosExecutorDriverImpl* self)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is nullptr");
+ return nullptr;
}
Status status = self->driver->abort();
@@ -271,9 +271,9 @@ PyObject* MesosExecutorDriverImpl_abort(MesosExecutorDriverImpl* self)
PyObject* MesosExecutorDriverImpl_join(MesosExecutorDriverImpl* self)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is nullptr");
+ return nullptr;
}
Status status;
@@ -286,9 +286,9 @@ PyObject* MesosExecutorDriverImpl_join(MesosExecutorDriverImpl* self)
PyObject* MesosExecutorDriverImpl_run(MesosExecutorDriverImpl* self)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is nullptr");
+ return nullptr;
}
Status status;
@@ -303,20 +303,20 @@ PyObject* MesosExecutorDriverImpl_sendStatusUpdate(
MesosExecutorDriverImpl* self,
PyObject* args)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is nullptr");
+ return nullptr;
}
- PyObject* statusObj = NULL;
+ PyObject* statusObj = nullptr;
TaskStatus taskStatus;
if (!PyArg_ParseTuple(args, "O", &statusObj)) {
- return NULL;
+ return nullptr;
}
if (!readPythonProtobuf(statusObj, &taskStatus)) {
PyErr_Format(PyExc_Exception,
"Could not deserialize Python TaskStatus");
- return NULL;
+ return nullptr;
}
Status status = self->driver->sendStatusUpdate(taskStatus);
@@ -328,15 +328,15 @@ PyObject* MesosExecutorDriverImpl_sendFrameworkMessage(
MesosExecutorDriverImpl* self,
PyObject* args)
{
- if (self->driver == NULL) {
- PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is NULL");
- return NULL;
+ if (self->driver == nullptr) {
+ PyErr_Format(PyExc_Exception, "MesosExecutorDriverImpl.driver is nullptr");
+ return nullptr;
}
const char* data;
int length;
if (!PyArg_ParseTuple(args, "s#", &data, &length)) {
- return NULL;
+ return nullptr;
}
Status status = self->driver->sendFrameworkMessage(string(data, length));
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/python/executor/src/mesos/executor/module.cpp
----------------------------------------------------------------------
diff --git a/src/python/executor/src/mesos/executor/module.cpp b/src/python/executor/src/mesos/executor/module.cpp
index f8c6382..111aab6 100644
--- a/src/python/executor/src/mesos/executor/module.cpp
+++ b/src/python/executor/src/mesos/executor/module.cpp
@@ -50,7 +50,7 @@ using std::vector;
* The Python module object for mesos_pb2 (which contains the protobuf
* classes generated for Python).
*/
-PyObject* mesos::python::mesos_pb2 = NULL;
+PyObject* mesos::python::mesos_pb2 = nullptr;
namespace {
@@ -59,7 +59,7 @@ namespace {
* Method list for our Python module.
*/
PyMethodDef MODULE_METHODS[] = {
- {NULL, NULL, 0, NULL} /* Sentinel */
+ {nullptr, nullptr, 0, nullptr} /* Sentinel */
};
} // namespace {
@@ -75,7 +75,7 @@ PyMODINIT_FUNC init_executor()
// Import the mesos_pb2 module (on which we depend for protobuf classes)
mesos_pb2 = PyImport_ImportModule("mesos.interface.mesos_pb2");
- if (mesos_pb2 == NULL)
+ if (mesos_pb2 == nullptr)
return;
// Initialize our Python types.
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/python/executor/src/mesos/executor/proxy_executor.cpp
----------------------------------------------------------------------
diff --git a/src/python/executor/src/mesos/executor/proxy_executor.cpp b/src/python/executor/src/mesos/executor/proxy_executor.cpp
index b9c8a2d..2462ccb 100644
--- a/src/python/executor/src/mesos/executor/proxy_executor.cpp
+++ b/src/python/executor/src/mesos/executor/proxy_executor.cpp
@@ -42,18 +42,18 @@ void ProxyExecutor::registered(ExecutorDriver* driver,
{
InterpreterLock lock;
- PyObject* executorInfoObj = NULL;
- PyObject* frameworkInfoObj = NULL;
- PyObject* slaveInfoObj = NULL;
- PyObject* res = NULL;
+ PyObject* executorInfoObj = nullptr;
+ PyObject* frameworkInfoObj = nullptr;
+ PyObject* slaveInfoObj = nullptr;
+ PyObject* res = nullptr;
executorInfoObj = createPythonProtobuf(executorInfo, "ExecutorInfo");
frameworkInfoObj = createPythonProtobuf(frameworkInfo, "FrameworkInfo");
slaveInfoObj = createPythonProtobuf(slaveInfo, "SlaveInfo");
- if (executorInfoObj == NULL ||
- frameworkInfoObj == NULL ||
- slaveInfoObj == NULL) {
+ if (executorInfoObj == nullptr ||
+ frameworkInfoObj == nullptr ||
+ slaveInfoObj == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
@@ -64,7 +64,7 @@ void ProxyExecutor::registered(ExecutorDriver* driver,
executorInfoObj,
frameworkInfoObj,
slaveInfoObj);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call executor registered" << endl;
goto cleanup;
}
@@ -86,12 +86,12 @@ void ProxyExecutor::reregistered(ExecutorDriver* driver,
{
InterpreterLock lock;
- PyObject* slaveInfoObj = NULL;
- PyObject* res = NULL;
+ PyObject* slaveInfoObj = nullptr;
+ PyObject* res = nullptr;
slaveInfoObj = createPythonProtobuf(slaveInfo, "SlaveInfo");
- if (slaveInfoObj == NULL) {
+ if (slaveInfoObj == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
@@ -100,7 +100,7 @@ void ProxyExecutor::reregistered(ExecutorDriver* driver,
(char*) "OO",
impl,
slaveInfoObj);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call executor re-registered" << endl;
goto cleanup;
}
@@ -122,7 +122,7 @@ void ProxyExecutor::disconnected(ExecutorDriver* driver)
(char*) "disconnected",
(char*) "O",
impl);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call executor's disconnected" << endl;
goto cleanup;
}
@@ -140,11 +140,11 @@ void ProxyExecutor::launchTask(ExecutorDriver* driver,
{
InterpreterLock lock;
- PyObject* taskObj = NULL;
- PyObject* res = NULL;
+ PyObject* taskObj = nullptr;
+ PyObject* res = nullptr;
taskObj = createPythonProtobuf(task, "TaskInfo");
- if (taskObj == NULL) {
+ if (taskObj == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
@@ -153,7 +153,7 @@ void ProxyExecutor::launchTask(ExecutorDriver* driver,
(char*) "OO",
impl,
taskObj);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call executor's launchTask" << endl;
goto cleanup;
}
@@ -173,11 +173,11 @@ void ProxyExecutor::killTask(ExecutorDriver* driver,
{
InterpreterLock lock;
- PyObject* taskIdObj = NULL;
- PyObject* res = NULL;
+ PyObject* taskIdObj = nullptr;
+ PyObject* res = nullptr;
taskIdObj = createPythonProtobuf(taskId, "TaskID");
- if (taskIdObj == NULL) {
+ if (taskIdObj == nullptr) {
goto cleanup; // createPythonProtobuf will have set an exception.
}
@@ -186,7 +186,7 @@ void ProxyExecutor::killTask(ExecutorDriver* driver,
(char*) "OO",
impl,
taskIdObj);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call executor's killTask" << endl;
goto cleanup;
}
@@ -206,7 +206,7 @@ void ProxyExecutor::frameworkMessage(ExecutorDriver* driver,
{
InterpreterLock lock;
- PyObject* res = NULL;
+ PyObject* res = nullptr;
res = PyObject_CallMethod(impl->pythonExecutor,
(char*) "frameworkMessage",
@@ -214,7 +214,7 @@ void ProxyExecutor::frameworkMessage(ExecutorDriver* driver,
impl,
data.data(),
data.length());
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call executor's frameworkMessage" << endl;
goto cleanup;
}
@@ -235,7 +235,7 @@ void ProxyExecutor::shutdown(ExecutorDriver* driver)
(char*) "shutdown",
(char*) "O",
impl);
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call executor's shutdown" << endl;
goto cleanup;
}
@@ -257,7 +257,7 @@ void ProxyExecutor::error(ExecutorDriver* driver, const string& message)
impl,
message.data(),
message.length());
- if (res == NULL) {
+ if (res == nullptr) {
cerr << "Failed to call executor's error" << endl;
goto cleanup;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/686e5013/src/python/native_common/common.hpp
----------------------------------------------------------------------
diff --git a/src/python/native_common/common.hpp b/src/python/native_common/common.hpp
index 166adb3..ed743aa 100644
--- a/src/python/native_common/common.hpp
+++ b/src/python/native_common/common.hpp
@@ -66,8 +66,8 @@ bool readPythonProtobuf(PyObject* obj, T* t)
}
PyObject* res = PyObject_CallMethod(obj,
(char*) "SerializeToString",
- (char*) NULL);
- if (res == NULL) {
+ (char*) nullptr);
+ if (res == nullptr) {
std::cerr << "Failed to call Python object's SerializeToString "
<< "(perhaps it is not a protobuf?)" << std::endl;
PyErr_Print();
@@ -95,31 +95,31 @@ bool readPythonProtobuf(PyObject* obj, T* t)
* Convert a C++ protocol buffer object into a Python one by serializing
* it to a string and deserializing the result back in Python. Returns the
* resulting PyObject* on success or raises a Python exception and returns
- * NULL on failure.
+ * nullptr on failure.
*/
template <typename T>
PyObject* createPythonProtobuf(const T& t, const char* typeName)
{
PyObject* dict = PyModule_GetDict(mesos_pb2);
- if (dict == NULL) {
+ if (dict == nullptr) {
PyErr_Format(PyExc_Exception, "PyModule_GetDict failed");
- return NULL;
+ return nullptr;
}
PyObject* type = PyDict_GetItemString(dict, typeName);
- if (type == NULL) {
+ if (type == nullptr) {
PyErr_Format(PyExc_Exception, "Could not resolve mesos_pb2.%s", typeName);
- return NULL;
+ return nullptr;
}
if (!PyType_Check(type)) {
PyErr_Format(PyExc_Exception, "mesos_pb2.%s is not a type", typeName);
- return NULL;
+ return nullptr;
}
std::string str;
if (!t.SerializeToString(&str)) {
PyErr_Format(PyExc_Exception, "C++ %s SerializeToString failed", typeName);
- return NULL;
+ return nullptr;
}
// Propagates any exception that might happen in FromString.