Index: libyaml/branches/stable/src/reader.c
===================================================================
--- libyaml/branches/stable/src/reader.c	(revision 324)
+++ libyaml/branches/stable/src/reader.c	(revision 352)
@@ -142,4 +142,6 @@
 yaml_parser_update_buffer(yaml_parser_t *parser, size_t length)
 {
+    int first = 1;
+
     assert(parser->read_handler);   /* Read handler must be set. */
 
@@ -179,7 +181,10 @@
     while (parser->unread < length)
     {
-        /* Fill the raw buffer. */
-
-        if (!yaml_parser_update_raw_buffer(parser)) return 0;
+        /* Fill the raw buffer if necessary. */
+
+        if (!first || parser->raw_buffer.pointer == parser->raw_buffer.last) {
+            if (!yaml_parser_update_raw_buffer(parser)) return 0;
+        }
+        first = 0;
 
         /* Decode the raw buffer. */
