Revision: 1042
Author: [email protected]
Date: Fri Feb  5 09:56:45 2010
Log: When reading NYTP_TAG_ATTRIBUTE with a callback, assign directly to cb_args[2]
rather than assigning to value_sv and then copying that SV's contents. As
attr_hv is later discarded if there is a callback, don't waste effort setting
it.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1042

Modified:
 /trunk/NYTProf.xs

=======================================
--- /trunk/NYTProf.xs   Fri Feb  5 09:56:41 2010
+++ /trunk/NYTProf.xs   Fri Feb  5 09:56:45 2010
@@ -4217,7 +4217,6 @@
             {
                 char text[MAXPATHLEN*2];
                 char *value, *end, *text_end;
-                SV *value_sv;
                 if (NULL == NYTP_gets(in, text, sizeof(text)))
                     /* probably EOF */
                     croak("Profile format error reading attribute");
@@ -4228,7 +4227,6 @@
                     continue;
                 }
                 text_end = value++;
-                value_sv = newSVpvn(value, end-value);

                 if (cb) {
                     PUSHMARK(SP);
@@ -4236,14 +4234,14 @@
                     i = 0;
sv_setpvs(cb_args[i], "ATTRIBUTE"); XPUSHs(cb_args[i++]); sv_setpvn(cb_args[i], text, text_end - text); XPUSHs(cb_args[i++]); - sv_setsv(cb_args[i], value_sv); XPUSHs(cb_args[i++]); + sv_setpvn(cb_args[i], value, end - value); XPUSHs(cb_args[i++]);

                     PUTBACK;
                     call_sv(cb, G_DISCARD);
                     SPAGAIN;
-                }
-
- store_attrib_sv(aTHX_ attr_hv, text, text_end - text, value_sv);
+                } else {
+ store_attrib_sv(aTHX_ attr_hv, text, text_end - text, newSVpvn(value, end - value));
+                }
                 if (memEQs(text, text_end - text, "ticks_per_sec")) {
                     ticks_per_sec = (unsigned int)atoi(value);
                 }

--
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