mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
([NSGArray -initWithObjects:count:]): Set _capacity to minimum of 1.
([NSGMutableArray -initWithCapacity:]): Likewise. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@498 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
591d66eaff
commit
8523703daf
1 changed files with 2 additions and 2 deletions
|
@ -53,7 +53,7 @@
|
||||||
_comparison_function = elt_get_comparison_function(@encode(id));
|
_comparison_function = elt_get_comparison_function(@encode(id));
|
||||||
_grow_factor = [[self class] defaultGrowFactor];
|
_grow_factor = [[self class] defaultGrowFactor];
|
||||||
_count = count;
|
_count = count;
|
||||||
_capacity = count;
|
_capacity = (count < 1) ? 1 : count;
|
||||||
OBJC_MALLOC(_contents_array, elt, _capacity);
|
OBJC_MALLOC(_contents_array, elt, _capacity);
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
_comparison_function = elt_get_comparison_function(@encode(id));
|
_comparison_function = elt_get_comparison_function(@encode(id));
|
||||||
_grow_factor = [[self class] defaultGrowFactor];
|
_grow_factor = [[self class] defaultGrowFactor];
|
||||||
_count = 0;
|
_count = 0;
|
||||||
_capacity = numItems;
|
_capacity = (numItems < 1) ? 1 : numItems;
|
||||||
OBJC_MALLOC(_contents_array, elt, _capacity);
|
OBJC_MALLOC(_contents_array, elt, _capacity);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue