зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1308317 - Part 2: Remove nsSupportsArray::MoveElement. r=froydnj
|MoveElement| is not scriptable and unused in our codebase. MozReview-Commit-ID: CBe8WZHG1JG
This commit is contained in:
Родитель
f89a684018
Коммит
9be4258264
|
@ -63,9 +63,6 @@ interface nsISupportsArray : nsICollection {
|
|||
|
||||
nsISupportsArray clone();
|
||||
|
||||
[notxpcom] boolean MoveElement(in long aFrom,
|
||||
in long aTo);
|
||||
|
||||
[notxpcom] boolean RemoveElementsAt(in unsigned long aIndex,
|
||||
in unsigned long aCount);
|
||||
|
||||
|
|
|
@ -360,36 +360,6 @@ nsSupportsArray::RemoveLastElement(const nsISupports* aElement)
|
|||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsSupportsArray::MoveElement(int32_t aFrom, int32_t aTo)
|
||||
{
|
||||
nsISupports* tempElement;
|
||||
|
||||
if (aTo == aFrom) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (aTo < 0 || aFrom < 0 ||
|
||||
(uint32_t)aTo >= mCount || (uint32_t)aFrom >= mCount) {
|
||||
// can't extend the array when moving an element. Also catches mImpl = null
|
||||
return false;
|
||||
}
|
||||
tempElement = mArray[aFrom];
|
||||
|
||||
if (aTo < aFrom) {
|
||||
// Moving one element closer to the head; the elements inbetween move down
|
||||
::memmove(mArray + aTo + 1, mArray + aTo,
|
||||
(aFrom - aTo) * sizeof(mArray[0]));
|
||||
mArray[aTo] = tempElement;
|
||||
} else { // already handled aFrom == aTo
|
||||
// Moving one element closer to the tail; the elements inbetween move up
|
||||
::memmove(mArray + aFrom, mArray + aFrom + 1,
|
||||
(aTo - aFrom) * sizeof(mArray[0]));
|
||||
mArray[aTo] = tempElement;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSupportsArray::Clear(void)
|
||||
|
|
|
@ -56,7 +56,6 @@ public:
|
|||
}
|
||||
// XXX this is badly named - should be RemoveFirstElement
|
||||
MOZ_MUST_USE NS_IMETHOD RemoveElement(nsISupports* aElement) override;
|
||||
MOZ_MUST_USE NS_IMETHOD_(bool) MoveElement(int32_t aFrom, int32_t aTo) override;
|
||||
NS_IMETHOD Enumerate(nsIEnumerator** aResult) override;
|
||||
NS_IMETHOD Clear(void) override;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче