]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/cbdata.cc
Undo trunk r13270: "Refactor Vector and Stack to STL counterparts"
[thirdparty/squid.git] / src / cbdata.cc
index ae2827bf1d10c5bee52570c19c3d955d07c47c59..a0cf24acb361b6261d81be0e810fb949d8b6702e 100644 (file)
 #include "cbdata.h"
 #include "mgr/Registration.h"
 #include "Store.h"
+#if USE_CBDATA_DEBUG
+#include "Stack.h"
+#endif
 #include "Generic.h"
 
 #include <climits>
-#if USE_CBDATA_DEBUG
-#include <algorithm>
-#include <vector>
-#endif
 
 #if WITH_VALGRIND
 #define HASHED_CBDATA 1
@@ -123,7 +122,7 @@ public:
     dlink_node link;
     const char *file;
     int line;
-    std::vector<CBDataCall*> calls; // used as a stack with random access operator
+    Stack<CBDataCall*> calls;
 #endif
 
     /* cookie used while debugging */
@@ -208,11 +207,10 @@ cbdata_hash(const void *p, unsigned int mod)
 cbdata::~cbdata()
 {
 #if USE_CBDATA_DEBUG
+    CBDataCall *aCall;
 
-    while (!calls.empty()) {
-        delete calls.back();
-        calls.pop_back();
-    }
+    while ((aCall = calls.pop()))
+        delete aCall;
 
 #endif
 
@@ -316,7 +314,7 @@ cbdataInternalAlloc(cbdata_type type)
 
     c->file = file;
     c->line = line;
-    c->calls = std::vector<CBDataCall *> ();
+    c->calls = Stack<CBDataCall *> ();
     c->addHistory("Alloc", file, line);
     dlinkAdd(c, &c->link, &cbdataEntries);
     debugs(45, 3, "cbdataAlloc: " << p << " " << file << ":" << line);
@@ -614,8 +612,8 @@ CBDATA_CLASS_INIT(generic_cbdata);
 struct CBDataCallDumper : public unary_function<CBDataCall, void> {
     CBDataCallDumper (StoreEntry *anEntry):where(anEntry) {}
 
-    void operator()(CBDataCall const &x) {
-        storeAppendPrintf(where, "%s\t%s\t%d\n", x->label, x->file, x->line);
+    void operator()(CBDataCall const &x) {
+        storeAppendPrintf(where, "%s\t%s\t%d\n", x.label, x.file, x.line);
     }
 
     StoreEntry *where;
@@ -628,7 +626,7 @@ struct CBDataHistoryDumper : public CBDataDumper {
         CBDataDumper::operator()(x);
         storeAppendPrintf(where, "\n");
         storeAppendPrintf(where, "Action\tFile\tLine\n");
-        std::for_each (x.calls.begin(), x.calls.end(), callDumper);
+        for_each (x.calls,callDumper);
         storeAppendPrintf(where, "\n");
     }