Revision: 1381
Author: [email protected]
Date: Tue Oct 12 07:58:02 2010
Log: Fix portability of pkg_name_len() to old perl versions
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1381

Modified:
 /trunk/NYTProf.xs

=======================================
--- /trunk/NYTProf.xs   Mon Oct 11 13:15:28 2010
+++ /trunk/NYTProf.xs   Tue Oct 12 07:58:02 2010
@@ -3082,8 +3082,9 @@
  * reduces total code by doing the abs(len) in here.
  */
 static STRLEN
-pkg_name_len(char *sub_name, I32 len)
-{
+pkg_name_len(pTHX_ char *sub_name, I32 len)
+{
+    /* pTHX_ needed for old rninstr in old perl versions */
     const char *delim = "::";
     /* find end of package name */
char *colon = rninstr(sub_name, sub_name+(len > 0 ? len : -len), delim, delim+2);
@@ -3106,7 +3107,7 @@
 sub_pkg_filename_sv(pTHX_ char *sub_name, I32 len)
 {
     SV **svp;
-    STRLEN pkg_len = pkg_name_len(sub_name, len);
+    STRLEN pkg_len = pkg_name_len(aTHX_ sub_name, len);
     if (!pkg_len)
         return Nullsv;   /* no :: delimiter */
     svp = hv_fetch(pkg_fids_hv, sub_name, (I32)pkg_len, 0);
@@ -3223,7 +3224,7 @@
             ) {
                 if (trace_level >= 3)
logwarn("Package '%.*s' (of sub %.*s) association promoted from '%.*s' to '%.*s'\n", - (int)pkg_name_len(sub_name, sub_name_len), sub_name, + (int)pkg_name_len(aTHX_ sub_name, sub_name_len), sub_name,
                         (int)sub_name_len, sub_name,
                         (int)cached_len, cached_filename,
                         (int)filename_len, filename);
@@ -3237,7 +3238,7 @@
             ) {
/* eg utf8::SWASHNEW is already associated with .../utf8.pm not .../utf8_heavy.pl */ logwarn("Package '%.*s' (of sub %.*s) not associated with '%.*s' because already associated with '%s'\n",
-                    (int)pkg_name_len(sub_name, sub_name_len), sub_name,
+ (int)pkg_name_len(aTHX_ sub_name, sub_name_len), sub_name,
                     (int)sub_name_len, sub_name,
                     (int)filename_len, filename,
                     SvPV_nolen(pkg_filename_sv)

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