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)) if (HasAssignmentFor(aAssignment.mVariable))
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
List* list = new List; List* list = new List(aAssignment);
if (! list) if (! list)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
list->mAssignment = aAssignment;
list->mRefCnt = 1; list->mRefCnt = 1;
list->mNext = mAssignments; list->mNext = mAssignments;

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

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