[svn:parrot] r46121 - trunk/src

NotFound at svn.parrot.org NotFound at svn.parrot.org
Wed Apr 28 21:48:20 UTC 2010


Author: NotFound
Date: Wed Apr 28 21:48:20 2010
New Revision: 46121
URL: https://trac.parrot.org/parrot/changeset/46121

Log:
fix XXX in packfile.c by adding a and documenting SEGMENT_HEADER_SIZE

Modified:
   trunk/src/packfile.c

Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c	Wed Apr 28 21:42:53 2010	(r46120)
+++ trunk/src/packfile.c	Wed Apr 28 21:48:20 2010	(r46121)
@@ -481,6 +481,15 @@
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
 
+/* Segment header:
+  1 op - Segment size
+  1 op - Internal type
+  1 op - Internal id
+  1 op - Size of theop array
+  See pdd13_bytecode: Packfile Segment Header
+*/
+#define SEGMENT_HEADER_SIZE 4
+
 /* offset not in ptr diff, but in byte */
 #define OFFS(pf, cursor) ((pf) ? ((const char *)(cursor) - (const char *)((pf)->src)) : 0)
 /**
@@ -1573,7 +1582,7 @@
 default_dump(PARROT_INTERP, ARGIN(const PackFile_Segment *self))
 {
     ASSERT_ARGS(default_dump)
-    size_t i = self->data ? 0: self->file_offset + 4;
+    size_t i = self->data ? 0: self->file_offset + SEGMENT_HEADER_SIZE;
 
     default_dump_header(interp, self);
 
@@ -2517,10 +2526,7 @@
 default_packed_size(ARGIN(const PackFile_Segment *self))
 {
     ASSERT_ARGS(default_packed_size)
-    /* op_count, itype, id, size */
-    /* XXX There should be a constant defining this 4, and why */
-    /* This is the 2nd place in the file that has this */
-    return 4 + self->size;
+    return SEGMENT_HEADER_SIZE + self->size;
 }
 
 


More information about the parrot-commits mailing list