]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/mgr/StoreToCommWriter.cc
Maintenance: Removed most NULLs using modernize-use-nullptr (#1075)
[thirdparty/squid.git] / src / mgr / StoreToCommWriter.cc
index f2b043e2e55a4d2380fe5b0ee8a28bf114b18482..83e7e561bbdee23888b65b02c122b745f5d39bfd 100644 (file)
@@ -24,7 +24,7 @@ CBDATA_NAMESPACED_CLASS_INIT(Mgr, StoreToCommWriter);
 
 Mgr::StoreToCommWriter::StoreToCommWriter(const Comm::ConnectionPointer &conn, StoreEntry* anEntry):
     AsyncJob("Mgr::StoreToCommWriter"),
-    clientConnection(conn), entry(anEntry), sc(NULL), writeOffset(0), closer(NULL)
+    clientConnection(conn), entry(anEntry), sc(nullptr), writeOffset(0), closer(nullptr)
 {
     debugs(16, 6, clientConnection);
     closer = asyncCall(16, 5, "Mgr::StoreToCommWriter::noteCommClosed",
@@ -45,9 +45,9 @@ void
 Mgr::StoreToCommWriter::close()
 {
     if (Comm::IsConnOpen(clientConnection)) {
-        if (closer != NULL) {
+        if (closer != nullptr) {
             comm_remove_close_handler(clientConnection->fd, closer);
-            closer = NULL;
+            closer = nullptr;
         }
         clientConnection->close();
     }
@@ -58,11 +58,11 @@ Mgr::StoreToCommWriter::start()
 {
     debugs(16, 6, MYNAME);
     Must(Comm::IsConnOpen(clientConnection));
-    Must(entry != NULL);
+    Must(entry != nullptr);
     AsyncCall::Pointer call = asyncCall(16, 4, "StoreToCommWriter::Abort", cbdataDialer(&StoreToCommWriter::HandleStoreAbort, this));
     entry->registerAbortCallback(call);
     sc = storeClientListAdd(entry, this);
-    Must(sc != NULL);
+    Must(sc != nullptr);
 
     // initiate the receive-from-store, write-to-comm sequence
     scheduleStoreCopy();
@@ -72,8 +72,8 @@ void
 Mgr::StoreToCommWriter::scheduleStoreCopy()
 {
     debugs(16, 6, MYNAME);
-    Must(entry != NULL);
-    Must(sc != NULL);
+    Must(entry != nullptr);
+    Must(sc != nullptr);
     StoreIOBuffer readBuf(sizeof(buffer), writeOffset, buffer);
     storeClientCopy(sc, entry, readBuf, &NoteStoreCopied, this);
 }
@@ -81,7 +81,7 @@ Mgr::StoreToCommWriter::scheduleStoreCopy()
 void
 Mgr::StoreToCommWriter::NoteStoreCopied(void* data, StoreIOBuffer ioBuf)
 {
-    Must(data != NULL);
+    Must(data != nullptr);
     // make sync Store call async to get async call protections and features
     StoreToCommWriter* writer = static_cast<StoreToCommWriter*>(data);
     typedef UnaryMemFunT<StoreToCommWriter, StoreIOBuffer> MyDialer;
@@ -107,13 +107,13 @@ Mgr::StoreToCommWriter::scheduleCommWrite(const StoreIOBuffer& ioBuf)
 {
     debugs(16, 6, MYNAME);
     Must(Comm::IsConnOpen(clientConnection));
-    Must(ioBuf.data != NULL);
+    Must(ioBuf.data != nullptr);
     // write filled buffer
     typedef CommCbMemFunT<StoreToCommWriter, CommIoCbParams> MyDialer;
     AsyncCall::Pointer writer =
         asyncCall(16, 5, "Mgr::StoreToCommWriter::noteCommWrote",
                   MyDialer(this, &StoreToCommWriter::noteCommWrote));
-    Comm::Write(clientConnection, ioBuf.data, ioBuf.length, writer, NULL);
+    Comm::Write(clientConnection, ioBuf.data, ioBuf.length, writer, nullptr);
 }
 
 void
@@ -121,7 +121,7 @@ Mgr::StoreToCommWriter::noteCommWrote(const CommIoCbParams& params)
 {
     debugs(16, 6, MYNAME);
     Must(params.flag == Comm::OK);
-    Must(clientConnection != NULL && params.fd == clientConnection->fd);
+    Must(clientConnection != nullptr && params.fd == clientConnection->fd);
     Must(params.size != 0);
     writeOffset += params.size;
     if (!doneAll())
@@ -144,14 +144,14 @@ void
 Mgr::StoreToCommWriter::swanSong()
 {
     debugs(16, 6, MYNAME);
-    if (entry != NULL) {
-        if (sc != NULL) {
+    if (entry != nullptr) {
+        if (sc != nullptr) {
             storeUnregister(sc, entry, this);
-            sc = NULL;
+            sc = nullptr;
         }
         entry->unregisterAbortCallback("StoreToCommWriter done");
         entry->unlock("Mgr::StoreToCommWriter::swanSong");
-        entry = NULL;
+        entry = nullptr;
     }
     close();
 }