[svn:parrot] r48364 - in branches/unshared_buffers/src: . gc io ops packfile pmc string string/charset string/encoding

darbelo at svn.parrot.org darbelo at svn.parrot.org
Mon Aug 9 21:06:57 UTC 2010


Author: darbelo
Date: Mon Aug  9 21:06:55 2010
New Revision: 48364
URL: https://trac.parrot.org/parrot/changeset/48364

Log:
Mindless strstart replacement. All hail Buffer_bufstart()!

Modified:
   branches/unshared_buffers/src/dynext.c
   branches/unshared_buffers/src/gc/api.c
   branches/unshared_buffers/src/gc/gc_inf.c
   branches/unshared_buffers/src/gc/gc_ms.c
   branches/unshared_buffers/src/io/buffer.c
   branches/unshared_buffers/src/io/filehandle.c
   branches/unshared_buffers/src/io/portable.c
   branches/unshared_buffers/src/io/socket_unix.c
   branches/unshared_buffers/src/io/socket_win32.c
   branches/unshared_buffers/src/io/unix.c
   branches/unshared_buffers/src/io/utf8.c
   branches/unshared_buffers/src/io/win32.c
   branches/unshared_buffers/src/library.c
   branches/unshared_buffers/src/ops/string.ops
   branches/unshared_buffers/src/packfile/pf_items.c
   branches/unshared_buffers/src/pmc/bytebuffer.pmc
   branches/unshared_buffers/src/pmc/eval.pmc
   branches/unshared_buffers/src/pmc/filehandle.pmc
   branches/unshared_buffers/src/pmc/string.pmc
   branches/unshared_buffers/src/pmc/stringbuilder.pmc
   branches/unshared_buffers/src/string/api.c
   branches/unshared_buffers/src/string/charset/ascii.c
   branches/unshared_buffers/src/string/charset/binary.c
   branches/unshared_buffers/src/string/charset/iso-8859-1.c
   branches/unshared_buffers/src/string/charset/unicode.c
   branches/unshared_buffers/src/string/encoding/fixed_8.c
   branches/unshared_buffers/src/string/encoding/ucs2.c
   branches/unshared_buffers/src/string/encoding/ucs4.c
   branches/unshared_buffers/src/string/encoding/utf16.c
   branches/unshared_buffers/src/string/encoding/utf8.c
   branches/unshared_buffers/src/utils.c

