Skip to content

Commit

Permalink
[Core] Use nullptr instead of NULL (#47563)
Browse files Browse the repository at this point in the history
Signed-off-by: dentiny <dentinyhao@gmail.com>
  • Loading branch information
dentiny committed Sep 18, 2024
1 parent 578d040 commit cfe32c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/ray/common/status.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void Status::CopyFrom(const State *state) {
}

std::string Status::CodeAsString() const {
if (state_ == NULL) {
if (state_ == nullptr) {
return STATUS_CODE_OK;
}

Expand All @@ -160,7 +160,7 @@ StatusCode Status::StringToCode(const std::string &str) {

std::string Status::ToString() const {
std::string result(CodeAsString());
if (state_ == NULL) {
if (state_ == nullptr) {
return result;
}
result += ": ";
Expand Down
8 changes: 4 additions & 4 deletions src/ray/common/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class RAY_MUST_USE_RESULT RAY_EXPORT Status;
class RAY_EXPORT Status {
public:
// Create a success status.
Status() : state_(NULL) {}
Status() : state_(nullptr) {}
~Status() { delete state_; }

Status(StatusCode code, const std::string &msg, int rpc_code = -1);
Expand Down Expand Up @@ -265,7 +265,7 @@ class RAY_EXPORT Status {
static StatusCode StringToCode(const std::string &str);

// Returns true iff the status indicates success.
bool ok() const { return (state_ == NULL); }
bool ok() const { return (state_ == nullptr); }

bool IsOutOfMemory() const { return code() == StatusCode::OutOfMemory; }
bool IsOutOfDisk() const { return code() == StatusCode::OutOfDisk; }
Expand Down Expand Up @@ -337,7 +337,7 @@ class RAY_EXPORT Status {
// If code is RpcError, this contains the RPC error code
int rpc_code;
};
// OK status has a `NULL` state_. Otherwise, `state_` points to
// OK status has a `nullptr` state_. Otherwise, `state_` points to
// a `State` structure containing the error code and message(s)
State *state_;

Expand All @@ -350,7 +350,7 @@ static inline std::ostream &operator<<(std::ostream &os, const Status &x) {
}

inline Status::Status(const Status &s)
: state_((s.state_ == NULL) ? NULL : new State(*s.state_)) {}
: state_((s.state_ == nullptr) ? nullptr : new State(*s.state_)) {}

inline void Status::operator=(const Status &s) {
// The following condition catches both aliasing (when this == &s),
Expand Down

0 comments on commit cfe32c0

Please sign in to comment.