From 7b97075282100bd84fc166dcea47a5f4ba3847bb Mon Sep 17 00:00:00 2001
From: Jonas Kulla <Nyocurio@gmail.com>
Date: Tue, 1 Oct 2013 18:27:22 +0200
Subject: [PATCH] Remove unnecessary allocations

---
 src/input.cpp | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

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