Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
diff --git a/libc/bionic/pty.cpp b/libc/bionic/pty.cpp
index 599cbd2..71e14d9 100644
--- a/libc/bionic/pty.cpp
+++ b/libc/bionic/pty.cpp
@@ -55,11 +55,11 @@
bionic_tls& tls = __get_bionic_tls();
char* buf = tls.ptsname_buf;
int error = ptsname_r(fd, buf, sizeof(tls.ptsname_buf));
- return (error == 0) ? buf : NULL;
+ return (error == 0) ? buf : nullptr;
}
int ptsname_r(int fd, char* buf, size_t len) {
- if (buf == NULL) {
+ if (buf == nullptr) {
errno = EINVAL;
return errno;
}
@@ -82,11 +82,11 @@
bionic_tls& tls = __get_bionic_tls();
char* buf = tls.ttyname_buf;
int error = ttyname_r(fd, buf, sizeof(tls.ttyname_buf));
- return (error == 0) ? buf : NULL;
+ return (error == 0) ? buf : nullptr;
}
int ttyname_r(int fd, char* buf, size_t len) {
- if (buf == NULL) {
+ if (buf == nullptr) {
errno = EINVAL;
return errno;
}
@@ -124,7 +124,7 @@
}
char buf[32];
- if (name == NULL) {
+ if (name == nullptr) {
name = buf;
}
if (ptsname_r(*master, name, sizeof(buf)) != 0) {
@@ -138,10 +138,10 @@
return -1;
}
- if (t != NULL) {
+ if (t != nullptr) {
tcsetattr(*slave, TCSAFLUSH, t);
}
- if (ws != NULL) {
+ if (ws != nullptr) {
ioctl(*slave, TIOCSWINSZ, ws);
}
@@ -181,7 +181,7 @@
int login_tty(int fd) {
setsid();
- if (ioctl(fd, TIOCSCTTY, NULL) == -1) {
+ if (ioctl(fd, TIOCSCTTY, nullptr) == -1) {
return -1;
}