summaryrefslogtreecommitdiff
path: root/src/emitter.c
diff options
context:
space:
mode:
authorTina Müller <cpan2@tinita.de>2019-04-04 23:48:16 +0200
committerTina Müller <cpan2@tinita.de>2019-04-04 23:48:16 +0200
commitd407f6b1cccbf83ee182144f39689babcb220bd6 (patch)
tree9218bef9247e2d5b363c41a717b23c1ae4701fa1 /src/emitter.c
parentf08c50ccb78afe6aef12e284e352fbc2e138e81c (diff)
downloadlibyaml-git-dist-0.2.2.tar.gz
0.2.2 dist filesdist-0.2.2
Diffstat (limited to 'src/emitter.c')
-rw-r--r--src/emitter.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/emitter.c b/src/emitter.c
index d31e075..b9392e4 100644
--- a/src/emitter.c
+++ b/src/emitter.c
@@ -16,7 +16,7 @@
#define PUT(emitter,value) \
(FLUSH(emitter) \
&& (*(emitter->buffer.pointer++) = (yaml_char_t)(value), \
- emitter->column ++, \
+ emitter->column++, \
1))
/*
@@ -221,7 +221,7 @@ yaml_emitter_write_indent(yaml_emitter_t *emitter);
static int
yaml_emitter_write_indicator(yaml_emitter_t *emitter,
- char *indicator, int need_whitespace,
+ const char *indicator, int need_whitespace,
int is_whitespace, int is_indention);
static int
@@ -649,13 +649,6 @@ yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
else if (event->type == YAML_STREAM_END_EVENT)
{
- if (emitter->open_ended)
- {
- if (!yaml_emitter_write_indicator(emitter, "...", 1, 0, 0))
- return 0;
- if (!yaml_emitter_write_indent(emitter))
- return 0;
- }
if (!yaml_emitter_flush(emitter))
return 0;
@@ -1784,7 +1777,7 @@ yaml_emitter_write_indent(yaml_emitter_t *emitter)
static int
yaml_emitter_write_indicator(yaml_emitter_t *emitter,
- char *indicator, int need_whitespace,
+ const char *indicator, int need_whitespace,
int is_whitespace, int is_indention)
{
size_t indicator_length;
@@ -1946,6 +1939,10 @@ yaml_emitter_write_plain_scalar(yaml_emitter_t *emitter,
emitter->whitespace = 0;
emitter->indention = 0;
+ if (emitter->root_context)
+ {
+ emitter->open_ended = 1;
+ }
return 1;
}
@@ -2004,6 +2001,9 @@ yaml_emitter_write_single_quoted_scalar(yaml_emitter_t *emitter,
}
}
+ if (breaks)
+ if (!yaml_emitter_write_indent(emitter)) return 0;
+
if (!yaml_emitter_write_indicator(emitter, "'", 0, 0, 0))
return 0;
@@ -2174,7 +2174,7 @@ yaml_emitter_write_block_scalar_hints(yaml_emitter_t *emitter,
yaml_string_t string)
{
char indent_hint[2];
- char *chomp_hint = NULL;
+ const char *chomp_hint = NULL;
if (IS_SPACE(string) || IS_BREAK(string))
{