diff gen/functions.cpp @ 1510:b6b6afc2dfc7

Put scope-limited data on the stack instead of using 'new' and 'delete'.
author Frits van Bommel <fvbommel wxs.nl>
date Sat, 20 Jun 2009 19:44:54 +0200
parents e1e93343fc11
children 8ca25bd765a3
line wrap: on
line diff
--- a/gen/functions.cpp	Sat Jun 20 19:12:04 2009 +0200
+++ b/gen/functions.cpp	Sat Jun 20 19:44:54 2009 +0200
@@ -774,10 +774,12 @@
     }
 
     // output function body
-    irfunction->gen = new FuncGen;
-    fd->fbody->toIR(gIR);
-    delete irfunction->gen;
-    irfunction->gen = 0;
+    {
+        FuncGen fg;
+        irfunction->gen = &fg;
+        fd->fbody->toIR(gIR);
+        irfunction->gen = 0;
+    }
 
     // TODO: clean up this mess