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

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Oct 10 00:16:56 UTC 2009


Author: bacek
Date: Sat Oct 10 00:16:56 2009
New Revision: 41780
URL: https://trac.parrot.org/parrot/changeset/41780

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

Modified:
   trunk/src/runcore/profiling.c

Modified: trunk/src/runcore/profiling.c
==============================================================================
--- trunk/src/runcore/profiling.c	Sat Oct 10 00:16:37 2009	(r41779)
+++ trunk/src/runcore/profiling.c	Sat Oct 10 00:16:56 2009	(r41780)
@@ -116,7 +116,6 @@
     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"))) {
@@ -132,7 +131,6 @@
     }
     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");
     }
 
@@ -152,13 +150,12 @@
     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