diff options
Diffstat (limited to 'src/api.c')
-rw-r--r-- | src/api.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -811,7 +811,7 @@ yaml_alias_event_initialize(yaml_event_t *event, yaml_char_t *anchor) YAML_DECLARE(int) 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) { @@ -823,7 +823,6 @@ yaml_scalar_event_initialize(yaml_event_t *event, assert(event); /* Non-NULL event object is expected. */ assert(value); /* Non-NULL anchor is expected. */ - if (anchor) { if (!yaml_check_utf8(anchor, strlen((char *)anchor))) goto error; anchor_copy = yaml_strdup(anchor); @@ -836,6 +835,10 @@ yaml_scalar_event_initialize(yaml_event_t *event, if (!tag_copy) goto error; } + if (length < 0) { + length = strlen((char *)value); + } + if (!yaml_check_utf8(value, length)) goto error; value_copy = yaml_malloc(length+1); if (!value_copy) goto error; |