Allow static initialization of collections
git-svn-id: svn://svn.cc65.org/cc65/trunk@308 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -114,7 +114,11 @@ void CollInsert (Collection* C, void* Item, unsigned Index)
|
||||
if (C->Count >= C->Size) {
|
||||
/* Must grow */
|
||||
void** NewItems;
|
||||
C->Size *= 2;
|
||||
if (C->Size > 0) {
|
||||
C->Size *= 2;
|
||||
} else {
|
||||
C->Size = 8;
|
||||
}
|
||||
NewItems = xmalloc (C->Size * sizeof (void*));
|
||||
memcpy (NewItems, C->Items, C->Count * sizeof (void*));
|
||||
xfree (C->Items);
|
||||
|
||||
Reference in New Issue
Block a user