(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
This commit is contained in:
@@ -250,19 +250,19 @@ public:
|
||||
{
|
||||
bsize_t old_max_size = MaxRawSize();
|
||||
if (old_max_size >= new_size) return;
|
||||
// calculate minimum block size we need to allocate
|
||||
/* calculate minimum block size we need to allocate */
|
||||
bsize_t min_alloc_size = sizeof(CHdr) + new_size + Ttail_reserve;
|
||||
// ask allocation policy for some reasonable block size
|
||||
/* ask allocation policy for some reasonable block size */
|
||||
bsize_t alloc_size = AllocPolicy(min_alloc_size);
|
||||
// allocate new block
|
||||
/* allocate new block */
|
||||
CHdr *pNewHdr = RawAlloc(alloc_size);
|
||||
// setup header
|
||||
/* setup header */
|
||||
pNewHdr->m_size = RawSize();
|
||||
pNewHdr->m_max_size = alloc_size - (sizeof(CHdr) + Ttail_reserve);
|
||||
// copy existing data
|
||||
/* copy existing data */
|
||||
if (RawSize() > 0)
|
||||
memcpy(pNewHdr + 1, ptr_u.m_pData, pNewHdr->m_size);
|
||||
// replace our block with new one
|
||||
/* replace our block with new one */
|
||||
CHdr *pOldHdr = &Hdr();
|
||||
Init(pNewHdr);
|
||||
if (old_max_size > 0)
|
||||
@@ -320,7 +320,7 @@ public:
|
||||
* 4. Dynamically constructs only used items (as opposite of static array which constructs all items) */
|
||||
template <class Titem_, class Tbase_ = CBlobBaseSimple>
|
||||
class CBlobT : public Tbase_ {
|
||||
// make template arguments public:
|
||||
/* make template arguments public: */
|
||||
public:
|
||||
typedef Titem_ Titem;
|
||||
typedef Tbase_ Tbase;
|
||||
@@ -418,7 +418,7 @@ public:
|
||||
assert((Tbase::RawSize() % Titem_size) == 0);
|
||||
bsize_t old_size = Size();
|
||||
if (old_size > 0) {
|
||||
// destroy removed items;
|
||||
/* destroy removed items; */
|
||||
Titem *pI_last_to_destroy = Data(0);
|
||||
for (Titem *pI = Data(old_size - 1); pI >= pI_last_to_destroy; pI--) pI->~Titem_();
|
||||
}
|
||||
@@ -445,10 +445,10 @@ public:
|
||||
bsize_t old_size = Size();
|
||||
assert(num_items <= old_size);
|
||||
bsize_t new_size = (num_items <= old_size) ? (old_size - num_items) : 0;
|
||||
// destroy removed items;
|
||||
/* destroy removed items; */
|
||||
Titem *pI_last_to_destroy = Data(new_size);
|
||||
for (Titem *pI = Data(old_size - 1); pI >= pI_last_to_destroy; pI--) pI->~Titem();
|
||||
// remove them
|
||||
/* remove them */
|
||||
Tbase::ReduceRawSize(num_items * Titem_size);
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ public:
|
||||
FORCEINLINE void RemoveBySwap(bsize_t idx)
|
||||
{
|
||||
CheckIdx(idx);
|
||||
// destroy removed item
|
||||
/* destroy removed item */
|
||||
Titem *pRemoved = Data(idx);
|
||||
RemoveBySwap(pRemoved);
|
||||
}
|
||||
@@ -492,14 +492,14 @@ public:
|
||||
{
|
||||
Titem *pLast = Data(Size() - 1);
|
||||
assert(pItem >= Data() && pItem <= pLast);
|
||||
// move last item to its new place
|
||||
/* move last item to its new place */
|
||||
if (pItem != pLast) {
|
||||
pItem->~Titem_();
|
||||
new (pItem) Titem_(*pLast);
|
||||
}
|
||||
// destroy the last item
|
||||
/* destroy the last item */
|
||||
pLast->~Titem_();
|
||||
// and reduce the raw blob size
|
||||
/* and reduce the raw blob size */
|
||||
Tbase::ReduceRawSize(Titem_size);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user