(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
This commit is contained in:
@@ -23,7 +23,7 @@ struct CFixedSizeArrayT {
|
||||
int m_ref_cnt; ///< block reference counter (used by copy constructor and by destructor)
|
||||
};
|
||||
|
||||
// make types and constants visible from outside
|
||||
/* make types and constants visible from outside */
|
||||
typedef Titem_ Titem; // type of array item
|
||||
|
||||
static const int Tcapacity = Tcapacity_; // the array capacity (maximum size)
|
||||
@@ -33,7 +33,7 @@ struct CFixedSizeArrayT {
|
||||
/** Default constructor. Preallocate space for items and header, then initialize header. */
|
||||
CFixedSizeArrayT()
|
||||
{
|
||||
// allocate block for header + items (don't construct items)
|
||||
/* allocate block for header + items (don't construct items) */
|
||||
m_items = (Titem*)((MallocT<int8>(ThdrSize + Tcapacity * sizeof(Titem))) + ThdrSize);
|
||||
SizeRef() = 0; // initial number of items
|
||||
RefCnt() = 1; // initial reference counter
|
||||
@@ -42,7 +42,7 @@ struct CFixedSizeArrayT {
|
||||
/** Copy constructor. Preallocate space for items and header, then initialize header. */
|
||||
CFixedSizeArrayT(const CFixedSizeArrayT<Titem_, Tcapacity_>& src)
|
||||
{
|
||||
// share block (header + items) with the source array
|
||||
/* share block (header + items) with the source array */
|
||||
m_items = src.m_items;
|
||||
RefCnt()++; // now we share block with the source
|
||||
}
|
||||
@@ -50,11 +50,11 @@ struct CFixedSizeArrayT {
|
||||
/** destroy remaining items and free the memory block */
|
||||
~CFixedSizeArrayT()
|
||||
{
|
||||
// release one reference to the shared block
|
||||
/* release one reference to the shared block */
|
||||
if ((--RefCnt()) > 0) return; // and return if there is still some owner
|
||||
|
||||
Clear();
|
||||
// free the memory block occupied by items
|
||||
/* free the memory block occupied by items */
|
||||
free(((int8*)m_items) - ThdrSize);
|
||||
m_items = NULL;
|
||||
}
|
||||
@@ -62,11 +62,11 @@ struct CFixedSizeArrayT {
|
||||
/** Clear (destroy) all items */
|
||||
FORCEINLINE void Clear()
|
||||
{
|
||||
// walk through all allocated items backward and destroy them
|
||||
/* walk through all allocated items backward and destroy them */
|
||||
for (Titem *pItem = &m_items[Size() - 1]; pItem >= m_items; pItem--) {
|
||||
pItem->~Titem_();
|
||||
}
|
||||
// number of items become zero
|
||||
/* number of items become zero */
|
||||
SizeRef() = 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user