mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +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
f4e1da3e6d
commit
264d951458
3 changed files with 7 additions and 4 deletions
|
@ -76,7 +76,7 @@
|
|||
_contents_array[0] = _contents_array[_count-1];
|
||||
decrementCount(self);
|
||||
[self heapifyFromIndex:0];
|
||||
return ret;
|
||||
return AUTORELEASE_ELT(ret);
|
||||
}
|
||||
|
||||
- addElement: (elt)newElement
|
||||
|
@ -84,6 +84,7 @@
|
|||
int i;
|
||||
|
||||
incrementCount(self);
|
||||
RETAIN_ELT(newElement);
|
||||
for (i = _count-1;
|
||||
i > 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 prevLink] setNextLink:[oldElement.id_u nextLink]];
|
||||
_count--;
|
||||
return oldElement;
|
||||
return AUTORELEASE_ELT(oldElement);
|
||||
}
|
||||
|
||||
- insertElement: (elt)newElement after: (elt)oldElement
|
||||
|
@ -160,18 +160,20 @@
|
|||
[oldElement.id_u setPrevLink:newElement.id_u];
|
||||
}
|
||||
_count++;
|
||||
RETAIN_ELT(newElement);
|
||||
return self;
|
||||
}
|
||||
|
||||
- (elt) replaceElement: (elt)oldElement with: (elt)newElement
|
||||
{
|
||||
RETAIN_ELT(newElement);
|
||||
if (oldElement.id_u == _first_link)
|
||||
_first_link = newElement.id_u;
|
||||
[newElement.id_u setNextLink:[oldElement.id_u nextLink]];
|
||||
[newElement.id_u setPrevLink:[oldElement.id_u prevLink]];
|
||||
[[oldElement.id_u prevLink] setNextLink: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. */
|
||||
|
|
|
@ -237,7 +237,7 @@ static id nilRBNode;
|
|||
[oldElement.id_u setLeftNode:[self nilNode]];
|
||||
[oldElement.id_u setParentNode:[self nilNode]];
|
||||
_count--;
|
||||
return oldElement;
|
||||
return AUTORELEASE_ELT(oldElement);
|
||||
}
|
||||
|
||||
/* Override methods that could violate assumptions of RBTree structure.
|
||||
|
|
Loading…
Reference in a new issue