From fad5ff56d3cfd7c4f75fd74b599b93a1e2d8af96 Mon Sep 17 00:00:00 2001 From: Andrew McCallum Date: Thu, 6 Jul 1995 17:58:16 +0000 Subject: [PATCH] ([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 --- Source/NSGArray.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/NSGArray.m b/Source/NSGArray.m index 587a3ae7f..6315007a6 100644 --- a/Source/NSGArray.m +++ b/Source/NSGArray.m @@ -53,7 +53,7 @@ _comparison_function = elt_get_comparison_function(@encode(id)); _grow_factor = [[self class] defaultGrowFactor]; _count = count; - _capacity = count; + _capacity = (count < 1) ? 1 : count; OBJC_MALLOC(_contents_array, elt, _capacity); while (count--) { @@ -98,7 +98,7 @@ _comparison_function = elt_get_comparison_function(@encode(id)); _grow_factor = [[self class] defaultGrowFactor]; _count = 0; - _capacity = numItems; + _capacity = (numItems < 1) ? 1 : numItems; OBJC_MALLOC(_contents_array, elt, _capacity); return self; }