Remove unnecessary allocations

This commit is contained in:
Jonas Kulla 2013-10-01 18:27:22 +02:00
parent a54acce6b7
commit 7b97075282
1 changed files with 4 additions and 8 deletions

View File

@ -287,6 +287,8 @@ struct InputPrivate
/* Collective binding array */ /* Collective binding array */
QVector<Binding*> bindings; QVector<Binding*> bindings;
ButtonState stateArray[Input::buttonCodeSize*2];
ButtonState *states; ButtonState *states;
ButtonState *statesOld; ButtonState *statesOld;
@ -311,8 +313,8 @@ struct InputPrivate
initJsBindings(); initJsBindings();
initMsBindings(); initMsBindings();
states = new ButtonState[Input::buttonCodeSize]; states = stateArray;
statesOld = new ButtonState[Input::buttonCodeSize]; statesOld = stateArray + Input::buttonCodeSize;
/* Clear buffers */ /* Clear buffers */
clearBuffer(); clearBuffer();
@ -328,12 +330,6 @@ struct InputPrivate
dir8Data.active = 0; dir8Data.active = 0;
} }
~InputPrivate()
{
delete[] states;
delete[] statesOld;
}
inline ButtonState &getStateCheck(int code) inline ButtonState &getStateCheck(int code)
{ {
int index; int index;