]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/DiskIO/DiskDaemon/diskd.cc
Maintenance: Removed most NULLs using modernize-use-nullptr (#1075)
[thirdparty/squid.git] / src / DiskIO / DiskDaemon / diskd.cc
index ebba06b5d6dd461ace45313b7b3e7e666792d4a3..11c0a868f2cee63bd2c559971af0ea4c38955d6f 100644 (file)
@@ -45,7 +45,7 @@ struct _file_state {
     off_t offset;
 };
 
-static hash_table *hash = NULL;
+static hash_table *hash = nullptr;
 static pid_t mypid;
 static char *shmbuf;
 static int DebugLevel = 0;
@@ -91,7 +91,7 @@ do_close(diomsg * r, int)
     file_state *fs;
     fs = (file_state *) hash_lookup(hash, &r->id);
 
-    if (NULL == fs) {
+    if (nullptr == fs) {
         errno = EBADF;
         DEBUG(1) {
             fprintf(stderr, "%d CLOSE id %d: ", (int) mypid, r->id);
@@ -122,7 +122,7 @@ do_read(diomsg * r, int, char *buf)
     file_state *fs;
     fs = (file_state *) hash_lookup(hash, &r->id);
 
-    if (NULL == fs) {
+    if (nullptr == fs) {
         errno = EBADF;
         DEBUG(1) {
             fprintf(stderr, "%d READ  id %d: ", (int) mypid, r->id);
@@ -172,7 +172,7 @@ do_write(diomsg * r, int, const char *buf)
     file_state *fs;
     fs = (file_state *) hash_lookup(hash, &r->id);
 
-    if (NULL == fs) {
+    if (nullptr == fs) {
         errno = EBADF;
         DEBUG(1) {
             fprintf(stderr, "%d WRITE id %d: ", (int) mypid, r->id);
@@ -231,7 +231,7 @@ do_unlink(diomsg * r, int, const char *buf)
 static void
 msg_handle(diomsg * r, int rl, diomsg * s)
 {
-    char *buf = NULL;
+    char *buf = nullptr;
     s->mtype = r->mtype;
     s->id = r->id;
     s->seq_no = r->seq_no;      /* optional, debugging */
@@ -312,8 +312,8 @@ main(int argc, char *argv[])
     char rbuf[512];
 
     struct sigaction sa;
-    setbuf(stdout, NULL);
-    setbuf(stderr, NULL);
+    setbuf(stdout, nullptr);
+    setbuf(stderr, nullptr);
     mypid = getpid();
     assert(4 == argc);
     key = atoi(argv[1]);
@@ -340,7 +340,7 @@ main(int argc, char *argv[])
         exit(EXIT_FAILURE);
     }
 
-    shmbuf = (char *)shmat(shmid, NULL, 0);
+    shmbuf = (char *)shmat(shmid, nullptr, 0);
 
     if (shmbuf == (void *) -1) {
         perror("shmat");
@@ -356,7 +356,7 @@ main(int argc, char *argv[])
     memset(&sa, '\0', sizeof(sa));
     sa.sa_handler = alarm_handler;
     sa.sa_flags = SA_RESTART;
-    sigaction(SIGALRM, &sa, NULL);
+    sigaction(SIGALRM, &sa, nullptr);
 
     for (;;) {
         alarm(1);
@@ -401,16 +401,16 @@ main(int argc, char *argv[])
         fprintf(stderr, "%d diskd exiting\n", (int) mypid);
     }
 
-    if (msgctl(rmsgid, IPC_RMID, 0) < 0)
+    if (msgctl(rmsgid, IPC_RMID, nullptr) < 0)
         perror("msgctl IPC_RMID");
 
-    if (msgctl(smsgid, IPC_RMID, 0) < 0)
+    if (msgctl(smsgid, IPC_RMID, nullptr) < 0)
         perror("msgctl IPC_RMID");
 
     if (shmdt(shmbuf) < 0)
         perror("shmdt");
 
-    if (shmctl(shmid, IPC_RMID, 0) < 0)
+    if (shmctl(shmid, IPC_RMID, nullptr) < 0)
         perror("shmctl IPC_RMID");
 
     return EXIT_SUCCESS;