1 Index: squid3/src/cbdata.cc
2 diff -c squid3/src/cbdata.cc:1.59 squid3/src/cbdata.cc:1.60
3 *** squid3/src/cbdata.cc:1.59 Wed Jul 16 01:18:16 2003
4 --- squid3/src/cbdata.cc Mon Sep 1 17:41:17 2003
7 void dump(StoreEntry *)const;
16 void addHistory(char const *label, char const *file, int line)
18 void dump(StoreEntry *)const;
21 ! void *operator new(size_t size, void *where);
22 ! void operator delete(void *where, void *where);
30 void addHistory(char const *label, char const *file, int line)
34 /* cookie used while debugging */
36 /* MUST be the last per-instance member */
37 + /* TODO: examine making cbdata templated on this - so we get type
38 + * safe access to data - RBC 20030902 */
40 void check() const { assert(cookie == ((long)this ^ Cookie));}
45 const long cbdata::Cookie((long)0xDEADBEEF);
46 const long cbdata::Offset(MakeOffset());
49 + cbdata::operator new(size_t size, void *where)
51 + // assert (size == sizeof(cbdata));
56 + cbdata::operator delete(void *where, void *where2)
58 + /* Only ever invoked when placement new throws
59 + * an exception. Used to prevent an incorrect
73 ! cbdata::deleteSelf()
91 - memPoolFree(cbdata_index[type].pool, this);
100 assert(type > 0 && type < cbdata_types);
101 ! p = (cbdata *)memPoolAlloc(cbdata_index[type].pool);
108 assert(type > 0 && type < cbdata_types);
109 ! p = new (memPoolAlloc(cbdata_index[type].pool)) cbdata;
110 ! // p = (cbdata *)memPoolAlloc(cbdata_index[type].pool);
117 dlinkDelete(&c->link, &cbdataEntries);
125 dlinkDelete(&c->link, &cbdataEntries);
128 ! cbdata_type theType = c->type;
129 ! c->cbdata::~cbdata();
131 ! /* This is ugly. But: operator delete doesn't get
132 ! * the type parameter, so we can't use that
133 ! * to free the memory.
134 ! * So, we free it ourselves.
135 ! * Note that this means a non-placement
136 ! * new would be a seriously bad idea.
137 ! * Lastly, if we where a templated class,
138 ! * we could use the normal delete operator
139 ! * and it would Just Work. RBC 20030902
141 ! memPoolFree(cbdata_index[theType].pool, c);
158 ! cbdata_type theType = c->type;
160 ! c->cbdata::~cbdata();
162 ! /* This is ugly. But: operator delete doesn't get
163 ! * the type parameter, so we can't use that
164 ! * to free the memory.
165 ! * So, we free it ourselves.
166 ! * Note that this means a non-placement
167 ! * new would be a seriously bad idea.
168 ! * Lastly, if we where a templated class,
169 ! * we could use the normal delete operator
170 ! * and it would Just Work. RBC 20030902
172 ! memPoolFree(cbdata_index[theType].pool, c);