develooper Front page | perl.cvs.parrot | Postings from November 2008

[svn:parrot] r32631 - branches/pdd22io/src/io

From:
allison
Date:
November 13, 2008 20:27
Subject:
[svn:parrot] r32631 - branches/pdd22io/src/io
Message ID:
20081114042713.BED56CB9AF@x12.develooper.com
Author: allison
Date: Thu Nov 13 20:27:12 2008
New Revision: 32631

Modified:
   branches/pdd22io/src/io/buffer.c

Log:
[pdd22io] Make sure 'buffer_next' and 'buffer_end' FileHandle attributes are
set and retrieved in the right places in 'Parrot_io_readline_buffer'.


Modified: branches/pdd22io/src/io/buffer.c
==============================================================================
--- branches/pdd22io/src/io/buffer.c	(original)
+++ branches/pdd22io/src/io/buffer.c	Thu Nov 13 20:27:12 2008
@@ -441,8 +441,8 @@
     unsigned char *out_buf;
     unsigned char *buf_start;
     INTVAL         buffer_flags = Parrot_io_get_buffer_flags(interp, filehandle);
-    unsigned char *buffer_next  = Parrot_io_get_buffer_next(interp, filehandle);
-    unsigned char *buffer_end   = Parrot_io_get_buffer_end(interp, filehandle);
+    unsigned char *buffer_next;
+    unsigned char *buffer_end;
     size_t len;
     STRING *s;
 
@@ -458,12 +458,21 @@
             return 0;
     }
 
+    /* Retrieve filled buffer */
+    buffer_next = Parrot_io_get_buffer_next(interp, filehandle);
+    buffer_end  = Parrot_io_get_buffer_end(interp, filehandle);
+
     buf_start = buffer_next;
+
     for (l = 0; buffer_next < buffer_end;) {
         l++;
-        if (io_is_end_of_line((char *)buffer_next++)) {
+        if (io_is_end_of_line((char *)buffer_next)) {
+            Parrot_io_set_buffer_next(interp, filehandle, ++buffer_next);
             break;
         }
+
+        Parrot_io_set_buffer_next(interp, filehandle, ++buffer_next);
+
         /* if there is a buffer, readline is called by the read opcode
          * - return just that part
          */
@@ -485,7 +494,7 @@
             s->strlen = s->bufused = l;
             if (Parrot_io_fill_readbuf(interp, filehandle) == 0)
                 return l;
-            buf_start = Parrot_io_get_buffer_start(interp, filehandle);;
+            buf_start = Parrot_io_get_buffer_start(interp, filehandle);
         }
     }
     if (s->bufused < l) {



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About