pp_formline: handle growing better
authorDavid Mitchell <davem@iabyn.com>
Sun, 29 May 2011 18:27:56 +0000 (19:27 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 29 May 2011 19:21:54 +0000 (20:21 +0100)
commit26e935cfa6e70de1bd5258e0cb0f22ee976909f3
treec1da6bd5bd35e1114dc50c1fa5db7f38b0c6d85c
parentf5ada144f34d75c136b6780e10ca13d18d44c557
pp_formline: handle growing better

We initially grow PL_formtarget by the largest amount a formline can
append (since formats are fixed width). The only thing that can exceed
that is @*; but also, if PL_formtarget gets upgraded to utf8, then some of
the extra buffer we allocated can get eaten up by the upgrade.

Codify this so we only grow when necessary, but always enough.

Prior to this commit, we were growing FF_ITEM/FF_LITERAL too much, and
FF_LINEGLOB too little (the latter being my mistake from a few commits
ago).

Also rename 'fudge' to 'linemax', to give a better idea what it's for.
pp_ctl.c
t/op/write.t