[psaux] Use doubling allocation strategy for CF2_ArrStack.

Fixes timeout reported as

  https://crbug.com/1206181

* src/psaux/psarrst.c (cf2_arrstack_{push,init}): Implement it.
* src/psaux/psarrst.h (CF2_ArrStackiRec): Drop `chunk'.
This commit is contained in:
Daniel McArdle 2021-05-13 23:08:31 -04:00 committed by Alexei Podtelezhnikov
parent 2d3f5dd294
commit de15165774
3 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,14 @@
2021-05-13 Daniel McArdle <dmcardle@chromium.org>
[psaux] Use doubling allocation strategy for CF2_ArrStack.
Fixes timeout reported as
https://crbug.com/1206181
* src/psaux/psarrst.c (cf2_arrstack_{push,init}): Implement it.
* src/psaux/psarrst.h (CF2_ArrStackiRec): Drop `chunk'.
2021-05-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (FT_MAX_GRAY_SPANS): Increase from 10 to 16.

View File

@ -65,7 +65,6 @@
arrstack->error = error;
arrstack->sizeItem = sizeItem;
arrstack->allocated = 0;
arrstack->chunk = 10; /* chunks of 10 items */
arrstack->count = 0;
arrstack->totalSize = 0;
arrstack->ptr = NULL;
@ -216,9 +215,9 @@
if ( arrstack->count == arrstack->allocated )
{
/* grow the buffer by one chunk */
/* increase the buffer size */
if ( !cf2_arrstack_setNumElements(
arrstack, arrstack->allocated + arrstack->chunk ) )
arrstack, arrstack->allocated * 2 + 16 ) )
{
/* on error, ignore the push */
return;

View File

@ -55,7 +55,6 @@ FT_BEGIN_HEADER
size_t sizeItem; /* bytes per element */
size_t allocated; /* items allocated */
size_t chunk; /* allocation increment in items */
size_t count; /* number of elements allocated */
size_t totalSize; /* total bytes allocated */