summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSHIBATA Hiroshi <hsbt@ruby-lang.org>2018-08-10 19:01:35 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2018-08-10 19:01:35 +0900
commitd4f1d4b4106bacac18110884dc2e860eeb58634f (patch)
tree188e2c66d83740c92580af221a826ca2f7d1aed6
parentbb7585be12c7865e7eaa60e602c3296621e41e09 (diff)
downloadpsych-d4f1d4b4106bacac18110884dc2e860eeb58634f.tar.gz
Re-apply patchsets from ruby-core repository.
-rw-r--r--ext/psych/yaml/emitter.c14
-rw-r--r--ext/psych/yaml/scanner.c4
-rw-r--r--ext/psych/yaml/yaml_private.h4
3 files changed, 13 insertions, 9 deletions
diff --git a/ext/psych/yaml/emitter.c b/ext/psych/yaml/emitter.c
index d31e075..92e21cd 100644
--- a/ext/psych/yaml/emitter.c
+++ b/ext/psych/yaml/emitter.c
@@ -24,8 +24,8 @@
*/
#define PUT_BREAK(emitter) \
- (FLUSH(emitter) \
- && ((emitter->line_break == YAML_CR_BREAK ? \
+ (FLUSH(emitter) ? \
+ ((emitter->line_break == YAML_CR_BREAK ? \
(*(emitter->buffer.pointer++) = (yaml_char_t) '\r') : \
emitter->line_break == YAML_LN_BREAK ? \
(*(emitter->buffer.pointer++) = (yaml_char_t) '\n') : \
@@ -34,7 +34,7 @@
*(emitter->buffer.pointer++) = (yaml_char_t) '\n') : 0), \
emitter->column = 0, \
emitter->line ++, \
- 1))
+ 1) : 0)
/*
* Copy a character from a string into buffer.
@@ -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
@@ -1234,7 +1234,7 @@ yaml_emitter_select_scalar_style(yaml_emitter_t *emitter, yaml_event_t *event)
}
/*
- * Write an achor.
+ * Write an anchor.
*/
static int
@@ -1784,7 +1784,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;
@@ -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))
{
diff --git a/ext/psych/yaml/scanner.c b/ext/psych/yaml/scanner.c
index b6f5185..359f107 100644
--- a/ext/psych/yaml/scanner.c
+++ b/ext/psych/yaml/scanner.c
@@ -1636,7 +1636,7 @@ yaml_parser_fetch_key(yaml_parser_t *parser)
if (!parser->flow_level)
{
- /* Check if we are allowed to start a new key (not nessesary simple). */
+ /* Check if we are allowed to start a new key (not necessary simple). */
if (!parser->simple_key_allowed) {
return yaml_parser_set_scanner_error(parser, NULL, parser->mark,
@@ -3507,7 +3507,7 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
{
if (IS_BLANK(parser->buffer))
{
- /* Check for tab character that abuse indentation. */
+ /* Check for tab characters that abuse indentation. */
if (leading_blanks && (int)parser->mark.column < indent
&& IS_TAB(parser->buffer)) {
diff --git a/ext/psych/yaml/yaml_private.h b/ext/psych/yaml/yaml_private.h
index eb72207..f4f244c 100644
--- a/ext/psych/yaml/yaml_private.h
+++ b/ext/psych/yaml/yaml_private.h
@@ -1,3 +1,7 @@
+#ifdef RUBY_EXTCONF_H
+#include RUBY_EXTCONF_H
+#endif
+
#if HAVE_CONFIG_H
#include <config.h>
#endif