[adb] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: Ia8c4deacafed2f3b7dbc3d4c3c77c6c632e3de81
diff --git a/adb/sockets.cpp b/adb/sockets.cpp
index de3215d..69b5180 100644
--- a/adb/sockets.cpp
+++ b/adb/sockets.cpp
@@ -337,7 +337,7 @@
s->fd = fd;
s->enqueue = local_socket_enqueue;
s->ready = local_socket_ready;
- s->shutdown = NULL;
+ s->shutdown = nullptr;
s->close = local_socket_close;
install_local_socket(s);
@@ -383,7 +383,7 @@
s = host_service_to_socket(name, serial, transport_id);
- if (s != NULL) {
+ if (s != nullptr) {
D("LS(%d) bound to '%s'", s->id, name);
return s;
}
@@ -435,7 +435,7 @@
static void remote_socket_close(asocket* s) {
if (s->peer) {
- s->peer->peer = 0;
+ s->peer->peer = nullptr;
D("RS(%d) peer->close()ing peer->id=%d peer->fd=%d", s->id, s->peer->id, s->peer->fd);
s->peer->close(s->peer);
}
@@ -488,7 +488,7 @@
send the go-ahead message when they connect */
static void local_socket_ready_notify(asocket* s) {
s->ready = local_socket_ready;
- s->shutdown = NULL;
+ s->shutdown = nullptr;
s->close = local_socket_close;
SendOkay(s->fd);
s->ready(s);
@@ -499,7 +499,7 @@
connected (to avoid closing them without a status message) */
static void local_socket_close_notify(asocket* s) {
s->ready = local_socket_ready;
- s->shutdown = NULL;
+ s->shutdown = nullptr;
s->close = local_socket_close;
SendFail(s->fd, "closed");
s->close(s);
@@ -706,7 +706,7 @@
** and tear down here.
*/
s2 = create_host_service_socket(service, serial, transport_id);
- if (s2 == 0) {
+ if (s2 == nullptr) {
D("SS(%d): couldn't create host service '%s'", s->id, service);
SendFail(s->peer->fd, "unknown host service");
goto fail;
@@ -726,7 +726,7 @@
s->peer->close = local_socket_close;
s->peer->peer = s2;
s2->peer = s->peer;
- s->peer = 0;
+ s->peer = nullptr;
D("SS(%d): okay", s->id);
s->close(s);
@@ -764,12 +764,12 @@
s->peer->ready = local_socket_ready_notify;
s->peer->shutdown = nullptr;
s->peer->close = local_socket_close_notify;
- s->peer->peer = 0;
+ s->peer->peer = nullptr;
/* give him our transport and upref it */
s->peer->transport = s->transport;
connect_to_remote(s->peer, s->smart_socket_data.data() + 4);
- s->peer = 0;
+ s->peer = nullptr;
s->close(s);
return 1;
@@ -789,9 +789,9 @@
static void smart_socket_close(asocket* s) {
D("SS(%d): closed", s->id);
if (s->peer) {
- s->peer->peer = 0;
+ s->peer->peer = nullptr;
s->peer->close(s->peer);
- s->peer = 0;
+ s->peer = nullptr;
}
delete s;
}
@@ -801,7 +801,7 @@
asocket* s = new asocket();
s->enqueue = smart_socket_enqueue;
s->ready = smart_socket_ready;
- s->shutdown = NULL;
+ s->shutdown = nullptr;
s->close = smart_socket_close;
D("SS(%d)", s->id);