+ IDWriteFontCollectionLoader **CollectionLoaders; + LONG CollectionLoaderCount;
I'd really like a better naming for those, something like 'loaders' and 'loaders_count'.
+ if (i == This->CollectionLoaderCount) + { + This->CollectionLoaderCount++; + if (This->CollectionLoaders) + This->CollectionLoaders = heap_realloc(This->CollectionLoaders, This->CollectionLoaderCount * sizeof(IDWriteFontCollectionLoader*)); + else + This->CollectionLoaders = heap_alloc(This->CollectionLoaderCount * sizeof(IDWriteFontCollectionLoader*)); + if (!This->CollectionLoaders) + return E_OUTOFMEMORY; + } + IDWriteFontCollectionLoader_AddRef(loader); + This->CollectionLoaders[i] = loader;
This should grow more efficiently in my opinion. Also it probably makes sense to have small number of slots allocated on initial factory creation or even use a list (you don't need index access). Another question is do we want to register a default local loader on factory creation or not.