([Collection -_safeWithElementsCallNoRetain:]): Use malloc not alloca.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@455 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mccallum 1995-06-28 23:21:00 +00:00
parent a578d2b436
commit 5ee18261b4

View file

@ -68,7 +68,7 @@
- (void) _safeWithElementsCallNoRetain: (void(*)(elt))aFunc - (void) _safeWithElementsCallNoRetain: (void(*)(elt))aFunc
{ {
int c = [self count]; int c = [self count];
elt *elts = (elt*) alloca(c * sizeof(elt)); elt *elts = (elt*) (*objc_malloc) (c * sizeof(elt));
int i = 0; int i = 0;
void fill_elts(elt e) void fill_elts(elt e)
{ {
@ -77,6 +77,7 @@
[self withElementsCall:fill_elts]; [self withElementsCall:fill_elts];
for (i = 0; i < c; i++) for (i = 0; i < c; i++)
aFunc(elts[i]); aFunc(elts[i]);
(*objc_free) (elts);
} }
static void static void