Bug 441608 - Make nsAssignment members const and get rid of the unnecessary empty constructor and copy-assignment operators, r=Enn

This commit is contained in:
Benjamin Smedberg 2008-07-15 07:06:54 -04:00
Родитель 4e0c489194
Коммит bb1dcf45c0
2 изменённых файлов: 4 добавлений и 12 удалений

Просмотреть файл

@ -139,11 +139,10 @@ nsAssignmentSet::Add(const nsAssignment& aAssignment)
if (HasAssignmentFor(aAssignment.mVariable))
return NS_ERROR_UNEXPECTED;
List* list = new List;
List* list = new List(aAssignment);
if (! list)
return NS_ERROR_OUT_OF_MEMORY;
list->mAssignment = aAssignment;
list->mRefCnt = 1;
list->mNext = mAssignments;

Просмотреть файл

@ -227,12 +227,9 @@ public:
*/
class nsAssignment {
public:
nsCOMPtr<nsIAtom> mVariable;
const nsCOMPtr<nsIAtom> mVariable;
nsCOMPtr<nsIRDFNode> mValue;
nsAssignment() : mValue()
{ MOZ_COUNT_CTOR(nsAssignment); }
nsAssignment(nsIAtom* aVariable, nsIRDFNode* aValue)
: mVariable(aVariable),
mValue(aValue)
@ -245,11 +242,6 @@ public:
~nsAssignment() { MOZ_COUNT_DTOR(nsAssignment); }
nsAssignment& operator=(const nsAssignment& aAssignment) {
mVariable = aAssignment.mVariable;
mValue = aAssignment.mValue;
return *this; }
PRBool operator==(const nsAssignment& aAssignment) const {
return mVariable == aAssignment.mVariable && mValue == aAssignment.mValue; }
@ -277,7 +269,8 @@ public:
protected:
class List {
public:
List() { MOZ_COUNT_CTOR(nsAssignmentSet::List); }
List(const nsAssignment &aAssignment) : mAssignment(aAssignment) {
MOZ_COUNT_CTOR(nsAssignmentSet::List); }
~List() {
MOZ_COUNT_DTOR(nsAssignmentSet::List);