summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKirill Simonov <xi@resolvent.net>2006-07-31 22:24:32 +0000
committerKirill Simonov <xi@resolvent.net>2006-07-31 22:24:32 +0000
commit2a02dfd2625480af0f2b48664c46dab20ea799da (patch)
tree26990e065de3b3253dace85aea837d00c4544465 /src
parentb3043c486c98b6f0be2ac532552b19f0e0f0099b (diff)
downloadlibyaml-hg-2a02dfd2625480af0f2b48664c46dab20ea799da.tar.gz
Add two examples and prepare the build system for distribution.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/api.c7
2 files changed, 6 insertions, 3 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index cc815e7..f9cb7a2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,4 @@
AM_CPPFLAGS = -I$(top_srcdir)/include
lib_LTLIBRARIES = libyaml.la
-libyaml_la_SOURCES = api.c reader.c scanner.c parser.c writer.c emitter.c
+libyaml_la_SOURCES = yaml_private.h api.c reader.c scanner.c parser.c writer.c emitter.c
libyaml_la_LDFLAGS = -release $(YAML_LT_RELEASE) -version-info $(YAML_LT_CURRENT):$(YAML_LT_REVISION):$(YAML_LT_AGE)
diff --git a/src/api.c b/src/api.c
index dc7611d..83ca720 100644
--- a/src/api.c
+++ b/src/api.c
@@ -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;