summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-21 09:14:36 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-21 09:14:36 -0700
commit940896aaf62630f6b25520c64cfeb8d565f73885 (patch)
tree6c1b4e25f0e9928cc4f579e7e236f24f41cde451
parentd8440cc7019c04a6378c7cc5efd05527b91748f5 (diff)
parent86388bbc72c7bd10d3482cc63dfdfa276c604baf (diff)
downloadpsych-940896aaf62630f6b25520c64cfeb8d565f73885.zip
Merge branch 'master' into jruby
* master: psych: allocate structs with wrapper update minitest gem to 5.x, add Ruby 2.2 test target
-rw-r--r--.travis.yml3
-rw-r--r--Rakefile4
-rw-r--r--ext/psych/psych_emitter.c5
-rw-r--r--ext/psych/psych_parser.c4
4 files changed, 8 insertions, 8 deletions
diff --git a/.travis.yml b/.travis.yml
index 6cfdb72..7665cae 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,12 +3,13 @@ rvm:
- 1.9.3
- 2.0.0
- 2.1.0
+ - 2.2.0
- ruby-head
- rbx-2
before_script:
- gem install hoe
- gem install rake-compiler
- - gem install minitest -v '~> 4.0'
+ - gem install minitest -v '~> 5.0'
script: rake test
matrix:
allow_failures:
diff --git a/Rakefile b/Rakefile
index bf332a7..06d82c5 100644
--- a/Rakefile
+++ b/Rakefile
@@ -16,7 +16,7 @@ class Hoe
end
gem 'rake-compiler', '>= 0.4.1'
-gem 'minitest', '~> 4.0'
+gem 'minitest', '~> 5.0'
require "rake/extensiontask"
Hoe.plugin :doofus, :git, :gemspec
@@ -31,7 +31,7 @@ $hoe = Hoe.spec 'psych' do
self.testlib = :minitest
extra_dev_deps << ['rake-compiler', '>= 0.4.1']
- extra_dev_deps << ['minitest', '~> 4.0']
+ extra_dev_deps << ['minitest', '~> 5.0']
self.spec_extras = {
:required_ruby_version => '>= 1.9.2'
diff --git a/ext/psych/psych_emitter.c b/ext/psych/psych_emitter.c
index 4ba2381..feffc54 100644
--- a/ext/psych/psych_emitter.c
+++ b/ext/psych/psych_emitter.c
@@ -50,14 +50,13 @@ static const rb_data_type_t psych_emitter_type = {
static VALUE allocate(VALUE klass)
{
yaml_emitter_t * emitter;
-
- emitter = xmalloc(sizeof(yaml_emitter_t));
+ VALUE obj = TypedData_Make_Struct(klass, yaml_emitter_t, &psych_emitter_type, emitter);
yaml_emitter_initialize(emitter);
yaml_emitter_set_unicode(emitter, 1);
yaml_emitter_set_indent(emitter, 2);
- return TypedData_Wrap_Struct(klass, &psych_emitter_type, emitter);
+ return obj;
}
/* call-seq: Psych::Emitter.new(io, options = Psych::Emitter::OPTIONS)
diff --git a/ext/psych/psych_parser.c b/ext/psych/psych_parser.c
index faae460..2caa8a0 100644
--- a/ext/psych/psych_parser.c
+++ b/ext/psych/psych_parser.c
@@ -70,11 +70,11 @@ static const rb_data_type_t psych_parser_type = {
static VALUE allocate(VALUE klass)
{
yaml_parser_t * parser;
+ VALUE obj = TypedData_Make_Struct(klass, yaml_parser_t, &psych_parser_type, parser);
- parser = xmalloc(sizeof(yaml_parser_t));
yaml_parser_initialize(parser);
- return TypedData_Wrap_Struct(klass, &psych_parser_type, parser);
+ return obj;
}
static VALUE make_exception(yaml_parser_t * parser, VALUE path)