Simplify and speed-up logic for copying data
Change-Id: I790ef30075d74c6bd7a049750dfb555d36d77542 Signed-off-by: jailletc36 <christophe.jaillet@wanadoo.fr> Reviewed-on: https://gerrit.libreoffice.org/2523 Reviewed-by: Jørgen Nystad <jorgenys@gmail.com> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
parent
2f3e1c77b2
commit
d16ec6a180
1 changed files with 2 additions and 8 deletions
|
@ -117,16 +117,10 @@ void
|
||||||
StateMachin2::ResizeStati()
|
StateMachin2::ResizeStati()
|
||||||
{
|
{
|
||||||
intt nNewSize = nStatiSpace + C_nStatuslistResizeValue;
|
intt nNewSize = nStatiSpace + C_nStatuslistResizeValue;
|
||||||
intt i = 0;
|
|
||||||
StatusList pNewStati = new StmStatu2*[nNewSize];
|
StatusList pNewStati = new StmStatu2*[nNewSize];
|
||||||
|
|
||||||
for ( ; i < nNrofStati; i++)
|
memcpy( pNewStati, pStati, nNrofStati * sizeof(StmStatu2*) );
|
||||||
{
|
memset( pNewStati+nNrofStati, 0, (nNewSize-nNrofStati) * sizeof(StmStatu2*) );
|
||||||
pNewStati[i] = pStati[i];
|
|
||||||
}
|
|
||||||
memset( pNewStati+i,
|
|
||||||
0,
|
|
||||||
(nNewSize-i) * sizeof(StmStatu2*) );
|
|
||||||
|
|
||||||
delete [] pStati;
|
delete [] pStati;
|
||||||
pStati = pNewStati;
|
pStati = pNewStati;
|
||||||
|
|
Loading…
Reference in a new issue