summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-12-13 14:46:20 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-12-13 14:46:20 -0800
commit9ab3a7066b09a5f7b563626676d788125882b581 (patch)
treee6712c555f10b51ab7012c14e39d2cc1f4359fd3 /ext
parentc2e0c9878416f621b23525870d69d2bc4816fceb (diff)
downloadpsych-9ab3a7066b09a5f7b563626676d788125882b581.zip
merge changes from ruby trunk
Diffstat (limited to 'ext')
-rw-r--r--ext/psych/extconf.rb17
-rw-r--r--ext/psych/yaml/emitter.c14
-rw-r--r--ext/psych/yaml/parser.c2
-rw-r--r--ext/psych/yaml/reader.c6
-rw-r--r--ext/psych/yaml/scanner.c10
-rw-r--r--ext/psych/yaml/writer.c2
-rw-r--r--ext/psych/yaml/yaml.h6
-rw-r--r--ext/psych/yaml/yaml_private.h4
8 files changed, 29 insertions, 32 deletions
diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb
index b294aab..65e83a3 100644
--- a/ext/psych/extconf.rb
+++ b/ext/psych/extconf.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
require 'mkmf'
require 'fileutils'
@@ -5,20 +6,16 @@ require 'fileutils'
dir_config 'libyaml'
-unless find_header('yaml.h') && find_library('yaml', 'yaml_get_version')
+if enable_config("bundled-libyaml", false) || !(find_header('yaml.h') && find_library('yaml', 'yaml_get_version'))
# Embed libyaml since we could not find it.
- srcdir = File.expand_path File.dirname __FILE__
- files = Dir.chdir File.join(srcdir, 'yaml') do
- Dir.entries(Dir.pwd).find_all { |f|
- File.file?(f) && File.extname(f) =~ /^\.[hc]/
- }.map { |f| File.expand_path f }
- end
+ $VPATH << "$(srcdir)/yaml"
+ $INCFLAGS << " -I$(srcdir)/yaml"
- FileUtils.cp_r files, srcdir
+ $srcs = Dir.glob("#{$srcdir}/{,yaml/}*.c").map {|n| File.basename(n)}
- if $mswin
- $CFLAGS += " -DYAML_DECLARE_STATIC -DHAVE_CONFIG_H"
+ if have_macro("_WIN32")
+ $CPPFLAGS << " -DYAML_DECLARE_STATIC -DHAVE_CONFIG_H"
end
have_header 'dlfcn.h'
diff --git a/ext/psych/yaml/emitter.c b/ext/psych/yaml/emitter.c
index c4b56a2..c852f93 100644
--- a/ext/psych/yaml/emitter.c
+++ b/ext/psych/yaml/emitter.c
@@ -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
@@ -517,7 +517,7 @@ yaml_emitter_emit_stream_start(yaml_emitter_t *emitter,
if (emitter->best_width < 0) {
emitter->best_width = INT_MAX;
}
-
+
if (!emitter->line_break) {
emitter->line_break = YAML_LN_BREAK;
}
@@ -607,7 +607,7 @@ yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
if (!yaml_emitter_write_indent(emitter))
return 0;
}
-
+
if (event->data.document_start.tag_directives.start
!= event->data.document_start.tag_directives.end) {
implicit = 0;
@@ -721,7 +721,7 @@ yaml_emitter_emit_document_end(yaml_emitter_t *emitter,
}
/*
- *
+ *
* Expect a flow item node.
*/
@@ -1402,7 +1402,7 @@ yaml_emitter_analyze_anchor(yaml_emitter_t *emitter,
{
size_t anchor_length;
yaml_string_t string;
-
+
anchor_length = strlen((char *)anchor);
STRING_ASSIGN(string, anchor, anchor_length);
@@ -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;
@@ -2178,7 +2178,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/parser.c b/ext/psych/yaml/parser.c
index eb2a2c7..dc5430b 100644
--- a/ext/psych/yaml/parser.c
+++ b/ext/psych/yaml/parser.c
@@ -1295,7 +1295,7 @@ yaml_parser_process_directives(yaml_parser_t *parser,
token = PEEK_TOKEN(parser);
if (!token) goto error;
}
-
+
for (default_tag_directive = default_tag_directives;
default_tag_directive->handle; default_tag_directive++) {
if (!yaml_parser_append_tag_directive(parser, *default_tag_directive, 1,
diff --git a/ext/psych/yaml/reader.c b/ext/psych/yaml/reader.c
index 829e32d..4e48add 100644
--- a/ext/psych/yaml/reader.c
+++ b/ext/psych/yaml/reader.c
@@ -52,7 +52,7 @@ yaml_parser_determine_encoding(yaml_parser_t *parser)
{
/* Ensure that we had enough bytes in the raw buffer. */
- while (!parser->eof
+ while (!parser->eof
&& parser->raw_buffer.last - parser->raw_buffer.pointer < 3) {
if (!yaml_parser_update_raw_buffer(parser)) {
return 0;
@@ -295,7 +295,7 @@ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length)
parser->offset, value);
break;
-
+
case YAML_UTF16LE_ENCODING:
case YAML_UTF16BE_ENCODING:
@@ -318,7 +318,7 @@ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length)
*
* The following formulas are used for decoding
* and encoding characters using surrogate pairs:
- *
+ *
* U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF)
* U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF)
* W1 = 110110yyyyyyyyyy
diff --git a/ext/psych/yaml/scanner.c b/ext/psych/yaml/scanner.c
index a2e8619..f7a305d 100644
--- a/ext/psych/yaml/scanner.c
+++ b/ext/psych/yaml/scanner.c
@@ -762,7 +762,7 @@ yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token)
}
/* Fetch the next token from the queue. */
-
+
*token = DEQUEUE(parser, parser->tokens);
parser->token_available = 0;
parser->tokens_parsed ++;
@@ -1121,7 +1121,7 @@ yaml_parser_save_simple_key(yaml_parser_t *parser)
yaml_simple_key_t simple_key;
simple_key.possible = 1;
simple_key.required = required;
- simple_key.token_number =
+ simple_key.token_number =
parser->tokens_parsed + (parser->tokens.tail - parser->tokens.head);
simple_key.mark = parser->mark;
@@ -1202,7 +1202,7 @@ yaml_parser_decrease_flow_level(yaml_parser_t *parser)
* Push the current indentation level to the stack and set the new level
* the current column is greater than the indentation level. In this case,
* append or insert the specified token into the token queue.
- *
+ *
*/
static int
@@ -1935,7 +1935,7 @@ yaml_parser_scan_to_next_token(yaml_parser_t *parser)
*
* - in the flow context;
* - in the block context, but not at the beginning of the line or
- * after '-', '?', or ':' (complex value).
+ * after '-', '?', or ':' (complex value).
*/
if (!CACHE(parser, 1)) return 0;
@@ -3001,7 +3001,7 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
*indent = 1;
}
- return 1;
+ return 1;
}
/*
diff --git a/ext/psych/yaml/writer.c b/ext/psych/yaml/writer.c
index b90019f..5d57f39 100644
--- a/ext/psych/yaml/writer.c
+++ b/ext/psych/yaml/writer.c
@@ -74,7 +74,7 @@ yaml_emitter_flush(yaml_emitter_t *emitter)
unsigned int value;
size_t k;
- /*
+ /*
* See the "reader.c" code for more details on UTF-8 encoding. Note
* that we assume that the buffer contains a valid UTF-8 sequence.
*/
diff --git a/ext/psych/yaml/yaml.h b/ext/psych/yaml/yaml.h
index 5a04d36..acd72ad 100644
--- a/ext/psych/yaml/yaml.h
+++ b/ext/psych/yaml/yaml.h
@@ -1,7 +1,7 @@
/**
* @file yaml.h
* @brief Public interface for libyaml.
- *
+ *
* Include the header file with the code:
* @code
* #include <yaml.h>
@@ -388,7 +388,7 @@ typedef struct yaml_event_s {
/** The event data. */
union {
-
+
/** The stream parameters (for @c YAML_STREAM_START_EVENT). */
struct {
/** The document encoding. */
@@ -724,7 +724,7 @@ struct yaml_node_s {
/** The node data. */
union {
-
+
/** The scalar parameters (for @c YAML_SCALAR_NODE). */
struct {
/** The scalar value. */
diff --git a/ext/psych/yaml/yaml_private.h b/ext/psych/yaml/yaml_private.h
index 2b3e074..af10c83 100644
--- a/ext/psych/yaml/yaml_private.h
+++ b/ext/psych/yaml/yaml_private.h
@@ -231,9 +231,9 @@ yaml_string_join(
(string).pointer[offset] <= (yaml_char_t) 'f') ? \
((string).pointer[offset] - (yaml_char_t) 'a' + 10) : \
((string).pointer[offset] - (yaml_char_t) '0'))
-
+
#define AS_HEX(string) AS_HEX_AT((string),0)
-
+
/*
* Check if the character is ASCII.
*/