Index: libyaml/trunk/src/api.c
===================================================================
--- libyaml/trunk/src/api.c	(revision 216)
+++ libyaml/trunk/src/api.c	(revision 219)
@@ -812,5 +812,5 @@
 yaml_scalar_event_initialize(yaml_event_t *event,
         yaml_char_t *anchor, yaml_char_t *tag,
-        yaml_char_t *value, size_t length,
+        yaml_char_t *value, int length,
         int plain_implicit, int quoted_implicit,
         yaml_scalar_style_t style)
@@ -824,5 +824,4 @@
     assert(value);      /* Non-NULL anchor is expected. */
 
-
     if (anchor) {
         if (!yaml_check_utf8(anchor, strlen((char *)anchor))) goto error;
@@ -835,4 +834,8 @@
         tag_copy = yaml_strdup(tag);
         if (!tag_copy) goto error;
+    }
+
+    if (length < 0) {
+        length = strlen((char *)value);
     }
 
