Bug 751416 - Remove unused txList[Iterator] methods. r=sicking
authorEhren Metcalfe <ehren.m@gmail.com>
Thu, 03 May 2012 18:33:51 -0400
changeset 93050 d6c77d2796c0d1e73efd5ae5afaecfc226aaa3ba
parent 93049 f45abf187f288064c37ba5f76632b573947958b6
child 93051 720b32b1ef1e6c4d1359b16a057650011b9c50e0
push id8950
push userryanvm@gmail.com
push dateThu, 03 May 2012 22:33:56 +0000
treeherdermozilla-inbound@4742910656ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs751416
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 751416 - Remove unused txList[Iterator] methods. r=sicking
content/xslt/src/base/txList.cpp
content/xslt/src/base/txList.h
--- a/content/xslt/src/base/txList.cpp
+++ b/content/xslt/src/base/txList.cpp
@@ -55,68 +55,22 @@ txList::txList() {
 /**
  * txList destructor, cleans up ListItems, but will not delete the Object
  * references
 */
 txList::~txList() {
     clear();
 } //-- ~txList
 
-nsresult txList::insert(int index, void* objPtr)
-{
-    if (index >= itemCount) {
-        return insertBefore(objPtr, 0);
-    }
-    // add inside the list
-    ListItem* nextItem = firstItem;
-    for (int i = 0; i < index; i++)
-        nextItem = nextItem->nextItem;
-    return insertBefore(objPtr, nextItem);
-} //-- insert
-
 nsresult txList::add(void* objPtr)
 {
     return insertBefore(objPtr, 0);
 } //-- add
 
 /**
- * Returns the object located at the given index. This may
- * be slow or fast depending on the implementation.
- * Note:
- * Currently this list is implemented via a linked list, so
- * this method will be slow (unless the list only has a couple
- * members) as it will need traverse the links each time
- * @return the object located at the given index
-**/
-void* txList::get(int index) {
-
-    if (index < 0 || index >= itemCount)
-        return 0;
-
-    int c = 0;
-    ListItem* item = firstItem;
-    while ((c != index) && item) {
-        item = item->nextItem;
-        ++c;
-    }
-
-    if (item)
-        return item->objPtr;
-    return 0;
-} //-- get(int)
-
-txList::ListItem* txList::getFirstItem() {
-    return firstItem;
-} //-- getFirstItem
-
-txList::ListItem* txList::getLastItem() {
-    return lastItem;
-} //-- getLastItem
-
-/**
  * Returns the number of items in this txList
 **/
 PRInt32 List::getLength() {
    return itemCount;
 } //-- getLength
 
 
 /**
@@ -174,30 +128,16 @@ nsresult txList::insertBefore(void* objP
     }
 
     // increase the item count
     ++itemCount;
     
     return NS_OK;
 } //-- insertBefore
 
-void* txList::remove(void* objPtr) {
-   ListItem* item = firstItem;
-   while (item) {
-      if (item->objPtr == objPtr) {
-         remove(item);
-         delete item;
-         return objPtr;
-      }
-      item = item->nextItem;
-   }
-   // not in list
-   return 0;
-} //-- remove
-
 txList::ListItem* txList::remove(ListItem* item) {
 
     if (!item)
         return item;
 
     //-- adjust the previous item's next pointer
     if (item->prevItem) {
         item->prevItem->nextItem = item->nextItem;
@@ -285,31 +225,16 @@ bool txListIterator::hasNext() {
         hasNext = (currentItem->nextItem != 0);
     else if (!atEndOfList)
         hasNext = (list->firstItem != 0);
 
     return hasNext;
 } //-- hasNext
 
 /**
- * Returns true if a successful call to the previous() method can be made
- * @return true if a successful call to the previous() method can be made,
- * otherwise false
-**/
-bool txListIterator::hasPrevious() {
-    bool hasPrevious = false;
-    if (currentItem)
-        hasPrevious = (currentItem->prevItem != 0);
-    else if (atEndOfList)
-        hasPrevious = (list->lastItem != 0);
-
-    return hasPrevious;
-} //-- hasPrevious
-
-/**
  * Returns the next Object pointer in the list
 **/
 void* txListIterator::next() {
 
     void* obj = 0;
     if (currentItem)
         currentItem = currentItem->nextItem;
     else if (!atEndOfList)
@@ -350,50 +275,16 @@ void* txListIterator::current() {
 
     if (currentItem)
         return currentItem->objPtr;
 
     return 0;
 } //-- current
 
 /**
- * Moves the specified number of steps
-**/
-void* txListIterator::advance(int i) {
-
-    void* obj = 0;
-
-    if (i > 0) {
-        if (!currentItem && !atEndOfList) {
-            currentItem = list->firstItem;
-            --i;
-        }
-        for (; currentItem && i > 0; i--)
-            currentItem = currentItem->nextItem;
-        
-        atEndOfList = currentItem == 0;
-    }
-    else if (i < 0) {
-        if (!currentItem && atEndOfList) {
-            currentItem = list->lastItem;
-            ++i;
-        }
-        for (; currentItem && i < 0; i++)
-            currentItem = currentItem->prevItem;
-
-        atEndOfList = false;
-    }
-
-    if (currentItem)
-        obj = currentItem->objPtr;
-
-    return obj;
-} //-- advance
-
-/**
  * Removes the Object last returned by the next() or previous() methods;
  * @return the removed Object pointer
 **/
 void* txListIterator::remove() {
 
     void* obj = 0;
     if (currentItem) {
         obj = currentItem->objPtr;
--- a/content/xslt/src/base/txList.h
+++ b/content/xslt/src/base/txList.h
@@ -58,66 +58,46 @@ public:
     txList();
 
     /**
      * txList destructor, object references will not be deleted.
     **/
     ~txList();
 
     /**
-     * Returns the object located at the given index. This may
-     * be slow or fast depending on the implementation.
-     * @return the object located at the given index
-    **/
-    void* get(int index);
-
-    /**
      * Returns the number of items in this txList
     **/
     PRInt32 getLength();
 
     /**
      * Returns true if there are no items in this txList
      */
     inline bool isEmpty()
     {
         return itemCount == 0;
     }
 
     /**
-     * Adds the given Object to the specified position in the list
-    **/
-    nsresult insert(int index, void* objPtr);
-
-    /**
      * Adds the given Object to the list
     **/
     nsresult add(void* objPtr);
 
-    /**
-     * Removes the given Object pointer from the list
-    **/
-    void* remove(void* objPtr);
-    
     /*
      * Removes all the objects from the list
      */
     void clear();
 
 protected:
 
     struct ListItem {
         ListItem* nextItem;
         ListItem* prevItem;
         void* objPtr;
     };
 
-    ListItem* getFirstItem();
-    ListItem* getLastItem();
-
     /**
      * Removes the given ListItem pointer from the list
     **/
     ListItem* remove(ListItem* sItem);
 
 private:
       txList(const txList& aOther); // not implemented
 
@@ -162,43 +142,31 @@ public:
     /**
      * Returns true if a successful call to the next() method can be made
      * @return true if a successful call to the next() method can be made,
      * otherwise false
     **/
     bool  hasNext();
 
     /**
-     * Returns true if a successful call to the previous() method can be made
-     * @return true if a successful call to the previous() method can be made,
-     * otherwise false
-    **/
-    bool  hasPrevious();
-
-    /**
      * Returns the next Object pointer from the list
     **/
     void* next();
 
     /**
      * Returns the previous Object pointer from the list
     **/
     void* previous();
     
     /**
      * Returns the current Object
     **/
     void* current();
     
     /**
-     * Moves the specified number of steps
-    **/
-    void* advance(int i);
-
-    /**
      * Removes the Object last returned by the next() or previous() methods;
      * @return the removed Object pointer
     **/
     void* remove();
 
     /**
      * Resets the current location within the txList to the beginning of the txList
     **/