[svn:parrot] r41804 - trunk/src/runcore

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Oct 10 20:52:36 UTC 2009


Author: bacek
Date: Sat Oct 10 20:52:36 2009
New Revision: 41804
URL: https://trac.parrot.org/parrot/changeset/41804

Log:
Revert "[cage] Reduce scope for C string in runcore_profile_init."

mikehh++ for noticing, bacek-- for to be careless.

Modified:
   trunk/src/runcore/profiling.c

Modified: trunk/src/runcore/profiling.c
==============================================================================
--- trunk/src/runcore/profiling.c	Sat Oct 10 20:50:47 2009	(r41803)
+++ trunk/src/runcore/profiling.c	Sat Oct 10 20:52:36 2009	(r41804)
@@ -116,6 +116,7 @@
     if (profile_output_var) {
         STRING  *lc_filename;
         runcore->profile_filename = Parrot_str_new(interp, profile_output_var, 0);
+        profile_filename          = Parrot_str_to_cstring(interp, runcore->profile_filename);
         lc_filename               = Parrot_str_downcase(interp, runcore->profile_filename);
 
         if (Parrot_str_equal(interp, lc_filename, CONST_STRING(interp, "stderr"))) {
@@ -131,6 +132,7 @@
     }
     else {
         runcore->profile_filename = Parrot_sprintf_c(interp, "parrot.pprof.%d", getpid());
+        profile_filename          = Parrot_str_to_cstring(interp, runcore->profile_filename);
         runcore->profile_fd       = fopen(profile_filename, "w");
     }
 
@@ -150,12 +152,13 @@
     Profiling_first_loop_SET(runcore);
 
     if (!runcore->profile_fd) {
-        profile_filename          = Parrot_str_to_cstring(interp, runcore->profile_filename);
         fprintf(stderr, "unable to open %s for writing", profile_filename);
         Parrot_str_free_cstring(profile_filename);
         exit(1);
     }
 
+    Parrot_str_free_cstring(profile_filename);
+
     return runops_profiling_core(interp, runcore, pc);
 }
 


More information about the parrot-commits mailing list