Revision: 1118
Author: [email protected]
Date: Mon Mar  8 01:48:00 2010
Log: Abstract writing the file header into NYTP_write_header(), add a wrapper and
use it from nytprofmerge.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1118

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

=======================================
--- /trunk/FileHandle.h Mon Mar  8 01:47:52 2010
+++ /trunk/FileHandle.h Mon Mar  8 01:48:00 2010
@@ -61,6 +61,7 @@

 void NYTProf_croak_if_not_stdio(NYTP_file file, const char *function);

+size_t NYTP_write_header(NYTP_file ofile, unsigned int major, unsigned int minor);
 size_t NYTP_write_comment(NYTP_file ofile, const char *format, ...);
 size_t NYTP_write_attribute_string(NYTP_file ofile,
                                    const char *key, size_t key_len,
=======================================
--- /trunk/FileHandle.xs        Mon Mar  8 01:47:52 2010
+++ /trunk/FileHandle.xs        Mon Mar  8 01:48:00 2010
@@ -702,6 +702,12 @@
 {
     return NYTP_write(file, (unsigned char *)&nv, sizeof(NV));
 }
+
+size_t
+NYTP_write_header(NYTP_file ofile, unsigned int major, unsigned int minor)
+{
+    return NYTP_printf(ofile, "NYTProf %u %u\n", major, minor);
+}

 size_t
 NYTP_write_comment(NYTP_file ofile, const char *format, ...) {
@@ -1275,3 +1281,9 @@
 size_t
 NYTP_write_discount(handle)
 NYTP_file handle
+
+size_t
+NYTP_write_header(handle, major, minor)
+NYTP_file handle
+unsigned int major
+unsigned int minor
=======================================
--- /trunk/NYTProf.xs   Mon Mar  8 01:47:52 2010
+++ /trunk/NYTProf.xs   Mon Mar  8 01:48:00 2010
@@ -430,7 +430,7 @@

     assert(out != NULL);
/* File header with "magic" string, with file major and minor version */ - NYTP_printf(out, "NYTProf %d %d\n", NYTP_FILE_MAJOR_VERSION, NYTP_FILE_MINOR_VERSION); + NYTP_write_header(out, NYTP_FILE_MAJOR_VERSION, NYTP_FILE_MINOR_VERSION);
     /* Human readable comments and attributes follow
      * comments start with '#', end with '\n', and are discarded
      * attributes start with ':', a word, '=', then the value, then '\n'
=======================================
--- /trunk/bin/nytprofmerge     Mon Mar  8 01:47:52 2010
+++ /trunk/bin/nytprofmerge     Mon Mar  8 01:48:00 2010
@@ -96,7 +96,7 @@
                 unless $this_version eq $version;
         } else {
             $version = $this_version;
-            $out->write("NYTProf $version\n");
+            $out->write_header($major, $minor);
         }
      },
      COMMENT => sub {

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