зеркало из https://github.com/mozilla/gecko-dev.git
Bug 390671 - Finish adding same-linelist iterator comparison assertions, and remove the useless NS_LINELIST_DEBUG_PASS_END #define that's defined only #ifdef DEBUG. rs+a=dbaron
This commit is contained in:
Родитель
6677a3f3be
Коммит
fd898a1065
|
@ -533,12 +533,6 @@ protected:
|
|||
void MaybeFreeData();
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
#define NS_LINELIST_DEBUG_PASS_END
|
||||
#else
|
||||
#undef NS_LINELIST_DEBUG_PASS_END
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A linked list type where the items in the list must inherit from
|
||||
* a link type to fuse allocations.
|
||||
|
@ -607,58 +601,44 @@ class nsLineList_iterator {
|
|||
|
||||
reference operator*()
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return *static_cast<pointer>(mCurrent);
|
||||
}
|
||||
|
||||
pointer operator->()
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<pointer>(mCurrent);
|
||||
}
|
||||
|
||||
pointer get()
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<pointer>(mCurrent);
|
||||
}
|
||||
|
||||
operator pointer()
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<pointer>(mCurrent);
|
||||
}
|
||||
|
||||
const_reference operator*() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return *static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
|
||||
const_pointer operator->() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
|
||||
#ifndef __MWERKS__
|
||||
operator const_pointer() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
#endif /* !__MWERKS__ */
|
||||
|
@ -691,36 +671,28 @@ class nsLineList_iterator {
|
|||
// to keep AIX happy.
|
||||
PRBool operator==(const iterator_self_type aOther) const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
#endif
|
||||
return mCurrent == aOther.mCurrent;
|
||||
}
|
||||
PRBool operator!=(const iterator_self_type aOther) const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
#endif
|
||||
return mCurrent != aOther.mCurrent;
|
||||
}
|
||||
PRBool operator==(const iterator_self_type aOther)
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
#endif
|
||||
return mCurrent == aOther.mCurrent;
|
||||
}
|
||||
PRBool operator!=(const iterator_self_type aOther)
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
#endif
|
||||
return mCurrent != aOther.mCurrent;
|
||||
}
|
||||
|
||||
private:
|
||||
link_type *mCurrent;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
link_type *mListLink; // the list's link, i.e., the end
|
||||
#endif
|
||||
};
|
||||
|
@ -788,58 +760,44 @@ class nsLineList_reverse_iterator {
|
|||
|
||||
reference operator*()
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return *static_cast<pointer>(mCurrent);
|
||||
}
|
||||
|
||||
pointer operator->()
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<pointer>(mCurrent);
|
||||
}
|
||||
|
||||
pointer get()
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<pointer>(mCurrent);
|
||||
}
|
||||
|
||||
operator pointer()
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<pointer>(mCurrent);
|
||||
}
|
||||
|
||||
const_reference operator*() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return *static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
|
||||
const_pointer operator->() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
|
||||
#ifndef __MWERKS__
|
||||
operator const_pointer() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
#endif /* !__MWERKS__ */
|
||||
|
@ -847,17 +805,29 @@ class nsLineList_reverse_iterator {
|
|||
// Passing by value rather than by reference and reference to const
|
||||
// to keep AIX happy.
|
||||
PRBool operator==(const iterator_self_type aOther) const
|
||||
{ return mCurrent == aOther.mCurrent; }
|
||||
{
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
return mCurrent == aOther.mCurrent;
|
||||
}
|
||||
PRBool operator!=(const iterator_self_type aOther) const
|
||||
{ return mCurrent != aOther.mCurrent; }
|
||||
{
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
return mCurrent != aOther.mCurrent;
|
||||
}
|
||||
PRBool operator==(const iterator_self_type aOther)
|
||||
{ return mCurrent == aOther.mCurrent; }
|
||||
{
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
return mCurrent == aOther.mCurrent;
|
||||
}
|
||||
PRBool operator!=(const iterator_self_type aOther)
|
||||
{ return mCurrent != aOther.mCurrent; }
|
||||
{
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
return mCurrent != aOther.mCurrent;
|
||||
}
|
||||
|
||||
private:
|
||||
link_type *mCurrent;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
link_type *mListLink; // the list's link, i.e., the end
|
||||
#endif
|
||||
};
|
||||
|
@ -886,7 +856,7 @@ class nsLineList_const_iterator {
|
|||
|
||||
typedef nsLineLink link_type;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
#ifdef DEBUG
|
||||
nsLineList_const_iterator() { memset(&mCurrent, 0xcd, sizeof(mCurrent)); }
|
||||
#else
|
||||
// Auto generated default constructor OK.
|
||||
|
@ -930,34 +900,26 @@ class nsLineList_const_iterator {
|
|||
|
||||
const_reference operator*() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return *static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
|
||||
const_pointer operator->() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
|
||||
const_pointer get() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
|
||||
#ifndef __MWERKS__
|
||||
operator const_pointer() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
#endif /* !__MWERKS__ */
|
||||
|
@ -977,17 +939,29 @@ class nsLineList_const_iterator {
|
|||
// Passing by value rather than by reference and reference to const
|
||||
// to keep AIX happy.
|
||||
PRBool operator==(const iterator_self_type aOther) const
|
||||
{ return mCurrent == aOther.mCurrent; }
|
||||
{
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
return mCurrent == aOther.mCurrent;
|
||||
}
|
||||
PRBool operator!=(const iterator_self_type aOther) const
|
||||
{ return mCurrent != aOther.mCurrent; }
|
||||
{
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
return mCurrent != aOther.mCurrent;
|
||||
}
|
||||
PRBool operator==(const iterator_self_type aOther)
|
||||
{ return mCurrent == aOther.mCurrent; }
|
||||
{
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
return mCurrent == aOther.mCurrent;
|
||||
}
|
||||
PRBool operator!=(const iterator_self_type aOther)
|
||||
{ return mCurrent != aOther.mCurrent; }
|
||||
{
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
return mCurrent != aOther.mCurrent;
|
||||
}
|
||||
|
||||
private:
|
||||
const link_type *mCurrent;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
const link_type *mListLink; // the list's link, i.e., the end
|
||||
#endif
|
||||
};
|
||||
|
@ -1016,7 +990,7 @@ class nsLineList_const_reverse_iterator {
|
|||
|
||||
typedef nsLineLink link_type;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
#ifdef DEBUG
|
||||
nsLineList_const_reverse_iterator() { memset(&mCurrent, 0xcd, sizeof(mCurrent)); }
|
||||
#else
|
||||
// Auto generated default constructor OK.
|
||||
|
@ -1060,34 +1034,26 @@ class nsLineList_const_reverse_iterator {
|
|||
|
||||
const_reference operator*() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return *static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
|
||||
const_pointer operator->() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
|
||||
const_pointer get() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
|
||||
#ifndef __MWERKS__
|
||||
operator const_pointer() const
|
||||
{
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
NS_ASSERTION(mCurrent != mListLink, "running past end");
|
||||
#endif
|
||||
return static_cast<const_pointer>(mCurrent);
|
||||
}
|
||||
#endif /* !__MWERKS__ */
|
||||
|
@ -1095,17 +1061,29 @@ class nsLineList_const_reverse_iterator {
|
|||
// Passing by value rather than by reference and reference to const
|
||||
// to keep AIX happy.
|
||||
PRBool operator==(const iterator_self_type aOther) const
|
||||
{ return mCurrent == aOther.mCurrent; }
|
||||
{
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
return mCurrent == aOther.mCurrent;
|
||||
}
|
||||
PRBool operator!=(const iterator_self_type aOther) const
|
||||
{ return mCurrent != aOther.mCurrent; }
|
||||
{
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
return mCurrent != aOther.mCurrent;
|
||||
}
|
||||
PRBool operator==(const iterator_self_type aOther)
|
||||
{ return mCurrent == aOther.mCurrent; }
|
||||
{
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
return mCurrent == aOther.mCurrent;
|
||||
}
|
||||
PRBool operator!=(const iterator_self_type aOther)
|
||||
{ return mCurrent != aOther.mCurrent; }
|
||||
{
|
||||
NS_ASSERTION(mListLink == aOther.mListLink, "comparing iterators over different lists");
|
||||
return mCurrent != aOther.mCurrent;
|
||||
}
|
||||
|
||||
//private:
|
||||
const link_type *mCurrent;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
const link_type *mListLink; // the list's link, i.e., the end
|
||||
#endif
|
||||
};
|
||||
|
@ -1150,7 +1128,7 @@ class nsLineList {
|
|||
{
|
||||
const_iterator rv;
|
||||
rv.mCurrent = mLink._mNext;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
rv.mListLink = &mLink;
|
||||
#endif
|
||||
return rv;
|
||||
|
@ -1160,7 +1138,7 @@ class nsLineList {
|
|||
{
|
||||
iterator rv;
|
||||
rv.mCurrent = mLink._mNext;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
rv.mListLink = &mLink;
|
||||
#endif
|
||||
return rv;
|
||||
|
@ -1170,7 +1148,7 @@ class nsLineList {
|
|||
{
|
||||
iterator rv;
|
||||
rv.mCurrent = aLine;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
rv.mListLink = &mLink;
|
||||
#endif
|
||||
return rv;
|
||||
|
@ -1180,7 +1158,7 @@ class nsLineList {
|
|||
{
|
||||
const_iterator rv;
|
||||
rv.mCurrent = &mLink;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
rv.mListLink = &mLink;
|
||||
#endif
|
||||
return rv;
|
||||
|
@ -1190,7 +1168,7 @@ class nsLineList {
|
|||
{
|
||||
iterator rv;
|
||||
rv.mCurrent = &mLink;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
rv.mListLink = &mLink;
|
||||
#endif
|
||||
return rv;
|
||||
|
@ -1200,7 +1178,7 @@ class nsLineList {
|
|||
{
|
||||
const_reverse_iterator rv;
|
||||
rv.mCurrent = mLink._mPrev;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
rv.mListLink = &mLink;
|
||||
#endif
|
||||
return rv;
|
||||
|
@ -1210,7 +1188,7 @@ class nsLineList {
|
|||
{
|
||||
reverse_iterator rv;
|
||||
rv.mCurrent = mLink._mPrev;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
rv.mListLink = &mLink;
|
||||
#endif
|
||||
return rv;
|
||||
|
@ -1220,7 +1198,7 @@ class nsLineList {
|
|||
{
|
||||
const_reverse_iterator rv;
|
||||
rv.mCurrent = &mLink;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
rv.mListLink = &mLink;
|
||||
#endif
|
||||
return rv;
|
||||
|
@ -1230,7 +1208,7 @@ class nsLineList {
|
|||
{
|
||||
reverse_iterator rv;
|
||||
rv.mCurrent = &mLink;
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
rv.mListLink = &mLink;
|
||||
#endif
|
||||
return rv;
|
||||
|
@ -1425,7 +1403,7 @@ class nsLineList {
|
|||
// Many of these implementations of operator= don't work yet. I don't
|
||||
// know why.
|
||||
|
||||
#ifdef NS_LINELIST_DEBUG_PASS_END
|
||||
#ifdef DEBUG
|
||||
|
||||
// NOTE: ASSIGN_FROM is meant to be used *only* as the entire body
|
||||
// of a function and therefore lacks PR_{BEGIN,END}_MACRO
|
||||
|
|
Загрузка…
Ссылка в новой задаче