Revision: 1099
Author: [email protected]
Date: Mon Mar  8 01:45:48 2010
Log: Add a wrapper for NYTP_write_attribute_string and use it from nytprofmerge.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1099

Modified:
 /trunk/FileHandle.xs
 /trunk/bin/nytprofmerge

=======================================
--- /trunk/FileHandle.xs        Mon Mar  8 01:45:42 2010
+++ /trunk/FileHandle.xs        Mon Mar  8 01:45:48 2010
@@ -784,3 +784,18 @@
         RETVAL = NYTP_write_comment(handle, "%s", comment);
     OUTPUT:
         RETVAL
+
+size_t
+NYTP_write_attribute(handle, key, value)
+NYTP_file handle
+SV *key
+SV *value
+    PREINIT:
+        STRLEN key_len;
+        const char *const key_p = SvPVbyte(key, key_len);
+        STRLEN value_len;
+        const char *const value_p = SvPVbyte(value, value_len);
+    CODE:
+ RETVAL = NYTP_write_attribute_string(handle, key_p, key_len, value_p, value_len);
+    OUTPUT:
+        RETVAL
=======================================
--- /trunk/bin/nytprofmerge     Mon Mar  8 01:45:35 2010
+++ /trunk/bin/nytprofmerge     Mon Mar  8 01:45:48 2010
@@ -118,7 +118,7 @@
                 }
             } else {
                 $attributes{$key} = $value;
-                $out->write(":$key=$value\n");
+                $out->write_attribute($key, $value);
             }
         } else {
             push @{$attributes{$key}}, $value;
@@ -330,7 +330,7 @@
     my @values = @{$attributes{$key}};
     if ($key eq 'basetime') {
        my $value = min(@values);
-       $out->write(":$key=$value\n");
+       $out->write_attribute($key, $value);
     } elsif ($key eq 'application') {
        my %counts;
        $counts{$_}++ foreach @values;
@@ -342,10 +342,10 @@
        }
        my $last = pop @grouped;
        my $value = @grouped ? join (', ', @grouped) . " and $last" : $last;
-       $out->write(":$key=$value\n");
+       $out->write_attribute($key, $value);
     } else {
        warn "Unknown attribute $key\n";
-       $out->write(":$key=$_\n") foreach @values;
+       $out->write_attribute($key, $_) foreach @values;
     }
 }

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