Revision: 1030
Author: [email protected]
Date: Thu Jan 21 05:56:22 2010
Log: Swap from char pointers to char arrays to avoid two strlen()s on constants.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1030

Modified:
 /trunk/NYTProf.xs

=======================================
--- /trunk/NYTProf.xs   Thu Jan 21 04:42:23 2010
+++ /trunk/NYTProf.xs   Thu Jan 21 05:56:22 2010
@@ -815,8 +815,8 @@
             /* strange eval that doesn't have a filename associated */
             /* seen in mod_perl, possibly from eval_sv(sv) api call */
             /* also when nameevals=0 option is in effect */
-            char *eval_file = "/unknown-eval-invoker";
- found->eval_fid = get_file_id(aTHX_ eval_file, strlen(eval_file),
+            char eval_file[] = "/unknown-eval-invoker";
+ found->eval_fid = get_file_id(aTHX_ eval_file, sizeof(eval_file) - 1,
                 NYTP_FIDf_IS_FAKE | created_via
             );
             found->eval_line_num = 1;
@@ -3090,8 +3090,8 @@
     }

     if (main_runtime_used) { /* Create fake entry for main::RUNTIME sub */
-        char *runtime = "main::RUNTIME";
-       const I32 runtime_len = strlen(runtime);
+        char runtime[] = "main::RUNTIME";
+        const I32 runtime_len = sizeof(runtime) - 1;
         SV *sv = *hv_fetch(hv, runtime, runtime_len, 1);

/* get name of file that contained first profiled sub in 'main::' */
-- 
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]

Reply via email to