([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:
mccallum 1995-07-06 17:58:16 +00:00
parent 591d66eaff
commit 8523703daf

View file

@ -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;
} }