summaryrefslogtreecommitdiffstats
path: root/googletest/samples/sample2.h
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-10-04 22:28:05 (GMT)
committerGennadiy Civil <misterg@google.com>2018-10-05 16:54:14 (GMT)
commit4bb49ed640e34e23187ad7ea689693ef9927033f (patch)
tree31bfca77d3e46134fddebe28118bcba3af711e45 /googletest/samples/sample2.h
parentf13bbe2992d188e834339abe6f715b2b2f840a77 (diff)
downloadgoogletest-4bb49ed640e34e23187ad7ea689693ef9927033f.zip
googletest-4bb49ed640e34e23187ad7ea689693ef9927033f.tar.gz
googletest-4bb49ed640e34e23187ad7ea689693ef9927033f.tar.bz2
Apply clang-tidy modernize-use-nullptr to googletest.
Now that googletest has moved to C++11, it should no longer use NULL or 0 for the null pointer. This patch converts all such usages to nullptr using clang-tidy. This prevents LLVM from issuing -Wzero-as-null-pointer-constant warnings. PiperOrigin-RevId: 215814400
Diffstat (limited to 'googletest/samples/sample2.h')
-rw-r--r--googletest/samples/sample2.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/googletest/samples/sample2.h b/googletest/samples/sample2.h
index 58f360f..e9a5a70 100644
--- a/googletest/samples/sample2.h
+++ b/googletest/samples/sample2.h
@@ -50,15 +50,15 @@ class MyString {
// C'tors
// The default c'tor constructs a NULL string.
- MyString() : c_string_(NULL) {}
+ MyString() : c_string_(nullptr) {}
// Constructs a MyString by cloning a 0-terminated C string.
- explicit MyString(const char* a_c_string) : c_string_(NULL) {
+ explicit MyString(const char* a_c_string) : c_string_(nullptr) {
Set(a_c_string);
}
// Copy c'tor
- MyString(const MyString& string) : c_string_(NULL) {
+ MyString(const MyString& string) : c_string_(nullptr) {
Set(string.c_string_);
}
@@ -71,9 +71,7 @@ class MyString {
// Gets the 0-terminated C string this MyString object represents.
const char* c_string() const { return c_string_; }
- size_t Length() const {
- return c_string_ == NULL ? 0 : strlen(c_string_);
- }
+ size_t Length() const { return c_string_ == nullptr ? 0 : strlen(c_string_); }
// Sets the 0-terminated C string this MyString object represents.
void Set(const char* c_string);