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/06 20:01:13 UTC
[4/5] mesos git commit: Replaced `NULL` with `nullptr` in stout.
Replaced `NULL` with `nullptr` in stout.
Review: https://reviews.apache.org/r/48254
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f54fc5f0
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f54fc5f0
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f54fc5f0
Branch: refs/heads/master
Commit: f54fc5f0d75c25bbc43385cf83049f2a14724f74
Parents: 9c10384
Author: Michael Park <mp...@apache.org>
Authored: Sat Jun 4 17:25:40 2016 -0700
Committer: Michael Park <mp...@apache.org>
Committed: Mon Jun 6 12:41:19 2016 -0700
----------------------------------------------------------------------
3rdparty/stout/README.md | 2 +-
3rdparty/stout/include/stout/abort.hpp | 2 +-
3rdparty/stout/include/stout/elf.hpp | 26 ++++++------
3rdparty/stout/include/stout/flags/flags.hpp | 34 +++++++--------
.../include/stout/internal/windows/dirent.hpp | 44 ++++++++++----------
.../include/stout/internal/windows/grp.hpp | 8 ++--
.../include/stout/internal/windows/pwd.hpp | 8 ++--
.../stout/internal/windows/reparsepoint.hpp | 10 ++---
3rdparty/stout/include/stout/ip.hpp | 12 +++---
3rdparty/stout/include/stout/json.hpp | 2 +-
3rdparty/stout/include/stout/mac.hpp | 10 ++---
3rdparty/stout/include/stout/net.hpp | 26 ++++++------
3rdparty/stout/include/stout/os/environment.hpp | 2 +-
3rdparty/stout/include/stout/os/freebsd.hpp | 4 +-
3rdparty/stout/include/stout/os/ls.hpp | 6 +--
3rdparty/stout/include/stout/os/osx.hpp | 4 +-
3rdparty/stout/include/stout/os/posix/chown.hpp | 2 +-
3rdparty/stout/include/stout/os/posix/fork.hpp | 6 +--
.../stout/include/stout/os/posix/mkdtemp.hpp | 2 +-
3rdparty/stout/include/stout/os/posix/rmdir.hpp | 10 ++---
.../stout/include/stout/os/posix/sendfile.hpp | 4 +-
3rdparty/stout/include/stout/os/posix/shell.hpp | 6 +--
.../stout/include/stout/os/posix/signals.hpp | 4 +-
3rdparty/stout/include/stout/os/posix/su.hpp | 18 ++++----
3rdparty/stout/include/stout/os/read.hpp | 2 +-
3rdparty/stout/include/stout/os/realpath.hpp | 2 +-
3rdparty/stout/include/stout/os/sysctl.hpp | 12 +++---
3rdparty/stout/include/stout/os/utime.hpp | 2 +-
.../stout/include/stout/os/windows/exists.hpp | 2 +-
.../stout/include/stout/os/windows/fcntl.hpp | 2 +-
.../stout/include/stout/os/windows/kill.hpp | 2 +-
.../stout/include/stout/os/windows/sendfile.hpp | 4 +-
.../stout/include/stout/os/windows/shell.hpp | 10 ++---
.../include/stout/posix/dynamiclibrary.hpp | 20 ++++-----
3rdparty/stout/include/stout/posix/os.hpp | 4 +-
3rdparty/stout/include/stout/protobuf.hpp | 12 +++---
3rdparty/stout/include/stout/svn.hpp | 16 +++----
3rdparty/stout/include/stout/uuid.hpp | 4 +-
.../include/stout/windows/dynamiclibrary.hpp | 20 ++++-----
3rdparty/stout/include/stout/windows/error.hpp | 4 +-
3rdparty/stout/include/stout/windows/os.hpp | 32 +++++++-------
3rdparty/stout/tests/flags_tests.cpp | 2 +-
3rdparty/stout/tests/os/filesystem_tests.cpp | 8 ++--
3rdparty/stout/tests/os/process_tests.cpp | 12 +++---
3rdparty/stout/tests/os/strerror_tests.cpp | 4 +-
3rdparty/stout/tests/os_tests.cpp | 12 +++---
46 files changed, 220 insertions(+), 220 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/README.md
----------------------------------------------------------------------
diff --git a/3rdparty/stout/README.md b/3rdparty/stout/README.md
index 55ec6f8..172150c 100644
--- a/3rdparty/stout/README.md
+++ b/3rdparty/stout/README.md
@@ -40,7 +40,7 @@ Note that the library is designed to completely avoid exceptions. See [exception
## `Option`, `Some`, and `None`
-The `Option` type provides a safe alternative to using `NULL`. An `Option` can be constructed explicitly or implicitly:
+The `Option` type provides a safe alternative to using `nullptr`. An `Option` can be constructed explicitly or implicitly:
~~~{.cpp}
Option<bool> o(true);
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/abort.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/abort.hpp b/3rdparty/stout/include/stout/abort.hpp
index 490e2ba..9fa6f84 100644
--- a/3rdparty/stout/include/stout/abort.hpp
+++ b/3rdparty/stout/include/stout/abort.hpp
@@ -46,7 +46,7 @@ inline NORETURN void _Abort(const char* prefix, const char* message)
// http://austingroupbugs.net/view.php?id=692
while (::write(STDERR_FILENO, prefix, strlen(prefix)) == -1 &&
errno == EINTR);
- while (message != NULL &&
+ while (message != nullptr &&
::write(STDERR_FILENO, message, strlen(message)) == -1 &&
errno == EINTR);
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/elf.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/elf.hpp b/3rdparty/stout/include/stout/elf.hpp
index e1f0b61..5382acc 100644
--- a/3rdparty/stout/include/stout/elf.hpp
+++ b/3rdparty/stout/include/stout/elf.hpp
@@ -84,8 +84,8 @@ public:
return ErrnoError("Failed to open file");
}
- file->elf = elf_begin(file->fd, ELF_C_READ, NULL);
- if (file->elf == NULL) {
+ file->elf = elf_begin(file->fd, ELF_C_READ, nullptr);
+ if (file->elf == nullptr) {
delete file;
return Error("elf_begin() failed: " + stringify(elf_errmsg(-1)));
}
@@ -96,10 +96,10 @@ public:
}
// Create the mapping from section type to section locations.
- Elf_Scn* section = NULL;
- while ((section = elf_nextscn(file->elf, section)) != NULL) {
+ Elf_Scn* section = nullptr;
+ while ((section = elf_nextscn(file->elf, section)) != nullptr) {
GElf_Shdr section_header;
- if (gelf_getshdr(section, §ion_header) == NULL) {
+ if (gelf_getshdr(section, §ion_header) == nullptr) {
delete file;
return Error("gelf_getshdr() failed: " + stringify(elf_errmsg(-1)));
}
@@ -116,9 +116,9 @@ public:
void close()
{
- if (elf != NULL) {
+ if (elf != nullptr) {
elf_end(elf);
- elf = NULL;
+ elf = nullptr;
}
if (fd >= 0) {
@@ -165,8 +165,8 @@ public:
// also have to look for an entry containing a pointer to the
// dynamic section's string table so we can resolve the strings
// associated with the provided tag later on.
- Elf_Data* dynamic_data = elf_getdata(dynamic_section, NULL);
- if (dynamic_data == NULL) {
+ Elf_Data* dynamic_data = elf_getdata(dynamic_section, nullptr);
+ if (dynamic_data == nullptr) {
return Error("elf_getdata() failed: " + stringify(elf_errmsg(-1)));
}
@@ -175,7 +175,7 @@ public:
for (size_t i = 0; i < dynamic_data->d_size / sizeof(GElf_Dyn); i++) {
GElf_Dyn entry;
- if (gelf_getdyn(dynamic_data, i, &entry) == NULL) {
+ if (gelf_getdyn(dynamic_data, i, &entry) == nullptr) {
return Error("gelf_getdyn() failed: " + stringify(elf_errmsg(-1)));
}
@@ -198,7 +198,7 @@ public:
// Get a reference to the actual string table so we can index into it.
Elf_Scn* string_table_section = gelf_offscn(elf, strtab_pointer.get());
- if (string_table_section == NULL) {
+ if (string_table_section == nullptr) {
return Error("gelf_offscn() failed: " + stringify(elf_errmsg(-1)));
}
@@ -211,7 +211,7 @@ public:
std::vector<std::string> strings;
foreach (uintptr_t offset, strtab_offsets) {
char* string = elf_strptr(elf, strtab_index, offset);
- if (string == NULL) {
+ if (string == nullptr) {
return Error("elf_strptr() failed: " + stringify(elf_errmsg(-1)));
}
@@ -224,7 +224,7 @@ public:
private:
explicit File()
: fd(-1),
- elf(NULL) {}
+ elf(nullptr) {}
int fd;
Elf* elf;
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/flags/flags.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/flags/flags.hpp b/3rdparty/stout/include/stout/flags/flags.hpp
index 0935eaf..9271f72 100644
--- a/3rdparty/stout/include/stout/flags/flags.hpp
+++ b/3rdparty/stout/include/stout/flags/flags.hpp
@@ -411,8 +411,8 @@ void FlagsBase::add(
const T2* t2,
F validate)
{
- // Don't bother adding anything if the pointer is NULL.
- if (t1 == NULL) {
+ // Don't bother adding anything if the pointer is `nullptr`.
+ if (t1 == nullptr) {
return;
}
@@ -477,8 +477,8 @@ void FlagsBase::add(
const std::string& help,
F validate)
{
- // Don't bother adding anything if the pointer is NULL.
- if (option == NULL) {
+ // Don't bother adding anything if the pointer is `nullptr`.
+ if (option == nullptr) {
return;
}
@@ -529,13 +529,13 @@ void FlagsBase::add(
const T2* t2,
F validate)
{
- // Don't bother adding anything if the pointer is NULL.
- if (t1 == NULL) {
+ // Don't bother adding anything if the pointer is `nullptr`.
+ if (t1 == nullptr) {
return;
}
Flags* flags = dynamic_cast<Flags*>(this);
- if (flags == NULL) {
+ if (flags == nullptr) {
ABORT("Attempted to add flag '" + name.value +
"' with incompatible type");
}
@@ -562,7 +562,7 @@ void FlagsBase::add(
flag.load = [t1](FlagsBase* base, const std::string& value) -> Try<Nothing> {
Flags* flags = dynamic_cast<Flags*>(base);
- if (base != NULL) {
+ if (base != nullptr) {
// NOTE: 'fetch' "retrieves" the value if necessary and then
// invokes 'parse'. See 'fetch' for more details.
Try<T1> t = fetch<T1>(value);
@@ -578,7 +578,7 @@ void FlagsBase::add(
flag.stringify = [t1](const FlagsBase& base) -> Option<std::string> {
const Flags* flags = dynamic_cast<const Flags*>(&base);
- if (flags != NULL) {
+ if (flags != nullptr) {
return stringify(flags->*t1);
}
return None();
@@ -586,7 +586,7 @@ void FlagsBase::add(
flag.validate = [t1, validate](const FlagsBase& base) -> Option<Error> {
const Flags* flags = dynamic_cast<const Flags*>(&base);
- if (flags != NULL) {
+ if (flags != nullptr) {
return validate(flags->*t1);
}
return None();
@@ -613,13 +613,13 @@ void FlagsBase::add(
const std::string& help,
F validate)
{
- // Don't bother adding anything if the pointer is NULL.
- if (option == NULL) {
+ // Don't bother adding anything if the pointer is `nullptr`.
+ if (option == nullptr) {
return;
}
Flags* flags = dynamic_cast<Flags*>(this);
- if (flags == NULL) {
+ if (flags == nullptr) {
ABORT("Attempted to add flag '" + name.value +
"' with incompatible type");
}
@@ -638,7 +638,7 @@ void FlagsBase::add(
flag.load =
[option](FlagsBase* base, const std::string& value) -> Try<Nothing> {
Flags* flags = dynamic_cast<Flags*>(base);
- if (flags != NULL) {
+ if (flags != nullptr) {
// NOTE: 'fetch' "retrieves" the value if necessary and then
// invokes 'parse'. See 'fetch' for more details.
Try<T> t = fetch<T>(value);
@@ -654,7 +654,7 @@ void FlagsBase::add(
flag.stringify = [option](const FlagsBase& base) -> Option<std::string> {
const Flags* flags = dynamic_cast<const Flags*>(&base);
- if (flags != NULL) {
+ if (flags != nullptr) {
if ((flags->*option).isSome()) {
return stringify((flags->*option).get());
}
@@ -664,7 +664,7 @@ void FlagsBase::add(
flag.validate = [option, validate](const FlagsBase& base) -> Option<Error> {
const Flags* flags = dynamic_cast<const Flags*>(&base);
- if (flags != NULL) {
+ if (flags != nullptr) {
return validate(flags->*option);
}
return None();
@@ -878,7 +878,7 @@ inline Try<Warnings> FlagsBase::load(
// Now null terminate the array. Note that we'll "leak" the
// arguments that were processed here but it's not like they would
// have gotten deleted in normal operations anyway.
- (*argv)[i++] = NULL;
+ (*argv)[i++] = nullptr;
}
return result;
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/internal/windows/dirent.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/internal/windows/dirent.hpp b/3rdparty/stout/include/stout/internal/windows/dirent.hpp
index c1113e5..c6aa907 100644
--- a/3rdparty/stout/include/stout/internal/windows/dirent.hpp
+++ b/3rdparty/stout/include/stout/internal/windows/dirent.hpp
@@ -59,16 +59,16 @@ bool reentrant_advance_dir_stream(DIR* directory);
// [1] http://www.gnu.org/software/libc/manual/html_node/Opening-a-Directory.html#Opening-a-Directory
inline DIR* opendir(const char* path)
{
- if (path == NULL) {
+ if (path == nullptr) {
errno = ENOTDIR;
- return NULL;
+ return nullptr;
}
const size_t path_size = strlen(path);
if (path_size == 0 || path_size >= MAX_PATH) {
errno = ENOENT;
- return NULL;
+ return nullptr;
}
const char windows_folder_separator = '\\';
@@ -80,18 +80,18 @@ inline DIR* opendir(const char* path)
// `directory->d_name` for a directory separator and a wildcard.
DIR* directory = (DIR*) malloc(sizeof(DIR));
- if (directory == NULL) {
+ if (directory == nullptr) {
errno = ENOMEM;
- return NULL;
+ return nullptr;
}
directory->d_name =
(char*) malloc(path_size + strlen(dir_separator_and_wildcard) + 1);
- if (directory->d_name == NULL) {
+ if (directory->d_name == nullptr) {
errno = ENOMEM;
free(directory);
- return NULL;
+ return nullptr;
}
// Copy path over and append the appropriate postfix.
@@ -109,7 +109,7 @@ inline DIR* opendir(const char* path)
if (!internal::open_dir_stream(directory)) {
internal::free_dir(directory);
- return NULL;
+ return nullptr;
}
return directory;
@@ -118,10 +118,10 @@ inline DIR* opendir(const char* path)
// Implementation of the standard POSIX function. See documentation[1].
//
-// On success: returns a pointer to the next directory entry, or `NULL` if
+// On success: returns a pointer to the next directory entry, or `nullptr` if
// we've reached the end of the stream.
//
-// On failure: returns `NULL` and sets `errno`.
+// On failure: returns `nullptr` and sets `errno`.
//
// NOTE: as with most POSIX implementations of this function, you must reset
// `errno` before calling `readdir`.
@@ -129,13 +129,13 @@ inline DIR* opendir(const char* path)
// [1] http://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html#Reading_002fClosing-Directory
inline struct dirent* readdir(DIR* directory)
{
- if (directory == NULL) {
+ if (directory == nullptr) {
errno = EBADF;
- return NULL;
+ return nullptr;
}
if (!internal::reentrant_advance_dir_stream(directory)) {
- return NULL;
+ return nullptr;
}
return &directory->curr;
@@ -145,11 +145,11 @@ inline struct dirent* readdir(DIR* directory)
// Implementation of the standard POSIX function. See documentation[1].
//
// On success: return 0 and set `*result` (note that `result` is not the same
-// as `*result`) to point at the next directory entry, or `NULL` if we've
+// as `*result`) to point at the next directory entry, or `nullptr` if we've
// reached the end of the stream.
//
// On failure: return a positive error number and set `*result` (not `result`)
-// to point at `NULL`.
+// to point at `nullptr`.
//
// [1] https://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html
inline int readdir_r(
@@ -157,14 +157,14 @@ inline int readdir_r(
struct dirent* entry,
struct dirent** result)
{
- if (directory == NULL) {
+ if (directory == nullptr) {
errno = EBADF;
- *result = NULL;
+ *result = nullptr;
return 1;
}
if (!internal::reentrant_advance_dir_stream(directory)) {
- *result = NULL;
+ *result = nullptr;
return 0;
}
@@ -182,7 +182,7 @@ inline int readdir_r(
// [1] http://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html#Reading_002fClosing-Directory
inline int closedir(DIR* directory)
{
- if (directory == NULL) {
+ if (directory == nullptr) {
errno = EBADF;
return -1;
}
@@ -202,7 +202,7 @@ namespace internal {
inline void free_dir(DIR* directory)
{
- if (directory != NULL) {
+ if (directory != nullptr) {
free(directory->d_name);
}
@@ -212,7 +212,7 @@ inline void free_dir(DIR* directory)
inline bool open_dir_stream(DIR* directory)
{
- assert(directory != NULL);
+ assert(directory != nullptr);
directory->handle = FindFirstFile(directory->d_name, &directory->fd);
@@ -235,7 +235,7 @@ inline bool open_dir_stream(DIR* directory)
inline bool reentrant_advance_dir_stream(DIR* directory)
{
- assert(directory != NULL);
+ assert(directory != nullptr);
if (!FindNextFile(directory->handle, &directory->fd)) {
return false;
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/internal/windows/grp.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/internal/windows/grp.hpp b/3rdparty/stout/include/stout/internal/windows/grp.hpp
index 232588c..74f7e0a 100644
--- a/3rdparty/stout/include/stout/internal/windows/grp.hpp
+++ b/3rdparty/stout/include/stout/internal/windows/grp.hpp
@@ -33,16 +33,16 @@ struct group
// Dummy implementation of `getgrgid` for POSIX compliance. Per the POSIX
-// specification[1], we are to return `NULL` if an entry matching the GID is
+// specification[1], we are to return `nullptr` if an entry matching the GID is
// not found. On Windows, we will never find such an entry, so we always return
-// `NULL`. Just to be safe, we also set `errno` to `ENOSYS` which indicates the
-// function is not implemented.
+// `nullptr`. Just to be safe, we also set `errno` to `ENOSYS` which indicates
+// the function is not implemented.
//
// [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/getgrgid.html
inline struct group* getgrgid(gid_t)
{
errno = ENOSYS;
- return NULL;
+ return nullptr;
}
#endif // __STOUT_INTERNAL_WINDOWS_GRP_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/internal/windows/pwd.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/internal/windows/pwd.hpp b/3rdparty/stout/include/stout/internal/windows/pwd.hpp
index 46e3ec2..65ec606 100644
--- a/3rdparty/stout/include/stout/internal/windows/pwd.hpp
+++ b/3rdparty/stout/include/stout/internal/windows/pwd.hpp
@@ -34,16 +34,16 @@ struct passwd
// Dummy implementation of `getpwuid` for POSIX compliance. Per the POSIX
-// specification[1], we are to return `NULL` if an entry matching the UID is
+// specification[1], we are to return `nullptr` if an entry matching the UID is
// not found. On Windows, we will never find such an entry, so we always return
-// `NULL`. Just to be safe, we also set `errno` to `ENOSYS` which indicates the
-// function is not implemented.
+// `nullptr`. Just to be safe, we also set `errno` to `ENOSYS` which indicates
+// the function is not implemented.
//
// [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/getgrgid.html
inline struct passwd* getpwuid(uid_t)
{
errno = ENOSYS;
- return NULL;
+ return nullptr;
}
#endif // __STOUT_INTERNAL_WINDOWS_PWD_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp b/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp
index 85eb0be..a922843 100644
--- a/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp
+++ b/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp
@@ -196,10 +196,10 @@ inline Try<SharedHandle> get_handle_no_follow(const std::string& absolute_path)
absolute_path.c_str(),
GENERIC_READ, // Open the file for reading only.
FILE_SHARE_READ, // Just reading this file, allow others to do the same.
- NULL, // Ignored.
+ nullptr, // Ignored.
OPEN_EXISTING, // Open existing symlink.
- access_flags, // Open symlink, not the file it points to.
- NULL); // Ignored.
+ access_flags, // Open symlink, not the file it points to.
+ nullptr); // Ignored.
if (handle == INVALID_HANDLE_VALUE) {
return WindowsError(
@@ -246,12 +246,12 @@ inline Try<SymbolicLink> get_symbolic_link_data(const HANDLE handle)
const BOOL reparse_data_obtained = ::DeviceIoControl(
handle, // Handle to file or directory.
FSCTL_GET_REPARSE_POINT, // Gets reparse point data for file/folder.
- NULL, // Ignored.
+ nullptr, // Ignored.
0, // Ignored.
reparse_point_data,
reparse_point_data_size,
&ignored, // Ignored.
- NULL); // Ignored.
+ nullptr); // Ignored.
if (!reparse_data_obtained) {
return WindowsError(
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/ip.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/ip.hpp b/3rdparty/stout/include/stout/ip.hpp
index ffeb2d7..f226943 100644
--- a/3rdparty/stout/include/stout/ip.hpp
+++ b/3rdparty/stout/include/stout/ip.hpp
@@ -254,7 +254,7 @@ inline std::ostream& operator<<(std::ostream& stream, const IP& ip)
case AF_INET: {
char buffer[INET_ADDRSTRLEN];
struct in_addr in = ip.in().get();
- if (inet_ntop(AF_INET, &in, buffer, sizeof(buffer)) == NULL) {
+ if (inet_ntop(AF_INET, &in, buffer, sizeof(buffer)) == nullptr) {
// We do not expect inet_ntop to fail because all parameters
// passed in are valid.
ABORT("Failed to get human-readable IP for " +
@@ -434,7 +434,7 @@ inline Result<IPNetwork> IPNetwork::fromLinkDevice(
return Error("Unsupported family type: " + stringify(family));
}
- struct ifaddrs* ifaddr = NULL;
+ struct ifaddrs* ifaddr = nullptr;
if (getifaddrs(&ifaddr) == -1) {
return ErrnoError();
}
@@ -442,14 +442,14 @@ inline Result<IPNetwork> IPNetwork::fromLinkDevice(
// Indicates whether the link device is found or not.
bool found = false;
- for (struct ifaddrs* ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
- if (ifa->ifa_name != NULL && !strcmp(ifa->ifa_name, name.c_str())) {
+ for (struct ifaddrs* ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next) {
+ if (ifa->ifa_name != nullptr && !strcmp(ifa->ifa_name, name.c_str())) {
found = true;
- if (ifa->ifa_addr != NULL && ifa->ifa_addr->sa_family == family) {
+ if (ifa->ifa_addr != nullptr && ifa->ifa_addr->sa_family == family) {
IP address = IP::create(*ifa->ifa_addr).get();
- if (ifa->ifa_netmask != NULL &&
+ if (ifa->ifa_netmask != nullptr &&
ifa->ifa_netmask->sa_family == family) {
IP netmask = IP::create(*ifa->ifa_netmask).get();
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/json.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/json.hpp b/3rdparty/stout/include/stout/json.hpp
index a1740a9..829838b 100644
--- a/3rdparty/stout/include/stout/json.hpp
+++ b/3rdparty/stout/include/stout/json.hpp
@@ -312,7 +312,7 @@ template <typename T>
bool Value::is() const
{
const T* t = boost::get<T>(this);
- return t != NULL;
+ return t != nullptr;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/mac.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/mac.hpp b/3rdparty/stout/include/stout/mac.hpp
index 09c0d49..1aaafe1 100644
--- a/3rdparty/stout/include/stout/mac.hpp
+++ b/3rdparty/stout/include/stout/mac.hpp
@@ -141,7 +141,7 @@ inline Result<MAC> mac(const std::string& name)
#if !defined(__linux__) && !defined(__APPLE__) && !defined(__FreeBSD__)
return Error("Not implemented");
#else
- struct ifaddrs* ifaddr = NULL;
+ struct ifaddrs* ifaddr = nullptr;
if (getifaddrs(&ifaddr) == -1) {
return ErrnoError();
}
@@ -149,12 +149,12 @@ inline Result<MAC> mac(const std::string& name)
// Indicates whether the link device is found or not.
bool found = false;
- for (struct ifaddrs* ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
- if (ifa->ifa_name != NULL && !strcmp(ifa->ifa_name, name.c_str())) {
+ for (struct ifaddrs* ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next) {
+ if (ifa->ifa_name != nullptr && !strcmp(ifa->ifa_name, name.c_str())) {
found = true;
# if defined(__linux__)
- if (ifa->ifa_addr != NULL && ifa->ifa_addr->sa_family == AF_PACKET) {
+ if (ifa->ifa_addr != nullptr && ifa->ifa_addr->sa_family == AF_PACKET) {
struct sockaddr_ll* link = (struct sockaddr_ll*) ifa->ifa_addr;
if (link->sll_halen == 6) {
@@ -172,7 +172,7 @@ inline Result<MAC> mac(const std::string& name)
}
}
# elif defined(__APPLE__)
- if (ifa->ifa_addr != NULL && ifa->ifa_addr->sa_family == AF_LINK) {
+ if (ifa->ifa_addr != nullptr && ifa->ifa_addr->sa_family == AF_LINK) {
struct sockaddr_dl* link = (struct sockaddr_dl*) ifa->ifa_addr;
if (link->sdl_type == IFT_ETHER && link->sdl_alen == 6) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/net.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/net.hpp b/3rdparty/stout/include/stout/net.hpp
index 341d8ec..083b8d1 100644
--- a/3rdparty/stout/include/stout/net.hpp
+++ b/3rdparty/stout/include/stout/net.hpp
@@ -102,7 +102,7 @@ inline Try<Bytes> contentLength(const std::string& url)
initialize();
CURL* curl = curl_easy_init();
- if (curl == NULL) {
+ if (curl == nullptr) {
curl_easy_cleanup(curl);
return Error("Failed to initialize libcurl");
}
@@ -149,18 +149,18 @@ inline Try<int> download(const std::string& url, const std::string& path)
CURL* curl = curl_easy_init();
- if (curl == NULL) {
+ if (curl == nullptr) {
curl_easy_cleanup(curl);
os::close(fd.get());
return Error("Failed to initialize libcurl");
}
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, nullptr);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true);
FILE* file = fdopen(fd.get(), "w");
- if (file == NULL) {
+ if (file == nullptr) {
curl_easy_cleanup(curl);
os::close(fd.get());
return ErrnoError("Failed to open file handle of '" + path + "'");
@@ -234,9 +234,9 @@ inline Try<std::string> hostname()
// TODO(evelinad): Add AF_UNSPEC when we will support IPv6.
struct addrinfo hints = createAddrInfo(SOCK_STREAM, AF_INET, AI_CANONNAME);
- struct addrinfo* result = NULL;
+ struct addrinfo* result = nullptr;
- int error = getaddrinfo(host, NULL, &hints, &result);
+ int error = getaddrinfo(host, nullptr, &hints, &result);
if (error != 0) {
return Error(gai_strerror(error));
@@ -266,7 +266,7 @@ inline Try<std::string> getHostname(const IP& ip)
#endif
hostname,
MAXHOSTNAMELEN,
- NULL,
+ nullptr,
0,
0);
@@ -284,14 +284,14 @@ inline Try<std::set<std::string>> links()
#if !defined(__linux__) && !defined(__APPLE__) && !defined(__FreeBSD__)
return Error("Not implemented");
#else
- struct ifaddrs* ifaddr = NULL;
+ struct ifaddrs* ifaddr = nullptr;
if (getifaddrs(&ifaddr) == -1) {
return ErrnoError();
}
std::set<std::string> names;
- for (struct ifaddrs* ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
- if (ifa->ifa_name != NULL) {
+ for (struct ifaddrs* ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next) {
+ if (ifa->ifa_name != nullptr) {
names.insert(ifa->ifa_name);
}
}
@@ -307,15 +307,15 @@ inline Try<std::set<std::string>> links()
inline Try<IP> getIP(const std::string& hostname, int family)
{
struct addrinfo hints = createAddrInfo(SOCK_STREAM, family, 0);
- struct addrinfo* result = NULL;
+ struct addrinfo* result = nullptr;
- int error = getaddrinfo(hostname.c_str(), NULL, &hints, &result);
+ int error = getaddrinfo(hostname.c_str(), nullptr, &hints, &result);
if (error != 0) {
return Error(gai_strerror(error));
}
- if (result->ai_addr == NULL) {
+ if (result->ai_addr == nullptr) {
freeaddrinfo(result);
return Error("No addresses found");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/environment.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/environment.hpp b/3rdparty/stout/include/stout/os/environment.hpp
index 9b4c74d..d8c3499 100644
--- a/3rdparty/stout/include/stout/os/environment.hpp
+++ b/3rdparty/stout/include/stout/os/environment.hpp
@@ -27,7 +27,7 @@ inline std::map<std::string, std::string> environment()
std::map<std::string, std::string> result;
- for (size_t index = 0; env[index] != NULL; index++) {
+ for (size_t index = 0; env[index] != nullptr; index++) {
std::string entry(env[index]);
size_t position = entry.find_first_of('=');
if (position == std::string::npos) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/freebsd.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/freebsd.hpp b/3rdparty/stout/include/stout/os/freebsd.hpp
index ce4e4cc..3f5142c 100644
--- a/3rdparty/stout/include/stout/os/freebsd.hpp
+++ b/3rdparty/stout/include/stout/os/freebsd.hpp
@@ -93,7 +93,7 @@ inline Try<Memory> memory()
"vm.stats.v_free_count",
&freeCount,
&length,
- NULL,
+ nullptr,
0) != 0) {
return ErrnoError();
}
@@ -113,7 +113,7 @@ inline Try<Memory> memory()
size_t xswdSize = sizeof(xswd);
int* mibDevice = &(mib[mibSize + 1]);
for (*mibDevice = 0; ; (*mibDevice)++) {
- if (::sysctl(mib, 3, &xswd, &xswdSize, NULL, 0) != 0) {
+ if (::sysctl(mib, 3, &xswd, &xswdSize, nullptr, 0) != 0) {
if (errno == ENOENT) {
break;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/ls.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/ls.hpp b/3rdparty/stout/include/stout/os/ls.hpp
index 216a4fc..f8da9ef 100644
--- a/3rdparty/stout/include/stout/os/ls.hpp
+++ b/3rdparty/stout/include/stout/os/ls.hpp
@@ -35,14 +35,14 @@ inline Try<std::list<std::string>> ls(const std::string& directory)
{
DIR* dir = opendir(directory.c_str());
- if (dir == NULL) {
+ if (dir == nullptr) {
// Preserve `opendir` error.
return ErrnoError("Failed to opendir '" + directory + "'");
}
dirent* temp = (dirent*) malloc(os::dirent_size(dir));
- if (temp == NULL) {
+ if (temp == nullptr) {
// Preserve `malloc` error.
ErrnoError error("Failed to allocate directory entries");
closedir(dir);
@@ -53,7 +53,7 @@ inline Try<std::list<std::string>> ls(const std::string& directory)
struct dirent* entry;
int error;
- while ((error = readdir_r(dir, temp, &entry)) == 0 && entry != NULL) {
+ while ((error = readdir_r(dir, temp, &entry)) == 0 && entry != nullptr) {
if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) {
continue;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/osx.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/osx.hpp b/3rdparty/stout/include/stout/os/osx.hpp
index a801092..ca77bb0 100644
--- a/3rdparty/stout/include/stout/os/osx.hpp
+++ b/3rdparty/stout/include/stout/os/osx.hpp
@@ -215,7 +215,7 @@ inline Try<Memory> memory()
"vm.page_free_count",
&freeCount,
&length,
- NULL,
+ nullptr,
0) != 0) {
return ErrnoError();
}
@@ -227,7 +227,7 @@ inline Try<Memory> memory()
"vm.swapusage",
&usage,
&length,
- NULL,
+ nullptr,
0) != 0) {
return ErrnoError();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/posix/chown.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/chown.hpp b/3rdparty/stout/include/stout/os/posix/chown.hpp
index 6068409..c82e2e5 100644
--- a/3rdparty/stout/include/stout/os/posix/chown.hpp
+++ b/3rdparty/stout/include/stout/os/posix/chown.hpp
@@ -60,7 +60,7 @@ inline Try<Nothing> chown(
bool recursive = true)
{
passwd* passwd;
- if ((passwd = ::getpwnam(user.c_str())) == NULL) {
+ if ((passwd = ::getpwnam(user.c_str())) == nullptr) {
return ErrnoError("Failed to get user information for '" + user + "'");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/posix/fork.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/fork.hpp b/3rdparty/stout/include/stout/os/posix/fork.hpp
index a906e4e..a29967d 100644
--- a/3rdparty/stout/include/stout/os/posix/fork.hpp
+++ b/3rdparty/stout/include/stout/os/posix/fork.hpp
@@ -302,7 +302,7 @@ private:
}
void* memory = mmap(
- NULL,
+ nullptr,
sizeof(Tree::Memory),
PROT_READ | PROT_WRITE, MAP_SHARED,
fd,
@@ -369,13 +369,13 @@ private:
if (exec.isSome()) {
// Execute the command (via '/bin/sh -c command').
const char* command = exec.get().command.c_str();
- execlp("sh", "sh", "-c", command, (char*) NULL);
+ execlp("sh", "sh", "-c", command, (char*) nullptr);
EXIT(EXIT_FAILURE)
<< "Failed to execute '" << command << "': " << os::strerror(errno);
} else if (wait.isSome()) {
foreach (pid_t pid, pids) {
// TODO(benh): Check for signal interruption or other errors.
- waitpid(pid, NULL, 0);
+ waitpid(pid, nullptr, 0);
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/posix/mkdtemp.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/mkdtemp.hpp b/3rdparty/stout/include/stout/os/posix/mkdtemp.hpp
index bbfbb8a..31acbd4 100644
--- a/3rdparty/stout/include/stout/os/posix/mkdtemp.hpp
+++ b/3rdparty/stout/include/stout/os/posix/mkdtemp.hpp
@@ -29,7 +29,7 @@ namespace os {
inline Try<std::string> mkdtemp(const std::string& path = "/tmp/XXXXXX")
{
char* temp = new char[path.size() + 1];
- if (::mkdtemp(::strcpy(temp, path.c_str())) != NULL) {
+ if (::mkdtemp(::strcpy(temp, path.c_str())) != nullptr) {
std::string result(temp);
delete[] temp;
return result;
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/posix/rmdir.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/rmdir.hpp b/3rdparty/stout/include/stout/os/posix/rmdir.hpp
index a6d3b57..4780a13 100644
--- a/3rdparty/stout/include/stout/os/posix/rmdir.hpp
+++ b/3rdparty/stout/include/stout/os/posix/rmdir.hpp
@@ -43,7 +43,7 @@ inline Try<Nothing> rmdir(
return ErrnoError();
}
} else {
- // NOTE: `fts_open` will not always return `NULL` if the path does not
+ // NOTE: `fts_open` will not always return `nullptr` if the path does not
// exist. We manually induce an error here to indicate that we can't remove
// a directory that does not exist.
if (!os::exists(directory)) {
@@ -51,17 +51,17 @@ inline Try<Nothing> rmdir(
return ErrnoError();
}
- char* paths[] = {const_cast<char*>(directory.c_str()), NULL};
+ char* paths[] = {const_cast<char*>(directory.c_str()), nullptr};
// Using `FTS_PHYSICAL` here because we need `FTSENT` for the
// symbolic link in the directory and not the target it links to.
- FTS* tree = fts_open(paths, (FTS_NOCHDIR | FTS_PHYSICAL), NULL);
- if (tree == NULL) {
+ FTS* tree = fts_open(paths, (FTS_NOCHDIR | FTS_PHYSICAL), nullptr);
+ if (tree == nullptr) {
return ErrnoError();
}
FTSENT* node;
- while ((node = fts_read(tree)) != NULL) {
+ while ((node = fts_read(tree)) != nullptr) {
switch (node->fts_info) {
case FTS_DP:
// Don't remove the root of the traversal of `removeRoot`
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/posix/sendfile.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/sendfile.hpp b/3rdparty/stout/include/stout/os/posix/sendfile.hpp
index c2806fa..0af2ebe 100644
--- a/3rdparty/stout/include/stout/os/posix/sendfile.hpp
+++ b/3rdparty/stout/include/stout/os/posix/sendfile.hpp
@@ -57,7 +57,7 @@ inline Try<ssize_t, SocketError> sendfile(
// On OS X, sendfile does not need to have SIGPIPE suppressed.
off_t _length = static_cast<off_t>(length);
- if (::sendfile(fd, s, offset, &_length, NULL, 0) < 0) {
+ if (::sendfile(fd, s, offset, &_length, nullptr, 0) < 0) {
if (errno == EAGAIN && _length > 0) {
return _length;
}
@@ -69,7 +69,7 @@ inline Try<ssize_t, SocketError> sendfile(
off_t _length = 0;
SUPPRESS (SIGPIPE) {
- if (::sendfile(fd, s, offset, length, NULL, &_length, 0) < 0) {
+ if (::sendfile(fd, s, offset, length, nullptr, &_length, 0) < 0) {
if (errno == EAGAIN && length > 0) {
return _length;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/posix/shell.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/shell.hpp b/3rdparty/stout/include/stout/os/posix/shell.hpp
index b786d47..d4753cf 100644
--- a/3rdparty/stout/include/stout/os/posix/shell.hpp
+++ b/3rdparty/stout/include/stout/os/posix/shell.hpp
@@ -77,14 +77,14 @@ Try<std::string> shell(const std::string& fmt, const T&... t)
FILE* file;
std::ostringstream stdout;
- if ((file = popen(command.get().c_str(), "r")) == NULL) {
+ if ((file = popen(command.get().c_str(), "r")) == nullptr) {
return Error("Failed to run '" + command.get() + "'");
}
char line[1024];
// NOTE(vinod): Ideally the if and while loops should be interchanged. But
// we get a broken pipe error if we don't read the output and simply close.
- while (fgets(line, sizeof(line), file) != NULL) {
+ while (fgets(line, sizeof(line), file) != nullptr) {
stdout << line;
}
@@ -129,7 +129,7 @@ inline int system(const std::string& command)
} else if (pid == 0) {
// In child process.
::execlp(
- Shell::name, Shell::arg0, Shell::arg1, command.c_str(), (char*)NULL);
+ Shell::name, Shell::arg0, Shell::arg1, command.c_str(), (char*)nullptr);
::exit(127);
} else {
// In parent process.
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/posix/signals.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/signals.hpp b/3rdparty/stout/include/stout/os/posix/signals.hpp
index f46f591..23f3d57 100644
--- a/3rdparty/stout/include/stout/os/posix/signals.hpp
+++ b/3rdparty/stout/include/stout/os/posix/signals.hpp
@@ -31,7 +31,7 @@ inline int install(int signal, void(*handler)(int))
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = handler;
- return sigaction(signal, &action, NULL);
+ return sigaction(signal, &action, nullptr);
}
@@ -42,7 +42,7 @@ inline int reset(int signal)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_DFL;
- return sigaction(signal, &action, NULL);
+ return sigaction(signal, &action, nullptr);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/posix/su.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/su.hpp b/3rdparty/stout/include/stout/os/posix/su.hpp
index 43e91d6..0a3f239 100644
--- a/3rdparty/stout/include/stout/os/posix/su.hpp
+++ b/3rdparty/stout/include/stout/os/posix/su.hpp
@@ -36,7 +36,7 @@ inline Result<uid_t> getuid(const Option<std::string>& user = None())
}
struct passwd passwd;
- struct passwd* result = NULL;
+ struct passwd* result = nullptr;
int size = sysconf(_SC_GETPW_R_SIZE_MAX);
if (size == -1) {
@@ -49,8 +49,8 @@ inline Result<uid_t> getuid(const Option<std::string>& user = None())
if (getpwnam_r(user.get().c_str(), &passwd, buffer, size, &result) == 0) {
// The usual interpretation of POSIX is that getpwnam_r will
- // return 0 but set result == NULL if the user is not found.
- if (result == NULL) {
+ // return 0 but set result == nullptr if the user is not found.
+ if (result == nullptr) {
delete[] buffer;
return None();
}
@@ -92,7 +92,7 @@ inline Result<gid_t> getgid(const Option<std::string>& user = None())
}
struct passwd passwd;
- struct passwd* result = NULL;
+ struct passwd* result = nullptr;
int size = sysconf(_SC_GETPW_R_SIZE_MAX);
if (size == -1) {
@@ -105,8 +105,8 @@ inline Result<gid_t> getgid(const Option<std::string>& user = None())
if (getpwnam_r(user.get().c_str(), &passwd, buffer, size, &result) == 0) {
// The usual interpretation of POSIX is that getpwnam_r will
- // return 0 but set result == NULL if the group is not found.
- if (result == NULL) {
+ // return 0 but set result == nullptr if the group is not found.
+ if (result == nullptr) {
delete[] buffer;
return None();
}
@@ -154,15 +154,15 @@ inline Result<std::string> user(Option<uid_t> uid = None())
}
struct passwd passwd;
- struct passwd* result = NULL;
+ struct passwd* result = nullptr;
while (true) {
char* buffer = new char[size];
if (getpwuid_r(uid.get(), &passwd, buffer, size, &result) == 0) {
- // getpwuid_r will return 0 but set result == NULL if the uid is
+ // getpwuid_r will return 0 but set result == nullptr if the uid is
// not found.
- if (result == NULL) {
+ if (result == nullptr) {
delete[] buffer;
return None();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/read.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/read.hpp b/3rdparty/stout/include/stout/os/read.hpp
index 77ad34a..d0b657d 100644
--- a/3rdparty/stout/include/stout/os/read.hpp
+++ b/3rdparty/stout/include/stout/os/read.hpp
@@ -105,7 +105,7 @@ inline Try<std::string> read(const std::string& path)
inline Try<std::string> read(const std::string& path)
{
FILE* file = ::fopen(path.c_str(), "r");
- if (file == NULL) {
+ if (file == nullptr) {
return ErrnoError("Failed to open file");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/realpath.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/realpath.hpp b/3rdparty/stout/include/stout/os/realpath.hpp
index c368309..22a8cb7 100644
--- a/3rdparty/stout/include/stout/os/realpath.hpp
+++ b/3rdparty/stout/include/stout/os/realpath.hpp
@@ -26,7 +26,7 @@ namespace os {
inline Result<std::string> realpath(const std::string& path)
{
char temp[PATH_MAX];
- if (::realpath(path.c_str(), temp) == NULL) {
+ if (::realpath(path.c_str(), temp) == nullptr) {
if (errno == ENOENT || errno == ENOTDIR) {
return None();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/sysctl.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/sysctl.hpp b/3rdparty/stout/include/stout/os/sysctl.hpp
index bb78bb6..6db7bf6 100644
--- a/3rdparty/stout/include/stout/os/sysctl.hpp
+++ b/3rdparty/stout/include/stout/os/sysctl.hpp
@@ -189,14 +189,14 @@ inline Try<std::string> sysctl::string() const
{
// First determine the size of the string.
size_t size = 0;
- if (::sysctl(name, levels, NULL, &size, NULL, 0) == -1) {
+ if (::sysctl(name, levels, nullptr, &size, nullptr, 0) == -1) {
return ErrnoError();
}
// Now read it.
size_t length = size / sizeof(char);
char* temp = new char[length];
- if (::sysctl(name, levels, temp, &size, NULL, 0) == -1) {
+ if (::sysctl(name, levels, temp, &size, nullptr, 0) == -1) {
Error error = ErrnoError();
delete[] temp;
return error;
@@ -219,7 +219,7 @@ inline Try<timeval> sysctl::time() const
{
timeval result;
size_t size = sizeof(result);
- if (::sysctl(name, levels, &result, &size, NULL, 0) == -1) {
+ if (::sysctl(name, levels, &result, &size, nullptr, 0) == -1) {
return ErrnoError();
}
return result;
@@ -245,7 +245,7 @@ sysctl::Integer::operator Try<T>()
{
T i;
size_t size = sizeof(i);
- if (::sysctl(name, levels, &i, &size, NULL, 0) == -1) {
+ if (::sysctl(name, levels, &i, &size, nullptr, 0) == -1) {
return ErrnoError();
}
return i;
@@ -267,7 +267,7 @@ sysctl::Table::operator Try<std::vector<T>>()
{
size_t size = 0;
if (length.isNone()) {
- if (::sysctl(name, levels, NULL, &size, NULL, 0) == -1) {
+ if (::sysctl(name, levels, nullptr, &size, nullptr, 0) == -1) {
return ErrnoError();
}
if (size % sizeof(T) != 0) {
@@ -280,7 +280,7 @@ sysctl::Table::operator Try<std::vector<T>>()
T* ts = new T[length.get()];
size = length.get() * sizeof(T);
- if (::sysctl(name, levels, ts, &size, NULL, 0) == -1) {
+ if (::sysctl(name, levels, ts, &size, nullptr, 0) == -1) {
Error error = ErrnoError();
delete[] ts;
return error;
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/utime.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/utime.hpp b/3rdparty/stout/include/stout/os/utime.hpp
index 0d721a1..b44a353 100644
--- a/3rdparty/stout/include/stout/os/utime.hpp
+++ b/3rdparty/stout/include/stout/os/utime.hpp
@@ -34,7 +34,7 @@ inline Try<Nothing> utime(const std::string& path)
// NOTE: on Windows, this correctly dispatches to `_utime`, so there is no
// need to create a function alias in `stout/windows.hpp` as we have done for
// `stout/os/mkdir.hpp` and friends.
- if (::utime(path.c_str(), NULL) == -1) {
+ if (::utime(path.c_str(), nullptr) == -1) {
return ErrnoError();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/windows/exists.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/exists.hpp b/3rdparty/stout/include/stout/os/windows/exists.hpp
index 6530869..42b8a9d 100644
--- a/3rdparty/stout/include/stout/os/windows/exists.hpp
+++ b/3rdparty/stout/include/stout/os/windows/exists.hpp
@@ -61,7 +61,7 @@ inline bool exists(pid_t pid)
bool has_handle = false;
- if (handle != NULL) {
+ if (handle != nullptr) {
has_handle = true;
CloseHandle(handle);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/windows/fcntl.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/fcntl.hpp b/3rdparty/stout/include/stout/os/windows/fcntl.hpp
index 63533ab..2bc794a 100644
--- a/3rdparty/stout/include/stout/os/windows/fcntl.hpp
+++ b/3rdparty/stout/include/stout/os/windows/fcntl.hpp
@@ -59,7 +59,7 @@ inline Try<Nothing> nonblock(int fd)
if (GetFileType(handle) == FILE_TYPE_PIPE) {
DWORD pipe_mode = PIPE_NOWAIT;
- if (SetNamedPipeHandleState(handle, &pipe_mode, NULL, NULL)) {
+ if (SetNamedPipeHandleState(handle, &pipe_mode, nullptr, nullptr)) {
return WindowsError();
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/windows/kill.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/kill.hpp b/3rdparty/stout/include/stout/os/windows/kill.hpp
index 660c872..0ddb3ee 100644
--- a/3rdparty/stout/include/stout/os/windows/kill.hpp
+++ b/3rdparty/stout/include/stout/os/windows/kill.hpp
@@ -29,7 +29,7 @@ namespace internal {
inline int kill_process(pid_t pid)
{
HANDLE process_handle = ::OpenProcess(PROCESS_TERMINATE, FALSE, pid);
- if (process_handle == NULL) {
+ if (process_handle == nullptr) {
LOG(ERROR) << "os::kill_process(): Failed call to OpenProcess";
return KILL_FAIL;
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/windows/sendfile.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/sendfile.hpp b/3rdparty/stout/include/stout/os/windows/sendfile.hpp
index 7b2a724..4c5178e 100644
--- a/3rdparty/stout/include/stout/os/windows/sendfile.hpp
+++ b/3rdparty/stout/include/stout/os/windows/sendfile.hpp
@@ -35,9 +35,9 @@ inline Try<ssize_t, SocketError> sendfile(
0,
0,
{static_cast<DWORD>(offset), static_cast<DWORD>(offset >> 32)},
- NULL};
+ nullptr};
- if (TransmitFile(s, file, length, 0, &from, NULL, 0) == FALSE &&
+ if (TransmitFile(s, file, length, 0, &from, nullptr, 0) == FALSE &&
(WSAGetLastError() == WSA_IO_PENDING ||
WSAGetLastError() == ERROR_IO_PENDING)) {
DWORD sent = 0;
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/os/windows/shell.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/shell.hpp b/3rdparty/stout/include/stout/os/windows/shell.hpp
index 66f2306..c6e141a 100644
--- a/3rdparty/stout/include/stout/os/windows/shell.hpp
+++ b/3rdparty/stout/include/stout/os/windows/shell.hpp
@@ -69,14 +69,14 @@ Try<std::string> shell(const std::string& fmt, const T&... t)
FILE* file;
std::ostringstream stdoutstr;
- if ((file = _popen(command.get().c_str(), "r")) == NULL) {
+ if ((file = _popen(command.get().c_str(), "r")) == nullptr) {
return Error("Failed to run '" + command.get() + "'");
}
char line[1024];
// NOTE(vinod): Ideally the if and while loops should be interchanged. But
// we get a broken pipe error if we don't read the output and simply close.
- while (fgets(line, sizeof(line), file) != NULL) {
+ while (fgets(line, sizeof(line), file) != nullptr) {
stdoutstr << line;
}
@@ -100,7 +100,7 @@ Try<std::string> shell(const std::string& fmt, const T&... t)
inline int system(const std::string& command)
{
return ::_spawnlp(
- _P_WAIT, Shell::name, Shell::arg0, Shell::arg1, command.c_str(), NULL);
+ _P_WAIT, Shell::name, Shell::arg0, Shell::arg1, command.c_str(), nullptr);
}
@@ -113,12 +113,12 @@ inline int execlp(const char* file, T... t)
// Concatenates multiple command-line arguments and escapes the values.
// If `arg` is not specified (or takes the value `0`), the function will
-// scan `argv` until a `NULL` is encountered.
+// scan `argv` until a `nullptr` is encountered.
inline std::string stringify_args(char** argv, unsigned long argc = 0)
{
std::string arg_line = "";
unsigned long index = 0;
- while ((argc == 0 || index < argc) && argv[index] != NULL) {
+ while ((argc == 0 || index < argc) && argv[index] != nullptr) {
// TODO(dpravat): (MESOS-5522) Format these args for all cases.
// Specifically, we need to:
// (1) Add double quotes around arguments that contain special
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/posix/dynamiclibrary.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/posix/dynamiclibrary.hpp b/3rdparty/stout/include/stout/posix/dynamiclibrary.hpp
index 427ff8a..2b34322 100644
--- a/3rdparty/stout/include/stout/posix/dynamiclibrary.hpp
+++ b/3rdparty/stout/include/stout/posix/dynamiclibrary.hpp
@@ -28,11 +28,11 @@
class DynamicLibrary
{
public:
- DynamicLibrary() : handle_(NULL) { }
+ DynamicLibrary() : handle_(nullptr) { }
virtual ~DynamicLibrary()
{
- if (handle_ != NULL) {
+ if (handle_ != nullptr) {
close();
}
}
@@ -40,13 +40,13 @@ public:
Try<Nothing> open(const std::string& path)
{
// Check if we've already opened a library.
- if (handle_ != NULL) {
+ if (handle_ != nullptr) {
return Error("Library already opened");
}
handle_ = dlopen(path.c_str(), RTLD_NOW);
- if (handle_ == NULL) {
+ if (handle_ == nullptr) {
return Error("Could not load library '" + path + "': " + dlerror());
}
@@ -57,8 +57,8 @@ public:
Try<Nothing> close()
{
- if (handle_ == NULL) {
- return Error("Could not close library; handle was already `NULL`");
+ if (handle_ == nullptr) {
+ return Error("Could not close library; handle was already `nullptr`");
}
if (dlclose(handle_) != 0) {
@@ -67,7 +67,7 @@ public:
(path_.isSome() ? path_.get() : "") + "': " + dlerror());
}
- handle_ = NULL;
+ handle_ = nullptr;
path_ = None();
return Nothing();
@@ -75,14 +75,14 @@ public:
Try<void*> loadSymbol(const std::string& name)
{
- if (handle_ == NULL) {
+ if (handle_ == nullptr) {
return Error(
- "Could not get symbol '" + name + "'; library handle was `NULL`");
+ "Could not get symbol '" + name + "'; library handle was `nullptr`");
}
void* symbol = dlsym(handle_, name.c_str());
- if (symbol == NULL) {
+ if (symbol == nullptr) {
return Error(
"Error looking up symbol '" + name + "' in '" +
(path_.isSome() ? path_.get() : "") + "' : " + dlerror());
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/posix/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/posix/os.hpp b/3rdparty/stout/include/stout/posix/os.hpp
index a92da6f..7abc454 100644
--- a/3rdparty/stout/include/stout/posix/os.hpp
+++ b/3rdparty/stout/include/stout/posix/os.hpp
@@ -235,7 +235,7 @@ inline Try<Nothing> sleep(const Duration& duration)
inline Try<std::list<std::string>> glob(const std::string& pattern)
{
glob_t g;
- int status = ::glob(pattern.c_str(), GLOB_NOSORT, NULL, &g);
+ int status = ::glob(pattern.c_str(), GLOB_NOSORT, nullptr, &g);
std::list<std::string> result;
@@ -363,7 +363,7 @@ inline Option<std::string> getenv(const std::string& key)
{
char* value = ::getenv(key.c_str());
- if (value == NULL) {
+ if (value == nullptr) {
return None();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/protobuf.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/protobuf.hpp b/3rdparty/stout/include/stout/protobuf.hpp
index 3c586ce..012a38f 100644
--- a/3rdparty/stout/include/stout/protobuf.hpp
+++ b/3rdparty/stout/include/stout/protobuf.hpp
@@ -432,7 +432,7 @@ struct Parser : boost::static_visitor<Try<Nothing> >
const google::protobuf::EnumValueDescriptor* descriptor =
field->enum_type()->FindValueByName(string.value);
- if (descriptor == NULL) {
+ if (descriptor == nullptr) {
return Error("Failed to find enum for '" + string.value + "'");
}
@@ -569,7 +569,7 @@ inline Try<Nothing> parse(
const google::protobuf::FieldDescriptor* field =
message->GetDescriptor()->FindFieldByName(name);
- if (field != NULL) {
+ if (field != nullptr) {
Try<Nothing> apply =
boost::apply_visitor(Parser(message, field), value);
@@ -595,7 +595,7 @@ struct Parse
"T must be a protobuf message");
const JSON::Object* object = boost::get<JSON::Object>(&value);
- if (object == NULL) {
+ if (object == nullptr) {
return Error("Expecting a JSON object");
}
@@ -631,7 +631,7 @@ struct Parse<google::protobuf::RepeatedPtrField<T>>
"T must be a protobuf message");
const JSON::Array* array = boost::get<JSON::Array>(&value);
- if (array == NULL) {
+ if (array == nullptr) {
return Error("Expecting a JSON array");
}
@@ -759,7 +759,7 @@ inline void json(ObjectWriter* writer, const Protobuf& protobuf)
break;
case FieldDescriptor::CPPTYPE_STRING:
const std::string& s = reflection->GetRepeatedStringReference(
- message, field, i, NULL);
+ message, field, i, nullptr);
if (field->type() == FieldDescriptor::TYPE_BYTES) {
writer->element(base64::encode(s));
} else {
@@ -802,7 +802,7 @@ inline void json(ObjectWriter* writer, const Protobuf& protobuf)
break;
case FieldDescriptor::CPPTYPE_STRING:
const std::string& s = reflection->GetStringReference(
- message, field, NULL);
+ message, field, nullptr);
if (field->type() == FieldDescriptor::TYPE_BYTES) {
writer->field(field->name(), base64::encode(s));
} else {
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/svn.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/svn.hpp b/3rdparty/stout/include/stout/svn.hpp
index 5aeee13..cc29f5a 100644
--- a/3rdparty/stout/include/stout/svn.hpp
+++ b/3rdparty/stout/include/stout/svn.hpp
@@ -77,7 +77,7 @@ inline Try<Diff> diff(const std::string& from, const std::string& to)
// Note that svn_pool_create wraps apr_pool_create_ex, which is
// thread safe, see: http://goo.gl/NX0hps.
- apr_pool_t* pool = svn_pool_create(NULL);
+ apr_pool_t* pool = svn_pool_create(nullptr);
// First we need to produce a text delta stream by diffing 'source'
// against 'target'.
@@ -110,7 +110,7 @@ inline Try<Diff> diff(const std::string& from, const std::string& to)
// format based diff. Setup the handler that will consume the text
// delta and produce the svndiff.
svn_txdelta_window_handler_t handler;
- void* baton = NULL;
+ void* baton = nullptr;
svn_stringbuf_t* diff = svn_stringbuf_create_ensure(1024, pool);
#if SVN_VER_MAJOR >= 1 && SVN_VER_MINOR >= 7
@@ -139,7 +139,7 @@ inline Try<Diff> diff(const std::string& from, const std::string& to)
// Now feed the text delta to the handler.
svn_error_t* error = svn_txdelta_send_txstream(delta, handler, baton, pool);
- if (error != NULL) {
+ if (error != nullptr) {
char buffer[1024];
std::string message(svn_err_best_message(error, buffer, 1024));
svn_pool_destroy(pool);
@@ -162,7 +162,7 @@ inline Try<std::string> patch(const std::string& s, const Diff& diff)
// Note that svn_pool_create wraps apr_pool_create_ex, which is
// thread safe, see: http://goo.gl/NX0hps.
- apr_pool_t* pool = svn_pool_create(NULL);
+ apr_pool_t* pool = svn_pool_create(nullptr);
// We want to apply the svndiff format diff to the source trying to
// produce a result. First setup a handler for applying a text delta
@@ -172,15 +172,15 @@ inline Try<std::string> patch(const std::string& s, const Diff& diff)
source.len = s.length();
svn_txdelta_window_handler_t handler;
- void* baton = NULL;
+ void* baton = nullptr;
svn_stringbuf_t* patched = svn_stringbuf_create_ensure(s.length(), pool);
svn_txdelta_apply(
svn_stream_from_string(&source, pool),
svn_stream_from_stringbuf(patched, pool),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
pool,
&handler,
&baton);
@@ -199,7 +199,7 @@ inline Try<std::string> patch(const std::string& s, const Diff& diff)
svn_error_t* error = svn_stream_write(stream, data, &length);
- if (error != NULL) {
+ if (error != nullptr) {
char buffer[1024];
std::string message(svn_err_best_message(error, buffer, 1024));
svn_pool_destroy(pool);
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/uuid.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/uuid.hpp b/3rdparty/stout/include/stout/uuid.hpp
index e3cf21f..cde3bdb 100644
--- a/3rdparty/stout/include/stout/uuid.hpp
+++ b/3rdparty/stout/include/stout/uuid.hpp
@@ -40,9 +40,9 @@ struct UUID : boost::uuids::uuid
public:
static UUID random()
{
- static THREAD_LOCAL boost::uuids::random_generator* generator = NULL;
+ static THREAD_LOCAL boost::uuids::random_generator* generator = nullptr;
- if (generator == NULL) {
+ if (generator == nullptr) {
generator = new boost::uuids::random_generator();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/windows/dynamiclibrary.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows/dynamiclibrary.hpp b/3rdparty/stout/include/stout/windows/dynamiclibrary.hpp
index 4235cb1..cfa6c88 100644
--- a/3rdparty/stout/include/stout/windows/dynamiclibrary.hpp
+++ b/3rdparty/stout/include/stout/windows/dynamiclibrary.hpp
@@ -28,11 +28,11 @@
class DynamicLibrary
{
public:
- DynamicLibrary() : handle_(NULL) { }
+ DynamicLibrary() : handle_(nullptr) { }
virtual ~DynamicLibrary()
{
- if (handle_ != NULL) {
+ if (handle_ != nullptr) {
close();
}
}
@@ -40,13 +40,13 @@ public:
Try<Nothing> open(const std::string& path)
{
// Check if we've already opened a library.
- if (handle_ != NULL) {
+ if (handle_ != nullptr) {
return Error("Library already opened");
}
handle_ = LoadLibrary(path.c_str());
- if (handle_ == NULL) {
+ if (handle_ == nullptr) {
return WindowsError("Could not load library '" + path + "'");
}
@@ -57,8 +57,8 @@ public:
Try<Nothing> close()
{
- if (handle_ == NULL) {
- return Error("Could not close library; handle was already `NULL`");
+ if (handle_ == nullptr) {
+ return Error("Could not close library; handle was already `nullptr`");
}
if (!FreeLibrary(handle_)) {
@@ -66,7 +66,7 @@ public:
"Could not close library '" + (path_.isSome() ? path_.get() : ""));
}
- handle_ = NULL;
+ handle_ = nullptr;
path_ = None();
return Nothing();
@@ -74,14 +74,14 @@ public:
Try<void*> loadSymbol(const std::string& name)
{
- if (handle_ == NULL) {
+ if (handle_ == nullptr) {
return Error(
- "Could not get symbol '" + name + "'; library handle was `NULL`");
+ "Could not get symbol '" + name + "'; library handle was `nullptr`");
}
void* symbol = GetProcAddress(handle_, name.c_str());
- if (symbol == NULL) {
+ if (symbol == nullptr) {
return WindowsError(
"Error looking up symbol '" + name + "' in '" +
(path_.isSome() ? path_.get() : ""));
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/windows/error.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows/error.hpp b/3rdparty/stout/include/stout/windows/error.hpp
index d634491..f296b82 100644
--- a/3rdparty/stout/include/stout/windows/error.hpp
+++ b/3rdparty/stout/include/stout/windows/error.hpp
@@ -84,12 +84,12 @@ private:
LPSTR message_buffer;
size_t size = FormatMessage(
allocate_message_buffer,
- NULL, // Ignored.
+ nullptr, // Ignored.
errorCode,
default_language,
(LPSTR) &message_buffer, // See comment above about quirky cast.
0, // Ignored.
- NULL); // Ignored.
+ nullptr); // Ignored.
std::string message(message_buffer, size);
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/include/stout/windows/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows/os.hpp b/3rdparty/stout/include/stout/windows/os.hpp
index 53bfd81..da458fb 100644
--- a/3rdparty/stout/include/stout/windows/os.hpp
+++ b/3rdparty/stout/include/stout/windows/os.hpp
@@ -59,7 +59,7 @@ inline Try<std::string> nodename()
// Get DNS name of the local computer. First, find the size of the output
// buffer.
DWORD size = 0;
- if (!::GetComputerNameEx(ComputerNameDnsHostname, NULL, &size) &&
+ if (!::GetComputerNameEx(ComputerNameDnsHostname, nullptr, &size) &&
::GetLastError() != ERROR_MORE_DATA) {
return WindowsError(
"os::internal::nodename: Call to `GetComputerNameEx` failed");
@@ -185,7 +185,7 @@ inline void setenv(
//
// [1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms683188(v=vs.85).aspx
if (!overwrite &&
- ::GetEnvironmentVariable(key.c_str(), NULL, 0) != 0 &&
+ ::GetEnvironmentVariable(key.c_str(), nullptr, 0) != 0 &&
::GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
return;
}
@@ -199,9 +199,9 @@ inline void setenv(
// environment variables.
inline void unsetenv(const std::string& key)
{
- // Per MSDN documentation[1], passing `NULL` as the value will cause
+ // Per MSDN documentation[1], passing `nullptr` as the value will cause
// `SetEnvironmentVariable` to delete the key from the process's environment.
- ::SetEnvironmentVariable(key.c_str(), NULL);
+ ::SetEnvironmentVariable(key.c_str(), nullptr);
}
@@ -267,7 +267,7 @@ inline Result<pid_t> waitpid(long pid, int* status, int options)
FALSE,
static_cast<DWORD>(pid));
- if (process == NULL) {
+ if (process == nullptr) {
return WindowsError("os::waitpid: Failed to open process for pid '" +
stringify(pid) + "'");
}
@@ -313,7 +313,7 @@ inline Result<pid_t> waitpid(long pid, int* status, int options)
}
// Attempt to retrieve exit code from child process. Store that exit code in
- // the `status` variable if it's `NULL`.
+ // the `status` variable if it's `nullptr`.
DWORD child_exit_code = 0;
if (!::GetExitCodeProcess(scoped_process.get(), &child_exit_code)) {
errno = ECHILD;
@@ -322,7 +322,7 @@ inline Result<pid_t> waitpid(long pid, int* status, int options)
std::to_string(pid) + "', but could not retrieve exit code");
}
- if (status != NULL) {
+ if (status != nullptr) {
*status = child_exit_code;
}
@@ -345,12 +345,12 @@ inline std::string hstrerror(int err)
case WSATRY_AGAIN: {
format_error = ::FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
+ nullptr,
err,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
buffer,
sizeof(buffer),
- NULL);
+ nullptr);
break;
}
default: {
@@ -495,7 +495,7 @@ inline Try<UTSInfo> uname()
// variable matching key is found, None() is returned.
inline Option<std::string> getenv(const std::string& key)
{
- DWORD buffer_size = ::GetEnvironmentVariable(key.c_str(), NULL, 0);
+ DWORD buffer_size = ::GetEnvironmentVariable(key.c_str(), nullptr, 0);
if (buffer_size == 0) {
return None();
}
@@ -518,14 +518,14 @@ inline Option<std::string> getenv(const std::string& key)
inline tm* gmtime_r(const time_t* timep, tm* result)
{
- return ::gmtime_s(result, timep) == ERROR_SUCCESS ? result : NULL;
+ return ::gmtime_s(result, timep) == ERROR_SUCCESS ? result : nullptr;
}
inline Result<PROCESSENTRY32> process_entry(pid_t pid)
{
// Get a snapshot of the processes in the system. NOTE: We should not check
- // whether the handle is `NULL`, because this API will always return
+ // whether the handle is `nullptr`, because this API will always return
// `INVALID_HANDLE_VALUE` on error.
HANDLE snapshot_handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, pid);
if (snapshot_handle == INVALID_HANDLE_VALUE) {
@@ -686,9 +686,9 @@ inline Try<HANDLE> create_job(pid_t pid)
SharedHandle safe_process_handle(process_handle, ::CloseHandle);
- HANDLE job_handle = ::CreateJobObject(NULL, alpha_pid.get().c_str());
+ HANDLE job_handle = ::CreateJobObject(nullptr, alpha_pid.get().c_str());
- if (job_handle == NULL) {
+ if (job_handle == nullptr) {
return WindowsError("os::create_job: Call to `CreateJobObject` failed");
}
@@ -732,7 +732,7 @@ inline Try<Nothing> kill_job(pid_t pid)
FALSE,
alpha_pid.get().c_str());
- if (job_handle == NULL) {
+ if (job_handle == nullptr) {
return WindowsError("os::kill_job: Call to `OpenJobObject` failed");
}
@@ -774,7 +774,7 @@ inline Try<Nothing> pipe(int pipe[2])
SECURITY_ATTRIBUTES securityAttr;
securityAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
securityAttr.bInheritHandle = TRUE;
- securityAttr.lpSecurityDescriptor = NULL;
+ securityAttr.lpSecurityDescriptor = nullptr;
HANDLE read_handle;
HANDLE write_handle;
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/tests/flags_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/flags_tests.cpp b/3rdparty/stout/tests/flags_tests.cpp
index d491d09..77f3a6a 100644
--- a/3rdparty/stout/tests/flags_tests.cpp
+++ b/3rdparty/stout/tests/flags_tests.cpp
@@ -386,7 +386,7 @@ TEST(FlagsTest, LoadFromCommandLineAndUpdateArgcArgv)
EXPECT_STREQ("--no-name4", argv[4]);
EXPECT_STREQ("--name5", argv[5]);
EXPECT_STREQ("the", argv[6]);
- EXPECT_EQ(NULL, argv[7]);
+ EXPECT_EQ(nullptr, argv[7]);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/tests/os/filesystem_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/os/filesystem_tests.cpp b/3rdparty/stout/tests/os/filesystem_tests.cpp
index 2e21538..b747c16 100644
--- a/3rdparty/stout/tests/os/filesystem_tests.cpp
+++ b/3rdparty/stout/tests/os/filesystem_tests.cpp
@@ -389,10 +389,10 @@ TEST_F(FsTest, Close)
testfile.c_str(),
FILE_APPEND_DATA,
0, // No sharing mode.
- NULL, // Default security.
+ nullptr, // Default security.
OPEN_EXISTING, // Open only if it exists.
FILE_ATTRIBUTE_NORMAL, // Open a normal file.
- NULL); // No attribute tempate file.
+ nullptr); // No attribute tempate file.
ASSERT_NE(INVALID_HANDLE_VALUE, open_valid_handle);
DWORD bytes_written;
@@ -401,7 +401,7 @@ TEST_F(FsTest, Close)
test_message1.c_str(), // Data to write.
test_message1.size(), // Bytes to write.
&bytes_written, // Bytes written.
- NULL); // No overlapped I/O.
+ nullptr); // No overlapped I/O.
ASSERT_TRUE(written);
ASSERT_EQ(test_message1.size(), bytes_written);
@@ -412,7 +412,7 @@ TEST_F(FsTest, Close)
error_message.c_str(), // Data to write.
error_message.size(), // Bytes to write.
&bytes_written, // Bytes written.
- NULL); // No overlapped I/O.
+ nullptr); // No overlapped I/O.
ASSERT_FALSE(written);
ASSERT_EQ(0, bytes_written);
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/tests/os/process_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/os/process_tests.cpp b/3rdparty/stout/tests/os/process_tests.cpp
index c945923..b536e66 100644
--- a/3rdparty/stout/tests/os/process_tests.cpp
+++ b/3rdparty/stout/tests/os/process_tests.cpp
@@ -217,14 +217,14 @@ TEST_F(ProcessTest, Pstree)
// Create new process that "sleeps".
BOOL created = CreateProcess(
- NULL, // No module name (use command line).
+ nullptr, // No module name (use command line).
(LPSTR)command.c_str(),
- NULL, // Process handle not inheritable.
- NULL, // Thread handle not inheritable.
+ nullptr, // Process handle not inheritable.
+ nullptr, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
- NULL, // Use parent's environment block.
- NULL, // Use parent's starting directory.
+ nullptr, // Use parent's environment block.
+ nullptr, // Use parent's starting directory.
&si,
&pi);
ASSERT_TRUE(created);
@@ -281,6 +281,6 @@ TEST_F(ProcessTest, Pstree)
EXPECT_EQ(0, kill(child, SIGKILL));
// We have to reap the child for running the tests in repetition.
- ASSERT_EQ(child, waitpid(child, NULL, 0));
+ ASSERT_EQ(child, waitpid(child, nullptr, 0));
}
#endif // __WINDOWS__
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/tests/os/strerror_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/os/strerror_tests.cpp b/3rdparty/stout/tests/os/strerror_tests.cpp
index 9846682..f69a4d3 100644
--- a/3rdparty/stout/tests/os/strerror_tests.cpp
+++ b/3rdparty/stout/tests/os/strerror_tests.cpp
@@ -30,12 +30,12 @@ const string errorMessage(int err)
::FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
+ nullptr,
err,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
buffer,
sizeof(buffer),
- NULL);
+ nullptr);
return buffer;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/f54fc5f0/3rdparty/stout/tests/os_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/os_tests.cpp b/3rdparty/stout/tests/os_tests.cpp
index 9271763..af1a76c 100644
--- a/3rdparty/stout/tests/os_tests.cpp
+++ b/3rdparty/stout/tests/os_tests.cpp
@@ -88,7 +88,7 @@ TEST_F(OsTest, Environment)
hashmap<string, string> environment = os::environment();
- for (size_t index = 0; environ[index] != NULL; index++) {
+ for (size_t index = 0; environ[index] != nullptr; index++) {
string entry(environ[index]);
size_t position = entry.find_first_of('=');
if (position == string::npos) {
@@ -209,7 +209,7 @@ TEST_F(OsTest, BootId)
ASSERT_SOME(numified);
timeval time;
- gettimeofday(&time, NULL);
+ gettimeofday(&time, nullptr);
EXPECT_GT(Seconds(numified.get()), Seconds(0));
EXPECT_LT(Seconds(numified.get()), Seconds(time.tv_sec));
#endif
@@ -272,7 +272,7 @@ TEST_F(OsTest, Sysctl)
ASSERT_SOME(bootTime);
timeval time;
- gettimeofday(&time, NULL);
+ gettimeofday(&time, nullptr);
EXPECT_GT(Seconds(bootTime.get().tv_sec), Seconds(0));
EXPECT_LT(Seconds(bootTime.get().tv_sec), Seconds(time.tv_sec));
@@ -326,7 +326,7 @@ TEST_F(OsTest, Children)
EXPECT_EQ(0, kill(child, SIGKILL));
// We have to reap the child for running the tests in repetition.
- ASSERT_EQ(child, waitpid(child, NULL, 0));
+ ASSERT_EQ(child, waitpid(child, nullptr, 0));
}
@@ -457,7 +457,7 @@ TEST_F(OsTest, Killtree)
EXPECT_TRUE(os::process(child).get().zombie);
// We have to reap the child for running the tests in repetition.
- ASSERT_EQ(child, waitpid(child, NULL, 0));
+ ASSERT_EQ(child, waitpid(child, nullptr, 0));
}
@@ -519,7 +519,7 @@ TEST_F(OsTest, KilltreeNoRoot)
// Ensure we reap our child now.
EXPECT_SOME(os::process(child));
EXPECT_TRUE(os::process(child).get().zombie);
- ASSERT_EQ(child, waitpid(child, NULL, 0));
+ ASSERT_EQ(child, waitpid(child, nullptr, 0));
// Check the grandchild and great grandchild are still running.
ASSERT_TRUE(os::exists(grandchild));