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:47 UTC
[2/4] mesos git commit: Replaced `NULL` with `nullptr` in mesos.
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(