mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 09:41:15 +00:00
Release objects
This commit is contained in:
parent
30aea6e5ad
commit
d66ad25b50
1 changed files with 36 additions and 23 deletions
|
@ -382,15 +382,14 @@ static SEL rlSel;
|
|||
- (instancetype) initWithArray:(NSArray *)other copyItems:(BOOL)flag
|
||||
{
|
||||
unsigned count = [other count];
|
||||
unsigned j = count;
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
return [self init];
|
||||
}
|
||||
else
|
||||
{
|
||||
GS_BEGINIDBUF(objs, count);
|
||||
|
||||
GS_BEGINIDBUF(objs, count);
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
@ -408,9 +407,16 @@ static SEL rlSel;
|
|||
}
|
||||
|
||||
self = [self initWithObjects: objs count: count];
|
||||
|
||||
if(flag == YES)
|
||||
{
|
||||
while(j--)
|
||||
{
|
||||
[objs[j] release];
|
||||
}
|
||||
}
|
||||
GS_ENDIDBUF();
|
||||
return self;
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype) initWithArray:(NSArray *)other
|
||||
|
@ -418,6 +424,7 @@ static SEL rlSel;
|
|||
copyItems:(BOOL)flag
|
||||
{
|
||||
unsigned count = [other count];
|
||||
unsigned i = 0, j = 0;
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
|
@ -426,10 +433,8 @@ static SEL rlSel;
|
|||
|
||||
GS_BEGINIDBUF(objs, range.length);
|
||||
{
|
||||
unsigned i = 0;
|
||||
unsigned loc = range.location;
|
||||
unsigned len = range.length;
|
||||
unsigned j = 0;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
|
@ -453,6 +458,14 @@ static SEL rlSel;
|
|||
}
|
||||
}
|
||||
self = [self initWithObjects: objs count: count];
|
||||
|
||||
if(flag == YES)
|
||||
{
|
||||
while(j--)
|
||||
{
|
||||
[objs[j] release];
|
||||
}
|
||||
}
|
||||
GS_ENDIDBUF();
|
||||
|
||||
return self;
|
||||
|
|
Loading…
Reference in a new issue