]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/dlink.cc
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / dlink.cc
index 9d52ad640e07f0f048be14ea14700310425362bc..3fee41a94e46734d7a54131ae64bf469be3545ab 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -9,40 +9,13 @@
 #include "squid.h"
 #include "dlink.h"
 
-/* dlink_node use explicit alloc()/freeOne()
- * XXX: convert to MEMPROXY_CLASS() API
- */
-#include "mem/Pool.h"
-
 dlink_list ClientActiveRequests;
 
-MemAllocator *dlink_node_pool = NULL;
-
-dlink_node *
-dlinkNodeNew()
-{
-    if (dlink_node_pool == NULL)
-        dlink_node_pool = memPoolCreate("Dlink list nodes", sizeof(dlink_node));
-
-    /* where should we call delete dlink_node_pool;dlink_node_pool = NULL; */
-    return (dlink_node *)dlink_node_pool->alloc();
-}
-
-/** The node needs to be unlinked FIRST */
-void
-dlinkNodeDelete(dlink_node * m)
-{
-    if (m == NULL)
-        return;
-
-    dlink_node_pool->freeOne(m);
-}
-
 void
 dlinkAdd(void *data, dlink_node * m, dlink_list * list)
 {
     m->data = data;
-    m->prev = NULL;
+    m->prev = nullptr;
     m->next = list->head;
 
     if (list->head)
@@ -50,7 +23,7 @@ dlinkAdd(void *data, dlink_node * m, dlink_list * list)
 
     list->head = m;
 
-    if (list->tail == NULL)
+    if (list->tail == nullptr)
         list->tail = m;
 }
 
@@ -75,7 +48,7 @@ void
 dlinkAddTail(void *data, dlink_node * m, dlink_list * list)
 {
     m->data = data;
-    m->next = NULL;
+    m->next = nullptr;
     m->prev = list->tail;
 
     if (list->tail)
@@ -83,7 +56,7 @@ dlinkAddTail(void *data, dlink_node * m, dlink_list * list)
 
     list->tail = m;
 
-    if (list->head == NULL)
+    if (list->head == nullptr)
         list->head = m;
 }
 
@@ -102,6 +75,6 @@ dlinkDelete(dlink_node * m, dlink_list * list)
     if (m == list->tail)
         list->tail = m->prev;
 
-    m->next = m->prev = NULL;
+    m->next = m->prev = nullptr;
 }