Modified: branches/unshared_buffers/src/dynext.c
==============================================================================
--- branches/unshared_buffers/src/dynext.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/dynext.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -338,8 +338,8 @@
      * [shouldn't this happen in Parrot_locate_runtime_file instead?]
      */
 #ifdef WIN32
-    if (!STRING_IS_EMPTY(lib) && memcmp(lib->strstart, "lib", 3) == 0) {
-        *handle = Parrot_dlopen((char *)lib->strstart + 3, 0);
+    if (!STRING_IS_EMPTY(lib) && memcmp(Buffer_bufstart(lib), "lib", 3) == 0) {
+        *handle = Parrot_dlopen((char *)Buffer_bufstart(lib) + 3, 0);
         if (*handle) {
             path = Parrot_str_substr(interp, lib, 3, lib->strlen - 3);
             return path;
@@ -349,7 +349,7 @@
 
     /* And on cygwin replace a leading "lib" by "cyg". */
 #ifdef __CYGWIN__
-    if (!STRING_IS_EMPTY(lib) && memcmp(lib->strstart, "lib", 3) == 0) {
+    if (!STRING_IS_EMPTY(lib) && memcmp(Buffer_bufstart(lib), "lib", 3) == 0) {
         path = Parrot_str_concat(interp, CONST_STRING(interp, "cyg"),
             Parrot_str_substr(interp, lib, 3, lib->strlen - 3));
 

Modified: branches/unshared_buffers/src/gc/api.c
==============================================================================
--- branches/unshared_buffers/src/gc/api.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/gc/api.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -379,7 +379,7 @@
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR,
             "Parrot VM: STRING allocation failed!\n");
 
-    string->strstart        = NULL;
+    Buffer_bufstart(string) = NULL;
     PObj_get_FLAGS(string) |=
         flags | PObj_is_string_FLAG | PObj_is_COWable_FLAG | PObj_live_FLAG;
 
@@ -496,7 +496,7 @@
 
 Allocate the STRING's buffer memory to the given size. The allocated
 buffer maybe slightly bigger than the given C<size>. This function
-sets also C<< str->strstart >> to the new buffer location, C<< str->bufused >>
+sets also C<< str->_bufstart >> to the new buffer location, C<< str->bufused >>
 is B<not> changed.
 
 =cut
@@ -517,7 +517,7 @@
 size_t newsize)>
 
 Reallocate the STRING's buffer memory to the given size. The allocated
-buffer will not shrink. This function sets also C<str-E<gt>strstart> to the
+buffer will not shrink. This function sets also C<str-E<gt>_bufstart> to the
 new buffer location, C<str-E<gt>bufused> is B<not> changed.
 
 =cut

Modified: branches/unshared_buffers/src/gc/gc_inf.c
==============================================================================
--- branches/unshared_buffers/src/gc/gc_inf.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/gc/gc_inf.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -343,7 +343,7 @@
     if (size > 0) {
         char * const mem = (char *)mem_internal_allocate(size);
 
-        Buffer_bufstart(str) = str->strstart = mem;
+        Buffer_bufstart(str) = mem;
     }
     else {
         Buffer_bufstart(str) = NULL;
@@ -356,7 +356,7 @@
     ASSERT_ARGS(gc_inf_reallocate_string_storage)
     char * const mem     = (char *)mem_internal_realloc(Buffer_bufstart(str), size);
 
-    Buffer_bufstart(str) = str->strstart = mem;
+    Buffer_bufstart(str) = mem;
     Buffer_buflen(str)   = size;
 }
 

Modified: branches/unshared_buffers/src/gc/gc_ms.c
==============================================================================
--- branches/unshared_buffers/src/gc/gc_ms.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/gc/gc_ms.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -1158,7 +1158,7 @@
 
 Allocate the STRING's buffer memory to the given size. The allocated
 buffer maybe slightly bigger than the given C<size>. This function
-sets also C<< str->strstart >> to the new buffer location, C<< str->bufused >>
+sets also C<< str->_bufstart >> to the new buffer location, C<< str->bufused >>
 is B<not> changed.
 
 =cut
@@ -1188,7 +1188,7 @@
     mem      = (char *)mem_allocate(interp, interp->mem_pools, new_size, pool);
     mem     += sizeof (void *);
 
-    Buffer_bufstart(str) = str->strstart = mem;
+    Buffer_bufstart(str) = mem;
     Buffer_buflen(str)   = new_size - sizeof (void *);
 
     /* Save pool used to allocate into buffer header */
@@ -1201,7 +1201,7 @@
 size_t newsize)>
 
 Reallocate the STRING's buffer memory to the given size. The allocated
-buffer will not shrink. This function sets also C<str-E<gt>strstart> to the
+buffer will not shrink. This function sets also C<str-E<gt>_bufstart> to the
 new buffer location, C<str-E<gt>bufused> is B<not> changed.
 
 =cut
@@ -1262,10 +1262,8 @@
     PARROT_ASSERT(Buffer_pool(str));
     Buffer_pool(str)->freed  += ALIGNED_STRING_SIZE(Buffer_buflen(str));
 
-    /* copy mem from strstart, *not* bufstart */
-    oldmem             = str->strstart;
+    oldmem               = Buffer_bufstart(str);
     Buffer_bufstart(str) = (void *)mem;
-    str->strstart      = mem;
     Buffer_buflen(str)   = new_size - sizeof (void *);
 
     /* We shouldn't ever have a 0 from size, but we do. If we can track down

Modified: branches/unshared_buffers/src/io/buffer.c
==============================================================================
--- branches/unshared_buffers/src/io/buffer.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/io/buffer.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -297,7 +297,7 @@
 
     s       = *buf;
     len     = s->bufused;
-    out_buf = (unsigned char *)s->strstart;
+    out_buf = (unsigned char *)Buffer_bufstart(s);
 
     /* read Data from buffer */
     if (buffer_flags & PIO_BF_READBUF) {
@@ -429,7 +429,7 @@
     }
 
     /* if we got any data, then copy out the next byte */
-    memmove(s->strstart, buffer_next, len);
+    memmove(Buffer_bufstart(s), buffer_next, len);
     s->bufused = s->strlen = len;
 
     return len;
@@ -498,14 +498,14 @@
         if (buffer_next == buffer_end) {
             len = buffer_end - buf_start;
             if (s->bufused < l) {
-                if (s->strstart) {
+                if (Buffer_bufstart(s)) {
                     Parrot_gc_reallocate_string_storage(interp, s, l);
                 }
                 else {
                     Parrot_gc_allocate_string_storage(interp, s, l);
                 }
             }
-            out_buf = (unsigned char*)s->strstart + s->strlen;
+            out_buf = (unsigned char*)Buffer_bufstart(s) + s->strlen;
             memcpy(out_buf, buf_start, len);
             s->strlen = s->bufused = l;
             if (Parrot_io_fill_readbuf(interp, filehandle) == 0)
@@ -517,14 +517,14 @@
         }
     }
     if (s->bufused < l) {
-        if (s->strstart) {
+        if (Buffer_bufstart(s)) {
             Parrot_gc_reallocate_string_storage(interp, s, l);
         }
         else {
             Parrot_gc_allocate_string_storage(interp, s, l);
         }
     }
-    out_buf = (unsigned char*)s->strstart + s->strlen;
+    out_buf = (unsigned char*)Buffer_bufstart(s) + s->strlen;
     len = buffer_next - buf_start;
     memcpy(out_buf, buf_start, len);
     s->strlen = s->bufused = l;
@@ -586,7 +586,7 @@
 
     if (Parrot_io_get_flags(interp, filehandle) & PIO_F_LINEBUF) {
         /* scan from end, it's likely that EOL is at end of string */
-        const char *p = (char*)(s->strstart) + len - 1;
+        const char *p = (char*)(Buffer_bufstart(s)) + len - 1;
         size_t      i;
 
         for (i = 0; i < len; ++i, --p) {
@@ -623,7 +623,7 @@
         buffer_flags |= PIO_BF_WRITEBUF;
         Parrot_io_set_buffer_flags(interp, filehandle, buffer_flags);
 
-        memmove(buffer_next, s->strstart, len);
+        memmove(buffer_next, Buffer_bufstart(s), len);
         buffer_next += len;
         Parrot_io_set_buffer_next(interp, filehandle, buffer_next);
         Parrot_io_set_file_position(interp, filehandle, (len +
@@ -637,7 +637,7 @@
         Parrot_io_set_buffer_flags(interp, filehandle, buffer_flags);
 
         /* Fill remainder, flush, then try to buffer more */
-        memmove(buffer_next, s->strstart, avail);
+        memmove(buffer_next, Buffer_bufstart(s), avail);
         buffer_next += avail;
         Parrot_io_set_buffer_next(interp, filehandle, buffer_next);
         Parrot_io_set_file_position(interp, filehandle, (avail +
@@ -648,7 +648,7 @@
         Parrot_io_set_buffer_flags(interp, filehandle, buffer_flags);
 
         buffer_next = Parrot_io_get_buffer_next(interp, filehandle);
-        memmove(buffer_start, (s->strstart + avail), diff);
+        memmove(buffer_start, (Buffer_bufstart(s) + avail), diff);
 
         buffer_next += diff;
         Parrot_io_set_buffer_next(interp, filehandle, buffer_next);

Modified: branches/unshared_buffers/src/io/filehandle.c
==============================================================================
--- branches/unshared_buffers/src/io/filehandle.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/io/filehandle.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -98,13 +98,13 @@
 
 =item 3
 
-Point to a fake STRING with (strstart, bufused) holding the *buffer
+Point to a fake STRING with (_bufstart, bufused) holding the *buffer
 information.
 
 =back
 
 In the third case, the buffer or STRING must be able to hold the required
-amount of data. For cases 1 and 2, a NULL C<strstart> tells this function to
+amount of data. For cases 1 and 2, a NULL C<_bufstart> tells this function to
 allocate the STRING memory.
 
 =cut

Modified: branches/unshared_buffers/src/io/portable.c
==============================================================================
--- branches/unshared_buffers/src/io/portable.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/io/portable.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -303,12 +303,12 @@
     STRING * const s     = Parrot_io_make_string(interp, buf, 1);
 
     /* read the next byte into the buffer */
-    const size_t   bytes = fread(s->strstart, 1, 1, fptr);
+    const size_t   bytes = fread(Buffer_bufstart(s), 1, 1, fptr);
 
     /* if we got anything from the stream, push it back on */
     if (bytes) {
         s->bufused = s->strlen = 1;
-        ungetc(*(char *)s->strstart, fptr);
+        ungetc(*(char *)Buffer_bufstart(s), fptr);
     }
     else
         s->bufused = s->strlen = 1;
@@ -406,7 +406,7 @@
 Parrot_io_write_portable(PARROT_INTERP, ARGIN(PMC *filehandle), ARGIN(const STRING *s))
 {
     ASSERT_ARGS(Parrot_io_write_portable)
-    const void * const buffer = s->strstart;
+    const void * const buffer = Buffer_bufstart(s);
     return fwrite(buffer, 1, s->bufused,
                   (FILE *)Parrot_io_get_os_handle(interp, filehandle));
 }

Modified: branches/unshared_buffers/src/io/socket_unix.c
==============================================================================
--- branches/unshared_buffers/src/io/socket_unix.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/io/socket_unix.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -297,7 +297,7 @@
     /*
      * Ignore encoding issues for now.
      */
-    if ((error = send(io->os_handle, (char *)s->strstart + byteswrote,
+    if ((error = send(io->os_handle, (char *)Buffer_bufstart(s) + byteswrote,
                     bytes, 0)) >= 0) {
         byteswrote += error;
         bytes -= error;

Modified: branches/unshared_buffers/src/io/socket_win32.c
==============================================================================
--- branches/unshared_buffers/src/io/socket_win32.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/io/socket_win32.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -247,7 +247,7 @@
     /*
      * Ignore encoding issues for now.
      */
-    if ((error = send((int)io->os_handle, (char *)s->strstart + byteswrote,
+    if ((error = send((int)io->os_handle, (char *)Buffer_bufstart(s) + byteswrote,
                     bytes, 0)) >= 0) {
         byteswrote += error;
         bytes -= error;

Modified: branches/unshared_buffers/src/io/unix.c
==============================================================================
--- branches/unshared_buffers/src/io/unix.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/io/unix.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -556,7 +556,7 @@
 {
     ASSERT_ARGS(Parrot_io_write_unix)
     const PIOHANDLE file_descriptor = Parrot_io_get_os_handle(interp, filehandle);
-    const char * const buffer = s->strstart;
+    const char * const buffer = Buffer_bufstart(s);
     const char * ptr          = buffer;
 
     size_t to_write = s->bufused;

Modified: branches/unshared_buffers/src/io/utf8.c
==============================================================================
--- branches/unshared_buffers/src/io/utf8.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/io/utf8.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -61,7 +61,7 @@
 
     while (iter.bytepos < s->bufused) {
         if (iter.bytepos + 4 > s->bufused) {
-            const utf8_t *u8ptr = (utf8_t *)((char *)s->strstart +
+            const utf8_t *u8ptr = (utf8_t *)((char *)Buffer_bufstart(s) +
                     iter.bytepos);
             const UINTVAL c = *u8ptr;
 

Modified: branches/unshared_buffers/src/io/win32.c
==============================================================================
--- branches/unshared_buffers/src/io/win32.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/io/win32.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -485,7 +485,7 @@
     ASSERT_ARGS(Parrot_io_write_win32)
     DWORD countwrote = 0;
     DWORD err;
-    void * const buffer = s->strstart;
+    void * const buffer = Buffer_bufstart(s);
     DWORD len = (DWORD) s->bufused;
     PIOHANDLE os_handle = Parrot_io_get_os_handle(interp, filehandle);
 

Modified: branches/unshared_buffers/src/library.c
==============================================================================
--- branches/unshared_buffers/src/library.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/library.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -342,7 +342,7 @@
 is_abs_path(ARGIN(const STRING *file))
 {
     ASSERT_ARGS(is_abs_path)
-    const char * const file_name = (const char *)file->strstart;
+    const char * const file_name = (const char *)Buffer_bufstart(file);
     if (file->strlen <= 1)
         return 0;
     PARROT_ASSERT(file->encoding == Parrot_fixed_8_encoding_ptr ||
@@ -385,7 +385,7 @@
     PARROT_ASSERT(path->encoding == Parrot_fixed_8_encoding_ptr ||
         path->encoding == Parrot_utf8_encoding_ptr);
 
-    cnv = path->strstart;
+    cnv = Buffer_bufstart(path);
     while ((cnv = strchr(cnv, path_separator)) != NULL)
         *cnv = win32_path_separator;
 }
@@ -753,7 +753,7 @@
 NULL otherwise.  Remember to free the string with C<Parrot_str_free_cstring()>.
 
 If successful, the returned STRING is 0-terminated so that
-C<result-E<gt>strstart> is usable as B<const char*> c-string for C library
+C<result-E<gt>_bufstart> is usable as B<const char*> c-string for C library
 functions like fopen(3).  This is the preferred API function.
 
 The C<enum_runtime_ft type> is one or more of the types defined in

Modified: branches/unshared_buffers/src/ops/string.ops
==============================================================================
--- branches/unshared_buffers/src/ops/string.ops	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/ops/string.ops	Mon Aug  9 21:06:55 2010	(r48364)
@@ -367,8 +367,8 @@
           case STRINGINFO_HEADER:
             $1 = PTR2UINTVAL($2);
             break;
-          case STRINGINFO_STRSTART:
-            $1 = PTR2UINTVAL($2->strstart);
+          case STRINGINFO_BUFSTART:
+            $1 = PTR2UINTVAL(Buffer_bufstart($2));
             break;
           case STRINGINFO_BUFLEN:
             $1 = Buffer_buflen($2);

Modified: branches/unshared_buffers/src/packfile/pf_items.c
==============================================================================
--- branches/unshared_buffers/src/packfile/pf_items.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/packfile/pf_items.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -1250,9 +1250,9 @@
 
     *cursor++ = s->bufused;
 
-    if (s->strstart) {
+    if (Buffer_bufstart(s)) {
         char *charcursor = (char *) cursor;
-        mem_sys_memcopy(charcursor, s->strstart, s->bufused);
+        mem_sys_memcopy(charcursor, Buffer_bufstart(s), s->bufused);
         charcursor += s->bufused;
 
         /* Pad up to wordsize boundary. */
@@ -1354,7 +1354,7 @@
 
     /* print only printable characters */
     TRACE_PRINTF_VAL(("PF_fetch_string(): string is '%s' at 0x%x\n",
-                      s->strstart, OFFS(pf, *cursor)));
+                      Buffer_bufstart(s), OFFS(pf, *cursor)));
 
     TRACE_PRINTF_ALIGN(("-s ROUND_UP_B: cursor=0x%x, size=%d, wordsize=%d\n",
                         (const char *)*cursor + size, size, wordsize));
@@ -1422,8 +1422,8 @@
      * characters to ensure padding.  */
     charcursor = (char *)cursor;
 
-    if (s->strstart) {
-        mem_sys_memcopy(charcursor, s->strstart, s->bufused);
+    if (Buffer_bufstart(s)) {
+        mem_sys_memcopy(charcursor, Buffer_bufstart(s), s->bufused);
         charcursor += s->bufused;
         /* Pad up to sizeof (opcode_t) boundary. */
         while ((unsigned long) (charcursor - (char *) cursor) % sizeof (opcode_t)) {

Modified: branches/unshared_buffers/src/pmc/bytebuffer.pmc
==============================================================================
--- branches/unshared_buffers/src/pmc/bytebuffer.pmc	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/pmc/bytebuffer.pmc	Mon Aug  9 21:06:55 2010	(r48364)
@@ -153,7 +153,7 @@
                     if (size > 0) {
                         STRING * source;
                         GET_ATTR_source(INTERP, SELF, source);
-                        memcpy(content, source->strstart, copysize);
+                        memcpy(content, Buffer_bufstart(source), copysize);
                     }
                     SET_ATTR_source(INTERP, SELF, STRINGNULL);
                 }
@@ -192,7 +192,7 @@
         }
         SET_ATTR_source(INTERP, SELF, new_string);
         SET_ATTR_size(INTERP, SELF, Parrot_str_byte_length(INTERP, new_string));
-        SET_ATTR_content(INTERP, SELF, (unsigned char *)new_string->strstart);
+        SET_ATTR_content(INTERP, SELF, (unsigned char *)Buffer_bufstart(new_string));
     }
 
 /*
@@ -243,7 +243,7 @@
                     INTVAL srclen = Parrot_str_byte_length(INTERP, source);
                     if (srclen < copysize)
                         copysize = srclen;
-                    memcpy(content, source->strstart, copysize);
+                    memcpy(content, Buffer_bufstart(source), copysize);
                     SET_ATTR_source(INTERP, SELF, STRINGNULL);
                 }
             }

Modified: branches/unshared_buffers/src/pmc/eval.pmc
==============================================================================
--- branches/unshared_buffers/src/pmc/eval.pmc	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/pmc/eval.pmc	Mon Aug  9 21:06:55 2010	(r48364)
@@ -300,10 +300,10 @@
                                          aligned_size);
         res->strlen  = res->bufused = size;
 
-        if ((size_t)(res->strstart) & 0xf) {
-            char *adr     = res->strstart;
+        if ((size_t)(Buffer_bufstart(res)) & 0xf) {
+            char *adr     = Buffer_bufstart(res);
             adr          += 16 - ((size_t)adr & 0xf);
-            res->strstart = adr;
+            Buffer_bufstart(res) = adr;
         }
 
         /* We block GC while doing the packing, since GC run during a pack
@@ -312,7 +312,7 @@
            for example of the problem (note on line that
            segfaults, it is *cursor that is pointing to dealloced memory). */
         Parrot_block_GC_mark(INTERP);
-        PackFile_pack(INTERP, pf, (opcode_t *)res->strstart);
+        PackFile_pack(INTERP, pf, (opcode_t *)Buffer_bufstart(res));
         Parrot_unblock_GC_mark(INTERP);
 
         /* now remove all segments from directory again and destroy
@@ -368,7 +368,7 @@
         SUPER(info);
         pf = PackFile_new(INTERP, 0);
 
-        if (!PackFile_unpack(INTERP, pf, (opcode_t *)packed->strstart,
+        if (!PackFile_unpack(INTERP, pf, (opcode_t *)Buffer_bufstart(packed),
                 packed->strlen))
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_EXTERNAL_ERROR,
                 "couldn't unpack packfile");

Modified: branches/unshared_buffers/src/pmc/filehandle.pmc
==============================================================================
--- branches/unshared_buffers/src/pmc/filehandle.pmc	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/pmc/filehandle.pmc	Mon Aug  9 21:06:55 2010	(r48364)
@@ -373,7 +373,7 @@
 
 #ifdef PARROT_HAS_READLINE
     /* 4-column indent to get c_indent.t to DTRT */
-        char * const r = readline(got_prompt ? prompt->strstart : NULL);
+        char * const r = readline(got_prompt ? Buffer_bufstart(prompt) : NULL);
 
         if (r) {
             if (*r)
@@ -384,7 +384,7 @@
         }
 #else
         if (got_prompt)
-            fprintf(stderr, "%s", prompt->strstart);
+            fprintf(stderr, "%s", Buffer_bufstart(prompt));
 
         if (!(PARROT_FILEHANDLE(SELF)->flags & PIO_F_LINEBUF))
             Parrot_io_setlinebuf(INTERP, SELF);
@@ -397,8 +397,8 @@
                 string_result = NULL;
             else {
                 while (len > 0
-                &&    (((char *)string_result->strstart)[len - 1] == '\n'
-                  ||   ((char *)string_result->strstart)[len - 1] == '\r')) {
+                &&    (((char *)Buffer_bufstart(string_result))[len - 1] == '\n'
+                  ||   ((char *)Buffer_bufstart(string_result)[len - 1] == '\r')) {
                         --len;
                         --string_result->strlen;
                         --string_result->bufused;

Modified: branches/unshared_buffers/src/pmc/string.pmc
==============================================================================
--- branches/unshared_buffers/src/pmc/string.pmc	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/pmc/string.pmc	Mon Aug  9 21:06:55 2010	(r48364)
@@ -697,7 +697,7 @@
                 "Can't translate non-ascii");
 
         dest = Parrot_str_clone(INTERP, src);
-        p = (unsigned char *)(dest->strstart);
+        p = (unsigned char *)(Buffer_bufstart(dest));
         /* TODO verify trans table */
 
         GETATTR_FixedIntegerArray_int_array(INTERP, table, tr_data);

Modified: branches/unshared_buffers/src/pmc/stringbuilder.pmc
==============================================================================
--- branches/unshared_buffers/src/pmc/stringbuilder.pmc	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/pmc/stringbuilder.pmc	Mon Aug  9 21:06:55 2010	(r48364)
@@ -67,7 +67,7 @@
         buffer->charset   = Parrot_default_charset_ptr;
         /* We need all string flags here because we use this buffer in substr_str */
         buffer->flags     = PObj_is_string_FLAG | PObj_live_FLAG | PObj_external_FLAG;
-        Buffer_bufstart(buffer)t = buffer->strstart = mem_gc_allocate_n_typed(INTERP,
+        Buffer_bufstart(buffer) = mem_gc_allocate_n_typed(INTERP,
                 initial_size, char);
         Buffer_buflen(buffer) = initial_size;
 
@@ -147,7 +147,7 @@
             STRUCT_COPY(buffer, new_buffer);
             buffer->flags     = PObj_is_string_FLAG | PObj_live_FLAG | PObj_external_FLAG;
 
-            Buffer_bufstart(buffer) = buffer->strstart = mem_gc_allocate_n_typed(INTERP,
+            Buffer_bufstart(buffer) = mem_gc_allocate_n_typed(INTERP,
                                                     Buffer_buflen(new_buffer), char);
             mem_sys_memcopy(Buffer_bufstart(buffer), Buffer_bufstart(new_buffer),
                 Buffer_buflen(new_buffer));
@@ -163,14 +163,14 @@
         /* Reallocate if necessary */
         if (total_size > Buffer_buflen(buffer)) {
             /* Parrot_unicode_charset_ptr can produce NULL buffer */
-            Buffer_bufstart(buffer) = buffer->strstart = mem_gc_realloc_n_typed(INTERP,
+            Buffer_bufstart(buffer) = mem_gc_realloc_n_typed(INTERP,
                 Buffer_bufstart(buffer), total_size, char);
             Buffer_buflen(buffer)   = total_size;
         }
 
         /* Tack s on the end of buffer */
-        mem_sys_memcopy((void *)((ptrcast_t)buffer->strstart + buffer->bufused),
-                s->strstart, s->bufused);
+        mem_sys_memcopy((void *)((ptrcast_t)Buffer_bufstart(buffer) + buffer->bufused),
+                Buffer_bufstart(s), s->bufused);
 
         /* Update buffer */
         buffer->bufused += s->bufused;
@@ -225,14 +225,14 @@
 
         /* Reallocate if necessary */
         if (total_size > Buffer_buflen(buffer)) {
-            Buffer_bufstart(buffer) = buffer->strstart = mem_gc_realloc_n_typed(INTERP,
+            Buffer_bufstart(buffer) = mem_gc_realloc_n_typed(INTERP,
                     Buffer_bufstart(buffer), total_size, char);
             Buffer_buflen(buffer)   = total_size;
         }
 
         /* Tack s on the buffer */
-        mem_sys_memcopy((void *)((ptrcast_t)buffer->strstart),
-                s->strstart, s->bufused);
+        mem_sys_memcopy((void *)((ptrcast_t)Buffer_bufstart(buffer)),
+                Buffer_bufstart(s), s->bufused);
 
         /* Update buffer */
         buffer->bufused  = s->bufused;

Modified: branches/unshared_buffers/src/string/api.c
==============================================================================
--- branches/unshared_buffers/src/string/api.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/string/api.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -360,7 +360,7 @@
     Parrot_gc_allocate_string_storage(interp, result, alloc_size);
 
     /* and copy it over */
-    mem_sys_memcopy(result->strstart, s->strstart, alloc_size);
+    mem_sys_memcopy(Buffer_bufstart(result), Buffer_bufstart(s), alloc_size);
 
     return result;
 }
@@ -461,11 +461,11 @@
     dest->charset  = cs;
 
     /* Copy A first */
-    mem_sys_memcopy(dest->strstart, a->strstart, a->bufused);
+    mem_sys_memcopy(Buffer_bufstart(dest), Buffer_bufstart(a), a->bufused);
 
     /* Tack B on the end of A */
-    mem_sys_memcopy((void *)((ptrcast_t)dest->strstart + a->bufused),
-            b->strstart, b->bufused);
+    mem_sys_memcopy((void *)((ptrcast_t)Buffer_bufstart(dest) + a->bufused),
+            Buffer_bufstart(b), b->bufused);
 
     dest->bufused = a->bufused + b->bufused;
     dest->strlen  = a->strlen + b_len;
@@ -527,7 +527,6 @@
     STRING * const result   = Parrot_gc_new_string_header(interp, 0);
     Buffer_bufstart(result) = Buffer_bufstart(buffer);
     Buffer_buflen(result)   = Buffer_buflen(buffer);
-    result->strstart        = (char *)Buffer_bufstart(result);
     result->bufused         = len;
     result->strlen          = len;
     result->encoding        = Parrot_fixed_8_encoding_ptr;
@@ -739,7 +738,7 @@
            it was safe by setting PObj_external_FLAG.
            (The cast is necessary to pacify TenDRA's tcc.)
            */
-        Buffer_bufstart(s) = s->strstart = PARROT_const_cast(char *, buffer);
+        Buffer_bufstart(s) = PARROT_const_cast(void *, buffer);
         Buffer_buflen(s)   = s->bufused  = len;
 
         if (encoding == Parrot_fixed_8_encoding_ptr)
@@ -753,7 +752,7 @@
     Parrot_gc_allocate_string_storage(interp, s, len);
 
     if (buffer) {
-        mem_sys_memcopy(s->strstart, buffer, len);
+        mem_sys_memcopy(Buffer_bufstart(s), buffer, len);
         s->bufused = len;
         if (encoding == Parrot_fixed_8_encoding_ptr)
             s->strlen = len;
@@ -1020,8 +1019,8 @@
         /* copy s into dest num times */
         UINTVAL length = s->bufused;
         UINTVAL i;
-        char *             destpos = dest->strstart;
-        const char * const srcpos  = s->strstart;
+        char *             destpos = Buffer_bufstart(dest);
+        const char * const srcpos  = Buffer_bufstart(s);
         for (i = 0; i < num; ++i) {
             mem_sys_memcopy(destpos, srcpos, length);
             destpos += length;
@@ -1197,15 +1196,15 @@
     dest->bufused = buf_size;
 
     /* Copy begin of string */
-    mem_sys_memcopy(dest->strstart, src->strstart, start_byte);
+    mem_sys_memcopy(Buffer_bufstart(dest), Buffer_bufstart(src), start_byte);
 
     /* Copy the replacement in */
-    mem_sys_memcopy((char *)dest->strstart + start_byte, rep->strstart,
+    mem_sys_memcopy((char *)Buffer_bufstart(dest) + start_byte, Buffer_bufstart(rep),
             rep->bufused);
 
     /* Copy the end of old string */
-    mem_sys_memcopy((char *)dest->strstart + start_byte + rep->bufused,
-            (char *)src->strstart + end_byte,
+    mem_sys_memcopy((char *)Buffer_bufstart(dest) + start_byte + rep->bufused,
+            (char *)Buffer_bufstart(src) + end_byte,
             src->bufused - end_byte);
 
     dest->strlen  = CHARSET_CODEPOINTS(interp, dest);
@@ -1344,7 +1343,7 @@
         return 1;
 
     /* COWed strings */
-    else if ((s1->strstart == s2->strstart) && (s1->bufused == s2->bufused))
+    else if ((Buffer_bufstart(s1) == Buffer_bufstart(s2)) && (s1->bufused == s2->bufused))
         return 1;
 
     /*
@@ -1412,9 +1411,9 @@
 #endif
 
     { /* bitwise AND the strings */
-        const Parrot_UInt1 *curr1 = (Parrot_UInt1 *)s1->strstart;
-        const Parrot_UInt1 *curr2 = (Parrot_UInt1 *)s2->strstart;
-        Parrot_UInt1       *dp    = (Parrot_UInt1 *)res->strstart;
+        const Parrot_UInt1 *curr1 = (Parrot_UInt1 *)Buffer_bufstart(s1);
+        const Parrot_UInt1 *curr2 = (Parrot_UInt1 *)Buffer_bufstart(s2);
+        Parrot_UInt1       *dp    = (Parrot_UInt1 *)Buffer_bufstart(res);
         size_t              len   = minlen;
 
         while (len--)
@@ -1437,15 +1436,15 @@
     size_t       _index; \
  \
     if (!STRING_IS_NULL(s1)) { \
-        curr1   = (type1 *)(s1)->strstart; \
+        curr1   = (type1 *)Buffer_bufstart(s1); \
         length1 = (s1)->strlen; \
     } \
     if (!STRING_IS_NULL(s2)) { \
-        curr2   = (type2 *)(s2)->strstart; \
+        curr2   = (type2 *)Buffer_bufstart(s2); \
         length2 = (s2)->strlen; \
     } \
  \
-    dp = (restype *)(res)->strstart; \
+    dp = (restype *)Buffer_bufstart(res); \
     _index = 0; \
  \
     for (; _index < (maxlen) ; ++curr1, ++curr2, ++dp, ++_index) { \
@@ -1472,15 +1471,15 @@
     size_t       _index; \
  \
     if (!STRING_IS_NULL(s1)) { \
-        curr1   = (type1 *)(s1)->strstart; \
+        curr1   = (type1 *)Buffer_bufstart(s1); \
         length1 = (s1)->strlen; \
     } \
     if (!STRING_IS_NULL(s2)) { \
-        curr2   = (type2 *)(s2)->strstart; \
+        curr2   = (type2 *)Buffer_bufstart(s2); \
         length2 = (s2)->strlen; \
     } \
  \
-    dp = (restype *)(res)->strstart; \
+    dp = (restype *)Buffer_bufstart(res); \
     _index = 0; \
  \
     for (; _index < (maxlen) ; ++curr1, ++curr2, ++dp, ++_index) { \
@@ -1632,9 +1631,9 @@
 #define BITWISE_NOT_STRING(type, s, res) \
 do { \
     if (!STRING_IS_NULL(s) && !STRING_IS_NULL(res)) { \
-        const type   *curr   = (type *)(s)->strstart; \
+        const type   *curr   = (type *)Buffer_bufstart(s); \
         size_t        length = (s)->strlen; \
-        Parrot_UInt1 *dp     = (Parrot_UInt1 *)(res)->strstart; \
+        Parrot_UInt1 *dp     = (Parrot_UInt1 *)Buffer_bufstart(res); \
  \
         for (; length ; --length, ++dp, ++curr) \
             *dp = 0xFF & ~ *curr; \
@@ -2165,7 +2164,7 @@
         return NULL;
     else {
         char * const p = (char*)mem_internal_allocate(s->bufused + 1);
-        memcpy(p, s->strstart, s->bufused);
+        memcpy(p, Buffer_bufstart(s), s->bufused);
         p[s->bufused] = '\0';
         return p;
     }
@@ -2214,7 +2213,6 @@
 
     mem_sys_memcopy(memory, Buffer_bufstart(s), size);
     Buffer_bufstart(s) = memory;
-    s->strstart        = memory;
 
     /* Mark the memory as both from the system and immobile */
     PObj_sysmem_SET(s);
@@ -2374,7 +2372,7 @@
 
     /* more work TODO */
     ENCODING_ITER_INIT(interp, src, &iter);
-    dp = (unsigned char *)result->strstart;
+    dp = (unsigned char *)Buffer_bufstart(result);
 
     for (i = 0; len > 0; --len) {
         UINTVAL c = iter.get_and_advance(interp, &iter);
@@ -2385,7 +2383,7 @@
                 charlen += len * 2 + 16;
                 Parrot_gc_reallocate_string_storage(interp, result, charlen);
                 /* start can change */
-                dp = (unsigned char *)result->strstart;
+                dp = (unsigned char *)Buffer_bufstart(result);
             }
             switch (c) {
               case '\\':
@@ -2448,7 +2446,7 @@
 
         /* and usable len */
         charlen = Buffer_buflen(result);
-        dp      = (unsigned char *)result->strstart;
+        dp      = (unsigned char *)Buffer_bufstart(result);
 
         PARROT_ASSERT(i <= charlen);
     }
@@ -2709,7 +2707,7 @@
     encoding->iter_init(interp, result, &iter);
 
     for (offs = d = 0; offs < clength; ++offs) {
-        r = (Parrot_UInt4)((unsigned char *)result->strstart)[offs];
+        r = (Parrot_UInt4)((unsigned char *)Buffer_bufstart(result))[offs];
 
         /* There cannot be any NULs within this string.  */
         PARROT_ASSERT(r != '\0');
@@ -2893,7 +2891,7 @@
 {
     ASSERT_ARGS(Parrot_str_cstring)
     /* TODO handle NULL and friends */
-    return str->strstart;
+    return Buffer_bufstart(str);
 }
 
 
@@ -3172,12 +3170,12 @@
     res->encoding = j->encoding;
 
     /* Iterate over chunks and append it to res */
-    pos = res->strstart;
+    pos = Buffer_bufstart(res);
 
     /* Copy first chunk */
     s = chunks[0];
     if (!STRING_IS_NULL(s)) {
-        mem_sys_memcopy(pos, s->strstart, s->bufused);
+        mem_sys_memcopy(pos, Buffer_bufstart(s), s->bufused);
         pos += s->bufused;
     }
 
@@ -3187,17 +3185,17 @@
         if (STRING_IS_NULL(next))
             continue;
 
-        mem_sys_memcopy(pos, j->strstart, j->bufused);
+        mem_sys_memcopy(pos, Buffer_bufstart(j), j->bufused);
         pos += j->bufused;
 
-        mem_sys_memcopy(pos, next->strstart, next->bufused);
+        mem_sys_memcopy(pos, Buffer_bufstart(next), next->bufused);
         pos += next->bufused;
 
         /* We can consume all buffer and pos will be next-after-end of buffer */
-        PARROT_ASSERT(pos <= res->strstart + Buffer_buflen(res) + 1);
+        PARROT_ASSERT(pos <= Buffer_bufstart(res) + Buffer_buflen(res) + 1);
     }
 
-    res->bufused  = pos - res->strstart;
+    res->bufused  = pos - Buffer_bufstart(res);
     res->strlen = CHARSET_CODEPOINTS(interp, res);
 
     Parrot_gc_free_fixed_size_storage(interp, ar_len * sizeof (STRING *),

Modified: branches/unshared_buffers/src/string/charset/ascii.c
==============================================================================
--- branches/unshared_buffers/src/string/charset/ascii.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/string/charset/ascii.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -208,7 +208,7 @@
     /* the string can't grow. Just clone it */
     STRING * const dest = Parrot_str_clone(interp, src);
 
-    p = (unsigned char *)dest->strstart;
+    p = (unsigned char *)Buffer_bufstart(dest);
     ENCODING_ITER_INIT(interp, src, &iter);
     for (offs = 0; offs < len; ++offs) {
         const UINTVAL c = iter.get_and_advance(interp, &iter);
@@ -313,7 +313,7 @@
     const UINTVAL n = src->strlen;
 
     if (n) {
-        char * const buffer = result->strstart;
+        char * const buffer = Buffer_bufstart(result);
         UINTVAL offset;
 
         for (offset = 0; offset < n; ++offset) {
@@ -343,7 +343,7 @@
     const UINTVAL n      = src->strlen;
 
     if (n) {
-        char * const buffer = result->strstart;
+        char * const buffer = Buffer_bufstart(result);
         UINTVAL offset;
 
         for (offset = 0; offset < n; ++offset) {
@@ -375,7 +375,7 @@
     const UINTVAL n      = src->strlen;
 
     if (n) {
-        char * const buffer = result->strstart;
+        char * const buffer = Buffer_bufstart(result);
         UINTVAL offset;
 
         buffer[0] = (char)toupper((unsigned char)buffer[0]);
@@ -406,7 +406,7 @@
     STRING * const result = Parrot_str_clone(interp, src);
 
     if (result->strlen > 0) {
-        char * const buffer = result->strstart;
+        char * const buffer = Buffer_bufstart(result);
         buffer[0] = (char)toupper((unsigned char)buffer[0]);
     }
 
@@ -432,7 +432,7 @@
     STRING * const result = Parrot_str_clone(interp, src);
 
     if (result->strlen > 0) {
-        char * const buffer = result->strstart;
+        char * const buffer = Buffer_bufstart(result);
         buffer[0] = (char)tolower((unsigned char)buffer[0]);
     }
 
@@ -458,7 +458,7 @@
     STRING * const result = Parrot_str_clone(interp, src);
 
     if (result->strlen > 0) {
-        char * const buffer = result->strstart;
+        char * const buffer = Buffer_bufstart(result);
         buffer[0] = (char)toupper((unsigned char)buffer[0]);
     }
 
@@ -488,7 +488,7 @@
     String_iter iter;
 
     if (lhs->encoding == rhs->encoding) {
-        const int ret_val = memcmp(lhs->strstart, rhs->strstart, min_len);
+        const int ret_val = memcmp(Buffer_bufstart(lhs), Buffer_bufstart(rhs), min_len);
         if (ret_val)
             return ret_val < 0 ? -1 : 1;
     }
@@ -773,7 +773,7 @@
 {
     ASSERT_ARGS(ascii_compute_hash)
     size_t hashval = seed;
-    const char *buffptr = (const char *)src->strstart;
+    const char *buffptr = (const char *)Buffer_bufstart(src);
     UINTVAL len = src->strlen;
 
     PARROT_ASSERT(src->encoding == Parrot_fixed_8_encoding_ptr);

Modified: branches/unshared_buffers/src/string/charset/binary.c
==============================================================================
--- branches/unshared_buffers/src/string/charset/binary.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/string/charset/binary.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -329,7 +329,7 @@
     if (l_len != r_len)
         return l_len - r_len;
 
-    return memcmp(lhs->strstart, rhs->strstart, l_len);
+    return memcmp(Buffer_bufstart(lhs), Buffer_bufstart(rhs), l_len);
 }
 
 /*

Modified: branches/unshared_buffers/src/string/charset/iso-8859-1.c
==============================================================================
--- branches/unshared_buffers/src/string/charset/iso-8859-1.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/string/charset/iso-8859-1.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -330,7 +330,7 @@
     if (!result->strlen)
         return result;
 
-    buffer = (unsigned char *)result->strstart;
+    buffer = (unsigned char *)Buffer_bufstart(result);
     for (offset = 0; offset < result->strlen; ++offset) {
         unsigned int c = buffer[offset]; /* XXX use encoding ? */
         if (c >= 0xe0 && c != 0xf7)
@@ -366,7 +366,7 @@
     if (!result->strlen)
         return result;
 
-    buffer = (unsigned char *)result->strstart;
+    buffer = (unsigned char *)Buffer_bufstart(result);
     for (offset = 0; offset < result->strlen; ++offset) {
         unsigned int c = buffer[offset];
         if (c >= 0xc0 && c != 0xd7 && c <= 0xde)
@@ -403,7 +403,7 @@
     if (!result->strlen)
         return result;
 
-    buffer = (unsigned char *)result->strstart;
+    buffer = (unsigned char *)Buffer_bufstart(result);
     c = buffer[0];
     if (c >= 0xe0 && c != 0xf7)
         c &= ~0x20;
@@ -446,7 +446,7 @@
     if (!result->strlen)
         return result;
 
-    buffer = (unsigned char *)result->strstart;
+    buffer = (unsigned char *)Buffer_bufstart(result);
     c = buffer[0];
     if (c >= 0xe0 && c != 0xf7)
         c &= ~0x20;
@@ -480,7 +480,7 @@
     if (!result->strlen)
         return result;
 
-    buffer = (unsigned char *)result->strstart;
+    buffer = (unsigned char *)Buffer_bufstart(result);
     c = buffer[0];
     if (c >= 0xc0 && c != 0xd7 && c <= 0xde)
         c &= ~0x20;

Modified: branches/unshared_buffers/src/string/charset/unicode.c
==============================================================================
--- branches/unshared_buffers/src/string/charset/unicode.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/string/charset/unicode.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -280,22 +280,22 @@
             src->encoding, src->charset, 0);
 
     err      = U_ZERO_ERROR;
-    dest_len = unorm_normalize((UChar *)src->strstart, src_len,
+    dest_len = unorm_normalize((UChar *)Buffer_bufstart(src), src_len,
             UNORM_DEFAULT,      /* default is NFC */
             0,                  /* options 0 default - no specific icu
                                  * version */
-            (UChar *)dest->strstart, dest_len, &err);
+            (UChar *)Buffer_bufstart(dest), dest_len, &err);
 
     dest->bufused = dest_len * sizeof (UChar);
 
     if (!U_SUCCESS(err)) {
         err = U_ZERO_ERROR;
         Parrot_gc_reallocate_string_storage(interp, dest, dest->bufused);
-        dest_len = unorm_normalize((UChar *)src->strstart, src_len,
+        dest_len = unorm_normalize((UChar *)Buffer_bufstart(src), src_len,
                 UNORM_DEFAULT,      /* default is NFC */
                 0,                  /* options 0 default - no specific
                                      * icu version */
-                (UChar *)dest->strstart, dest_len, &err);
+                (UChar *)Buffer_bufstart(dest), dest_len, &err);
         PARROT_ASSERT(U_SUCCESS(err));
         dest->bufused = dest_len * sizeof (UChar);
     }
@@ -392,7 +392,7 @@
      *  TODO downcase, titlecase
      */
     needed = u_strToUpper(NULL, 0,
-            (UChar *)res->strstart, src_len,
+            (UChar *)Buffer_bufstart(res), src_len,
             NULL,       /* locale = default */
             &err);
 
@@ -402,8 +402,8 @@
     }
 
     err      = U_ZERO_ERROR;
-    dest_len = u_strToUpper((UChar *)res->strstart, dest_len,
-            (UChar *)res->strstart, src_len,
+    dest_len = u_strToUpper((UChar *)Buffer_bufstart(res), dest_len,
+            (UChar *)Buffer_bufstart(res), src_len,
             NULL,       /* locale = default */
             &err);
     PARROT_ASSERT(U_SUCCESS(err));
@@ -469,8 +469,8 @@
      */
     err      = U_ZERO_ERROR;
     src_len  = res->bufused / sizeof (UChar);
-    dest_len = u_strToLower((UChar *)res->strstart, src_len,
-            (UChar *)res->strstart, src_len,
+    dest_len = u_strToLower((UChar *)Buffer_bufstart(res), src_len,
+            (UChar *)Buffer_bufstart(res), src_len,
             NULL,       /* locale = default */
             &err);
     res->bufused = dest_len * sizeof (UChar);
@@ -478,8 +478,8 @@
     if (!U_SUCCESS(err)) {
         err = U_ZERO_ERROR;
         Parrot_gc_reallocate_string_storage(interp, res, res->bufused);
-        dest_len = u_strToLower((UChar *)res->strstart, dest_len,
-                (UChar *)res->strstart, src_len,
+        dest_len = u_strToLower((UChar *)Buffer_bufstart(res), dest_len,
+                (UChar *)Buffer_bufstart(res), src_len,
                 NULL,       /* locale = default */
                 &err);
         PARROT_ASSERT(U_SUCCESS(err));
@@ -540,8 +540,8 @@
 
     err      = U_ZERO_ERROR;
     src_len  = res->bufused / sizeof (UChar);
-    dest_len = u_strToTitle((UChar *)res->strstart, src_len,
-            (UChar *)res->strstart, src_len,
+    dest_len = u_strToTitle((UChar *)Buffer_bufstart(res), src_len,
+            (UChar *)Buffer_bufstart(res), src_len,
             NULL,       /* default titleiter */
             NULL,       /* locale = default */
             &err);
@@ -550,8 +550,8 @@
     if (!U_SUCCESS(err)) {
         err = U_ZERO_ERROR;
         Parrot_gc_reallocate_string_storage(interp, res, res->bufused);
-        dest_len = u_strToTitle((UChar *)res->strstart, dest_len,
-                (UChar *)res->strstart, src_len,
+        dest_len = u_strToTitle((UChar *)Buffer_bufstart(res), dest_len,
+                (UChar *)Buffer_bufstart(res), src_len,
                 NULL, NULL,
                 &err);
         PARROT_ASSERT(U_SUCCESS(err));

Modified: branches/unshared_buffers/src/string/encoding/fixed_8.c
==============================================================================
--- branches/unshared_buffers/src/string/encoding/fixed_8.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/string/encoding/fixed_8.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -218,7 +218,7 @@
 INTVAL flags, UINTVAL pos, UINTVAL end)
 {
     ASSERT_ARGS(find_cclass)
-    const unsigned char *contents = (const unsigned char *)s->strstart;
+    const unsigned char *contents = (const unsigned char *)Buffer_bufstart(s);
     for (; pos < end; ++pos) {
         if ((typetable[contents[pos]] & flags) != 0) {
             return pos;
@@ -243,7 +243,7 @@
 get_byte(SHIM_INTERP, ARGIN(const STRING *src), UINTVAL offset)
 {
     ASSERT_ARGS(get_byte)
-    const unsigned char *contents = (const unsigned char *)src->strstart;
+    const unsigned char *contents = (const unsigned char *)Buffer_bufstart(src);
 
     if (offset >= src->bufused) {
 /*        Parrot_ex_throw_from_c_args(interp, NULL, 0,
@@ -276,7 +276,7 @@
         Parrot_ex_throw_from_c_args(interp, NULL, 0,
             "set_byte past the end of the buffer");
 
-    contents = (unsigned char *)src->strstart;
+    contents = (unsigned char *)Buffer_bufstart(src);
     contents[offset] = (unsigned char)byte;
 }
 
@@ -327,7 +327,7 @@
     dst->charset  = src->charset;
     dst->bufused  = dst->strlen = count;
     Parrot_gc_allocate_string_storage(interp, dst, count);
-    mem_sys_memcopy(dst->strstart, src->strstart + offset, count);
+    mem_sys_memcopy(Buffer_bufstart(dst), Buffer_bufstart(src) + offset, count);
     return dst;
 }
 
@@ -467,7 +467,7 @@
 fixed_8_hash(SHIM_INTERP, ARGIN(const STRING *s), size_t hashval)
 {
     ASSERT_ARGS(fixed_8_hash)
-    const unsigned char *pos = (const unsigned char *)s->strstart;
+    const unsigned char *pos = (const unsigned char *)Buffer_bufstart(s);
     UINTVAL        len = s->strlen;
 
     while (len--) {

Modified: branches/unshared_buffers/src/string/encoding/ucs2.c
==============================================================================
--- branches/unshared_buffers/src/string/encoding/ucs2.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/string/encoding/ucs2.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -220,7 +220,7 @@
 {
     ASSERT_ARGS(get_codepoint)
 #if PARROT_HAS_ICU
-    const UChar * const s = (const UChar*) src->strstart;
+    const UChar * const s = (const UChar*) Buffer_bufstart(src);
     UNUSED(interp);
     return s[offset];
 #else
@@ -314,7 +314,7 @@
 {
     ASSERT_ARGS(get_codepoints)
 #if PARROT_HAS_ICU
-    return Parrot_str_new_init(interp, src->strstart + offset * sizeof (UChar),
+    return Parrot_str_new_init(interp, Buffer_bufstart(src) + offset * sizeof (UChar),
         count * sizeof (UChar), src->encoding, src->charset, PObj_get_FLAGS(src));
 #else
     UNUSED(src);
@@ -404,7 +404,7 @@
     ASSERT_ARGS(ucs2_decode_and_advance)
 
 #if PARROT_HAS_ICU
-    const UChar * const s = (const UChar*) i->str->strstart;
+    const UChar * const s = (const UChar*) Buffer_bufstart(i->str);
     size_t pos = i->bytepos / sizeof (UChar);
 
     /* TODO either make sure that we don't go past end or use SAFE
@@ -442,7 +442,7 @@
     ASSERT_ARGS(ucs2_encode_and_advance)
 
 #if PARROT_HAS_ICU
-    UChar    *s = (UChar*) i->str->strstart;
+    UChar    *s = (UChar*) Buffer_bufstart(i->str);
     UINTVAL pos = i->bytepos / sizeof (UChar);
     s[pos++]    = (UChar)c;
     ++i->charpos;
@@ -472,7 +472,7 @@
 {
     ASSERT_ARGS(ucs2_hash)
 #if PARROT_HAS_ICU
-    const UChar *pos = (const UChar*) s->strstart;
+    const UChar *pos = (const UChar*) Buffer_bufstart(s);
     UINTVAL len = s->strlen;
     UNUSED(interp);
 

Modified: branches/unshared_buffers/src/string/encoding/ucs4.c
==============================================================================
--- branches/unshared_buffers/src/string/encoding/ucs4.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/string/encoding/ucs4.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -203,7 +203,7 @@
         UINTVAL len = Parrot_str_length(interp, src);
         STRING *res = Parrot_str_new_init(interp, NULL, len * sizeof (UChar32),
                            Parrot_ucs4_encoding_ptr, Parrot_unicode_charset_ptr, 0);
-        UChar32 *buf = (UChar32 *) res->strstart;
+        UChar32 *buf = (UChar32 *) Buffer_bufstart(res);
         UINTVAL offs;
         for (offs = 0; offs < len; offs++){
             buf[offs] = src->encoding->get_codepoint(interp, src, offs);
@@ -236,7 +236,7 @@
 {
     ASSERT_ARGS(get_codepoint)
 #if PARROT_HAS_ICU
-    const UChar32 * const s = (const UChar32*) src->strstart;
+    const UChar32 * const s = (const UChar32*) Buffer_bufstart(src);
     UNUSED(interp);
     return s[offset];
 #else
@@ -336,7 +336,7 @@
 {
     ASSERT_ARGS(get_codepoints)
 #if PARROT_HAS_ICU
-    return Parrot_str_new_init(interp, (char*)src->strstart + offset * sizeof (UChar32),
+    return Parrot_str_new_init(interp, (char*)Buffer_bufstart(src) + offset * sizeof (UChar32),
                                count * sizeof (UChar32), src->encoding, src->charset, 0);
 #else
     UNUSED(src);
@@ -427,7 +427,7 @@
 {
     ASSERT_ARGS(ucs4_decode_and_advance)
 #if PARROT_HAS_ICU
-    const UChar32 * const s = (const UChar32 *) i->str->strstart;
+    const UChar32 * const s = (const UChar32 *) Buffer_bufstart(i->str);
     size_t pos              = i->bytepos / sizeof (UChar32);
     const UChar32         c = s[pos++];
     ++i->charpos;
@@ -456,7 +456,7 @@
 {
     ASSERT_ARGS(ucs4_encode_and_advance)
 #if PARROT_HAS_ICU
-    UChar32 *s   = (UChar32 *) i->str->strstart;
+    UChar32 *s   = (UChar32 *) Buffer_bufstart(i->str);
     size_t   pos = i->bytepos / sizeof (UChar32);
     s[pos++] = (UChar32) c;
     ++i->charpos;
@@ -482,7 +482,7 @@
 ucs4_hash(PARROT_INTERP, ARGIN(const STRING *s), size_t hashval)
 {
     ASSERT_ARGS(ucs4_hash)
-    const UChar32 *pos = (const UChar32*) s->strstart;
+    const UChar32 *pos = (const UChar32*) Buffer_bufstart(s);
     UINTVAL len = s->strlen;
     UNUSED(interp);
 

Modified: branches/unshared_buffers/src/string/encoding/utf16.c
==============================================================================
--- branches/unshared_buffers/src/string/encoding/utf16.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/string/encoding/utf16.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -208,18 +208,18 @@
     }
 #if PARROT_HAS_ICU
     Parrot_gc_allocate_string_storage(interp, result, sizeof (UChar) * src_len);
-    p = (UChar *)result->strstart;
+    p = (UChar *)Buffer_bufstart(result);
 
     if (src->charset == Parrot_iso_8859_1_charset_ptr ||
             src->charset == Parrot_ascii_charset_ptr) {
         for (dest_len = 0; dest_len < (int)src->strlen; ++dest_len) {
-            p[dest_len] = (UChar)((unsigned char*)src->strstart)[dest_len];
+            p[dest_len] = (UChar)((unsigned char*)Buffer_bufstart(src))[dest_len];
         }
     }
     else {
         err = U_ZERO_ERROR;
         u_strFromUTF8(p, src_len,
-                &dest_len, src->strstart, src->bufused, &err);
+                &dest_len, Buffer_bufstart(src), src->bufused, &err);
         if (!U_SUCCESS(err)) {
             /*
              * have to resize - required len in UChars is in dest_len
@@ -227,9 +227,9 @@
             result->bufused = dest_len * sizeof (UChar);
             Parrot_gc_reallocate_string_storage(interp, result,
                                      sizeof (UChar) * dest_len);
-            p = (UChar *)result->strstart;
+            p = (UChar *)Buffer_bufstart(result);
             u_strFromUTF8(p, dest_len,
-                    &dest_len, src->strstart, src->bufused, &err);
+                    &dest_len, Buffer_bufstart(src), src->bufused, &err);
             PARROT_ASSERT(U_SUCCESS(err));
         }
     }
@@ -264,7 +264,7 @@
 {
     ASSERT_ARGS(get_codepoint)
 #if PARROT_HAS_ICU
-    const UChar * const s = (UChar*) src->strstart;
+    const UChar * const s = (UChar*) Buffer_bufstart(src);
     UINTVAL c, pos;
     UNUSED(interp);
 
@@ -324,7 +324,7 @@
 get_byte(SHIM_INTERP, ARGIN(const STRING *src), UINTVAL offset)
 {
     ASSERT_ARGS(get_byte)
-    const unsigned char * const contents = (unsigned char *)src->strstart;
+    const unsigned char * const contents = (unsigned char *)Buffer_bufstart(src);
     if (offset >= src->bufused) {
 /*        Parrot_ex_throw_from_c_args(interp, NULL, 0,
                 "get_byte past the end of the buffer (%i of %i)",
@@ -355,7 +355,7 @@
         Parrot_ex_throw_from_c_args(interp, NULL, 0,
             "set_byte past the end of the buffer");
 
-    contents = (unsigned char *)src->strstart;
+    contents = (unsigned char *)Buffer_bufstart(src);
     contents[offset] = (unsigned char)byte;
 }
 
@@ -385,7 +385,7 @@
     start = iter.bytepos;
     iter.set_position(interp, &iter, offset + count);
 
-    return Parrot_str_new_init(interp, src->strstart + start, iter.bytepos - start,
+    return Parrot_str_new_init(interp, Buffer_bufstart(src) + start, iter.bytepos - start,
         src->encoding, src->charset, PObj_get_FLAGS(src));
 }
 
@@ -474,7 +474,7 @@
 utf16_decode_and_advance(SHIM_INTERP, ARGMOD(String_iter *i))
 {
     ASSERT_ARGS(utf16_decode_and_advance)
-    const UChar * const s = (const UChar*) i->str->strstart;
+    const UChar * const s = (const UChar*) Buffer_bufstart(i->str);
     UINTVAL pos = i->bytepos / sizeof (UChar);
     UINTVAL c;
 
@@ -503,7 +503,7 @@
 utf16_encode_and_advance(SHIM_INTERP, ARGMOD(String_iter *i), UINTVAL c)
 {
     ASSERT_ARGS(utf16_encode_and_advance)
-    UChar * const s = (UChar*) i->str->strstart;
+    UChar * const s = (UChar*) Buffer_bufstart(i->str);
     UINTVAL pos = i->bytepos / sizeof (UChar);
     U16_APPEND_UNSAFE(s, pos, c);
     ++i->charpos;
@@ -525,7 +525,7 @@
 utf16_set_position(SHIM_INTERP, ARGMOD(String_iter *i), UINTVAL n)
 {
     ASSERT_ARGS(utf16_set_position)
-    UChar * const s = (UChar*) i->str->strstart;
+    UChar * const s = (UChar*) Buffer_bufstart(i->str);
     UINTVAL pos;
     pos = 0;
     U16_FWD_N_UNSAFE(s, pos, n);

Modified: branches/unshared_buffers/src/string/encoding/utf8.c
==============================================================================
--- branches/unshared_buffers/src/string/encoding/utf8.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/string/encoding/utf8.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -400,7 +400,7 @@
 utf8_decode_and_advance(PARROT_INTERP, ARGMOD(String_iter *i))
 {
     ASSERT_ARGS(utf8_decode_and_advance)
-    const utf8_t *u8ptr = (utf8_t *)((char *)i->str->strstart + i->bytepos);
+    const utf8_t *u8ptr = (utf8_t *)((char *)Buffer_bufstart(i->str) + i->bytepos);
     UINTVAL c = *u8ptr;
 
     if (UTF8_IS_START(c)) {
@@ -451,7 +451,7 @@
 {
     ASSERT_ARGS(utf8_encode_and_advance)
     const STRING * const s = i->str;
-    unsigned char * const pos = (unsigned char *)s->strstart + i->bytepos;
+    unsigned char * const pos = (unsigned char *)Buffer_bufstart(s) + i->bytepos;
     unsigned char * const new_pos = (unsigned char *)utf8_encode(interp, pos, c);
 
     i->bytepos += (new_pos - pos);
@@ -476,7 +476,7 @@
 utf8_set_position(SHIM_INTERP, ARGMOD(String_iter *i), UINTVAL pos)
 {
     ASSERT_ARGS(utf8_set_position)
-    const utf8_t *u8ptr = (const utf8_t *)i->str->strstart;
+    const utf8_t *u8ptr = (const utf8_t *)Buffer_bufstart(i->str);
 
     /* start from last known charpos, if we can */
     if (i->charpos <= pos) {
@@ -491,7 +491,7 @@
     while (pos-- > 0)
         u8ptr += UTF8SKIP(u8ptr);
 
-    i->bytepos = (const char *)u8ptr - (const char *)i->str->strstart;
+    i->bytepos = (const char *)u8ptr - (const char *)Buffer_bufstart(i->str);
 }
 
 
@@ -533,11 +533,11 @@
         return result;
 
     Parrot_gc_allocate_string_storage(interp, result, src_len);
-    p = (unsigned char *)result->strstart;
+    p = (unsigned char *)Buffer_bufstart(result);
 
     if (src->charset == Parrot_ascii_charset_ptr) {
         for (dest_len = 0; dest_len < src_len; ++dest_len) {
-            p[dest_len] = ((unsigned char*)src->strstart)[dest_len];
+            p[dest_len] = ((unsigned char*)Buffer_bufstart(src))[dest_len];
         }
         result->bufused = dest_len;
     }
@@ -556,7 +556,7 @@
                 dest_len += need;
                 result->bufused = dest_pos;
                 Parrot_gc_reallocate_string_storage(interp, result, dest_len);
-                p = (unsigned char *)result->strstart;
+                p = (unsigned char *)Buffer_bufstart(result);
             }
 
             pos = p + dest_pos;
@@ -584,7 +584,7 @@
 get_codepoint(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset)
 {
     ASSERT_ARGS(get_codepoint)
-    const utf8_t * const start = (const utf8_t *)utf8_skip_forward(src->strstart, offset);
+    const utf8_t * const start = (const utf8_t *)utf8_skip_forward(Buffer_bufstart(src), offset);
     return utf8_decode(interp, start);
 }
 
@@ -625,7 +625,7 @@
 get_byte(SHIM_INTERP, ARGIN(const STRING *src), UINTVAL offset)
 {
     ASSERT_ARGS(get_byte)
-    unsigned char *contents = (unsigned char *)src->strstart;
+    unsigned char *contents = (unsigned char *)Buffer_bufstart(src);
     if (offset >= src->bufused) {
 /*        Parrot_ex_throw_from_c_args(interp, NULL, 0,
                 "get_byte past the end of the buffer (%i of %i)",
@@ -657,7 +657,7 @@
         Parrot_ex_throw_from_c_args(interp, NULL, 0,
             "set_byte past the end of the buffer");
 
-    contents = (unsigned char *)src->strstart;
+    contents = (unsigned char *)Buffer_bufstart(src);
     contents[offset] = (unsigned char)byte;
 }
 
@@ -691,7 +691,7 @@
     if (count)
         iter.set_position(interp, &iter, offset + count);
 
-    return Parrot_str_new_init(interp, src->strstart + start, iter.bytepos - start, 
+    return Parrot_str_new_init(interp, Buffer_bufstart(src) + start, iter.bytepos - start, 
         src->encoding, src->charset, PObj_get_FLAGS(src));
 }
 
@@ -711,7 +711,7 @@
 get_bytes(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(get_bytes)
-    return Parrot_str_new_init(interp, src->strstart + offset, count,
+    return Parrot_str_new_init(interp, Buffer_bufstart(src) + offset, count,
         src->encoding, src->charset, PObj_get_FLAGS(src));
 }
 

Modified: branches/unshared_buffers/src/utils.c
==============================================================================
--- branches/unshared_buffers/src/utils.c	Mon Aug  9 21:06:12 2010	(r48363)
+++ branches/unshared_buffers/src/utils.c	Mon Aug  9 21:06:55 2010	(r48364)
@@ -596,9 +596,9 @@
         ARGIN(const STRING *search), UINTVAL start_offset)
 {
     ASSERT_ARGS(Parrot_byte_index)
-    const char * const str_start  = base->strstart;
+    const char * const str_start  = Buffer_bufstart(base);
     const INTVAL       str_len    = base->strlen;
-    const char * const search_str = search->strstart;
+    const char * const search_str = Buffer_bufstart(search);
     const INTVAL       search_len = search->strlen;
     const char        *str_pos    = str_start + start_offset;
     INTVAL             len_remain = str_len   - start_offset;
@@ -646,7 +646,7 @@
 {
     ASSERT_ARGS(Parrot_byte_rindex)
     const INTVAL searchlen          = search->strlen;
-    const char * const search_start = (const char *)(search->strstart);
+    const char * const search_start = (const char *)(Buffer_bufstart(search));
     UINTVAL max_possible_offset     = (base->strlen - search->strlen);
     INTVAL current_offset;
 
@@ -655,7 +655,7 @@
 
     for (current_offset = max_possible_offset; current_offset >= 0;
             current_offset--) {
-        const char * const base_start = (char *)(base->strstart) + current_offset;
+        const char * const base_start = (char *)(Buffer_bufstart(base)) + current_offset;
         if (memcmp(base_start, search_start, searchlen) == 0) {
             return current_offset;
         }


More information about the parrot-commits mailing list