mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 08:41:03 +00:00
Do retain/release/autorelease of contents as appropriate.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@135 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ccf5895cfd
commit
9198d21e5f
3 changed files with 7 additions and 4 deletions
|
@ -76,7 +76,7 @@
|
||||||
_contents_array[0] = _contents_array[_count-1];
|
_contents_array[0] = _contents_array[_count-1];
|
||||||
decrementCount(self);
|
decrementCount(self);
|
||||||
[self heapifyFromIndex:0];
|
[self heapifyFromIndex:0];
|
||||||
return ret;
|
return AUTORELEASE_ELT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
- addElement: (elt)newElement
|
- addElement: (elt)newElement
|
||||||
|
@ -84,6 +84,7 @@
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
incrementCount(self);
|
incrementCount(self);
|
||||||
|
RETAIN_ELT(newElement);
|
||||||
for (i = _count-1;
|
for (i = _count-1;
|
||||||
i > 0
|
i > 0
|
||||||
&& COMPARE_ELEMENTS(_contents_array[HEAP_PARENT(i)], newElement) < 0;
|
&& COMPARE_ELEMENTS(_contents_array[HEAP_PARENT(i)], newElement) < 0;
|
||||||
|
|
|
@ -119,7 +119,7 @@
|
||||||
[[oldElement.id_u nextLink] setPrevLink:[oldElement.id_u prevLink]];
|
[[oldElement.id_u nextLink] setPrevLink:[oldElement.id_u prevLink]];
|
||||||
[[oldElement.id_u prevLink] setNextLink:[oldElement.id_u nextLink]];
|
[[oldElement.id_u prevLink] setNextLink:[oldElement.id_u nextLink]];
|
||||||
_count--;
|
_count--;
|
||||||
return oldElement;
|
return AUTORELEASE_ELT(oldElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
- insertElement: (elt)newElement after: (elt)oldElement
|
- insertElement: (elt)newElement after: (elt)oldElement
|
||||||
|
@ -160,18 +160,20 @@
|
||||||
[oldElement.id_u setPrevLink:newElement.id_u];
|
[oldElement.id_u setPrevLink:newElement.id_u];
|
||||||
}
|
}
|
||||||
_count++;
|
_count++;
|
||||||
|
RETAIN_ELT(newElement);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (elt) replaceElement: (elt)oldElement with: (elt)newElement
|
- (elt) replaceElement: (elt)oldElement with: (elt)newElement
|
||||||
{
|
{
|
||||||
|
RETAIN_ELT(newElement);
|
||||||
if (oldElement.id_u == _first_link)
|
if (oldElement.id_u == _first_link)
|
||||||
_first_link = newElement.id_u;
|
_first_link = newElement.id_u;
|
||||||
[newElement.id_u setNextLink:[oldElement.id_u nextLink]];
|
[newElement.id_u setNextLink:[oldElement.id_u nextLink]];
|
||||||
[newElement.id_u setPrevLink:[oldElement.id_u prevLink]];
|
[newElement.id_u setPrevLink:[oldElement.id_u prevLink]];
|
||||||
[[oldElement.id_u prevLink] setNextLink:newElement.id_u];
|
[[oldElement.id_u prevLink] setNextLink:newElement.id_u];
|
||||||
[[oldElement.id_u nextLink] setPrevLink:newElement.id_u];
|
[[oldElement.id_u nextLink] setPrevLink:newElement.id_u];
|
||||||
return oldElement;
|
return AUTORELEASE_ELT(oldElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End of methods that change the instance variables. */
|
/* End of methods that change the instance variables. */
|
||||||
|
|
|
@ -237,7 +237,7 @@ static id nilRBNode;
|
||||||
[oldElement.id_u setLeftNode:[self nilNode]];
|
[oldElement.id_u setLeftNode:[self nilNode]];
|
||||||
[oldElement.id_u setParentNode:[self nilNode]];
|
[oldElement.id_u setParentNode:[self nilNode]];
|
||||||
_count--;
|
_count--;
|
||||||
return oldElement;
|
return AUTORELEASE_ELT(oldElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Override methods that could violate assumptions of RBTree structure.
|
/* Override methods that could violate assumptions of RBTree structure.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue