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