ffi-yajl 2.2.2-universal-java → 2.3.4-universal-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,18 @@
1
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..')
2
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..")
2
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")
3
3
 
4
- require 'rubygems'
5
- require 'benchmark'
6
- require 'yajl'
7
- require 'stringio'
4
+ require "rubygems" unless defined?(Gem)
5
+ require "benchmark" unless defined?(Benchmark)
6
+ require "yajl"
7
+ require "stringio" unless defined?(StringIO)
8
8
  begin
9
- require 'json'
9
+ require "json" unless defined?(JSON)
10
10
  rescue LoadError
11
11
  end
12
12
 
13
13
  times = ARGV[0] ? ARGV[0].to_i : 1000
14
- filename = 'benchmark/subjects/ohai.json'
15
- json = File.new(filename, 'r')
14
+ filename = "benchmark/subjects/ohai.json"
15
+ json = File.new(filename, "r")
16
16
  hash = Yajl::Parser.new.parse(json)
17
17
  json.close
18
18
 
@@ -1,18 +1,18 @@
1
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..')
2
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..")
2
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")
3
3
 
4
- require 'rubygems'
5
- require 'benchmark'
6
- require 'yajl'
4
+ require "rubygems" unless defined?(Gem)
5
+ require "benchmark" unless defined?(Benchmark)
6
+ require "yajl"
7
7
  begin
8
- require 'json'
8
+ require "json" unless defined?(JSON)
9
9
  rescue LoadError
10
10
  end
11
- require 'yaml'
11
+ require "yaml" unless defined?(YAML)
12
12
 
13
13
  # JSON Section
14
- filename = 'benchmark/subjects/ohai.json'
15
- json = File.new(filename, 'r')
14
+ filename = "benchmark/subjects/ohai.json"
15
+ json = File.new(filename, "r")
16
16
  hash = Yajl::Parser.new.parse(json)
17
17
  json.close
18
18
 
@@ -33,8 +33,8 @@ Benchmark.bmbm do |x|
33
33
  end
34
34
 
35
35
  # YAML Section
36
- filename = 'benchmark/subjects/ohai.yml'
37
- yml = File.new(filename, 'r')
36
+ filename = "benchmark/subjects/ohai.yml"
37
+ yml = File.new(filename, "r")
38
38
  data = YAML.load_stream(yml)
39
39
  yml.close
40
40
 
@@ -1,15 +1,15 @@
1
1
  # Portions Originally Copyright (c) 2008-2011 Brian Lopez - http://github.com/brianmario
2
2
  # See MIT-LICENSE
3
3
 
4
- require 'rubygems'
5
- require 'ffi_yajl'
4
+ require "rubygems" unless defined?(Gem)
5
+ require_relative "../../ffi_yajl"
6
6
  begin
7
- require 'perftools'
7
+ require "perftools"
8
8
  rescue LoadError
9
9
  puts "INFO: perftools.rb gem not installed"
10
10
  end
11
11
 
12
- ENV['CPUPROFILE_FREQUENCY'] = "4000"
12
+ ENV["CPUPROFILE_FREQUENCY"] = "4000"
13
13
 
14
14
  module FFI_Yajl
15
15
  class Benchmark
@@ -18,7 +18,7 @@ module FFI_Yajl
18
18
  return unless defined?(PerfTools)
19
19
 
20
20
  filename = File.expand_path(File.join(File.dirname(__FILE__), "subjects", "ohai.json"))
21
- hash = File.open(filename, 'rb') { |f| FFI_Yajl::Parser.parse(f.read) }
21
+ hash = File.open(filename, "rb") { |f| FFI_Yajl::Parser.parse(f.read) }
22
22
 
23
23
  times = 1000
24
24
  puts "Starting profiling encoding #{filename} #{times} times\n\n"
@@ -1,17 +1,17 @@
1
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..')
2
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..")
2
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")
3
3
 
4
- require 'rubygems'
5
- require 'benchmark'
6
- require 'yajl/http_stream'
7
- require 'yajl/gzip'
8
- require 'yajl/deflate'
9
- require 'yajl/bzip2' unless defined?(Bzip2)
10
- require 'json'
11
- require 'uri'
12
- require 'net/http'
4
+ require "rubygems" unless defined?(Gem)
5
+ require "benchmark" unless defined?(Benchmark)
6
+ require "yajl/http_stream"
7
+ require "yajl/gzip"
8
+ require "yajl/deflate"
9
+ require "yajl/bzip2" unless defined?(Bzip2)
10
+ require "json" unless defined?(JSON)
11
+ require "uri" unless defined?(URI)
12
+ require "net/http" unless defined?(Net::HTTP)
13
13
 
14
- uri = URI.parse('http://search.twitter.com/search.json?q=github')
14
+ uri = URI.parse("http://search.twitter.com/search.json?q=github")
15
15
  # uri = URI.parse('http://localhost/yajl-ruby.git/benchmark/subjects/contacts.json')
16
16
 
17
17
  times = ARGV[0] ? ARGV[0].to_i : 1
@@ -1,10 +1,10 @@
1
- require 'rubygems'
2
- require 'benchmark'
3
- require 'yajl'
4
- require 'ffi_yajl'
1
+ require "rubygems" unless defined?(Gem)
2
+ require "benchmark" unless defined?(Benchmark)
3
+ require "yajl"
4
+ require_relative "../../ffi_yajl"
5
5
  if !defined?(RUBY_ENGINE) || RUBY_ENGINE !~ /jruby/
6
6
  begin
7
- require 'yajl'
7
+ require "yajl"
8
8
  rescue LoadError
9
9
  puts "INFO: yajl-ruby not installed"
10
10
  end
@@ -12,11 +12,11 @@ else
12
12
  puts "INFO: skipping yajl-ruby on jruby"
13
13
  end
14
14
  begin
15
- require 'json'
15
+ require "json" unless defined?(JSON)
16
16
  rescue LoadError
17
17
  end
18
18
  begin
19
- require 'oj'
19
+ require "oj"
20
20
  rescue LoadError
21
21
  end
22
22
 
@@ -25,7 +25,7 @@ module FFI_Yajl
25
25
  class Parse
26
26
  def run
27
27
  filename = File.expand_path(File.join(File.dirname(__FILE__), "subjects", "item.json"))
28
- json = File.new(filename, 'r')
28
+ json = File.new(filename, "r")
29
29
  json_str = json.read
30
30
 
31
31
  times = ARGV[1] ? ARGV[1].to_i : 10_000
@@ -1,19 +1,19 @@
1
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..')
2
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..")
2
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")
3
3
 
4
- require 'rubygems'
5
- require 'benchmark'
6
- require 'yajl'
4
+ require "rubygems" unless defined?(Gem)
5
+ require "benchmark" unless defined?(Benchmark)
6
+ require "yajl"
7
7
  begin
8
- require 'json'
8
+ require "json" unless defined?(JSON)
9
9
  rescue LoadError
10
10
  end
11
11
 
12
12
  # JSON section
13
- filename = 'benchmark/subjects/ohai.json'
14
- marshal_filename = 'benchmark/subjects/ohai.marshal_dump'
15
- json = File.new(filename, 'r')
16
- marshal_file = File.new(marshal_filename, 'r')
13
+ filename = "benchmark/subjects/ohai.json"
14
+ marshal_filename = "benchmark/subjects/ohai.marshal_dump"
15
+ json = File.new(filename, "r")
16
+ marshal_file = File.new(marshal_filename, "r")
17
17
 
18
18
  hash = {}
19
19
 
@@ -1,18 +1,18 @@
1
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..')
2
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..")
2
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")
3
3
 
4
- require 'rubygems'
5
- require 'benchmark'
6
- require 'yajl'
4
+ require "rubygems" unless defined?(Gem)
5
+ require "benchmark" unless defined?(Benchmark)
6
+ require "yajl"
7
7
  begin
8
- require 'json'
8
+ require "json" unless defined?(JSON)
9
9
  rescue LoadError
10
10
  end
11
- require 'yaml'
11
+ require "yaml" unless defined?(YAML)
12
12
 
13
13
  # JSON section
14
- filename = 'benchmark/subjects/ohai.json'
15
- json = File.new(filename, 'r')
14
+ filename = "benchmark/subjects/ohai.json"
15
+ json = File.new(filename, "r")
16
16
 
17
17
  times = ARGV[0] ? ARGV[0].to_i : 1000
18
18
  puts "Starting benchmark parsing #{File.size(filename)} bytes of JSON data #{times} times\n\n"
@@ -39,8 +39,8 @@ end
39
39
  json.close
40
40
 
41
41
  # YAML section
42
- filename = 'benchmark/subjects/ohai.yml'
43
- yaml = File.new(filename, 'r')
42
+ filename = "benchmark/subjects/ohai.yml"
43
+ yaml = File.new(filename, "r")
44
44
 
45
45
  puts "Starting benchmark parsing #{File.size(filename)} bytes of YAML data #{times} times\n\n"
46
46
  Benchmark.bmbm do |x|
@@ -1,15 +1,15 @@
1
1
  # Portions Originally Copyright (c) 2008-2011 Brian Lopez - http://github.com/brianmario
2
2
  # See MIT-LICENSE
3
3
 
4
- require 'rubygems'
5
- require 'ffi_yajl'
4
+ require "rubygems" unless defined?(Gem)
5
+ require_relative "../../ffi_yajl"
6
6
  begin
7
- require 'perftools'
7
+ require "perftools"
8
8
  rescue LoadError
9
9
  puts "INFO: perftools.rb gem not installed"
10
10
  end
11
11
 
12
- ENV['CPUPROFILE_FREQUENCY'] = "4000"
12
+ ENV["CPUPROFILE_FREQUENCY"] = "4000"
13
13
 
14
14
  module FFI_Yajl
15
15
  class Benchmark
@@ -18,7 +18,7 @@ module FFI_Yajl
18
18
  return if defined?(PerfTools)
19
19
 
20
20
  filename = File.expand_path(File.join(File.dirname(__FILE__), "subjects", "ohai.json"))
21
- json = File.new(filename, 'r').read
21
+ json = File.new(filename, "r").read
22
22
 
23
23
  times = 1000
24
24
  puts "Starting profiling encoding #{filename} #{times} times\n\n"
@@ -1,15 +1,15 @@
1
1
  # Portions Originally Copyright (c) 2008-2011 Brian Lopez - http://github.com/brianmario
2
2
  # See MIT-LICENSE
3
3
 
4
- require 'rubygems'
5
- require 'ffi_yajl'
4
+ require "rubygems" unless defined?(Gem)
5
+ require_relative "../../ffi_yajl"
6
6
 
7
7
  module FFI_Yajl
8
8
  class Benchmark
9
9
  class ParseProfileRubyProf
10
10
  def run
11
11
  begin
12
- require 'ruby-prof'
12
+ require "ruby-prof"
13
13
  rescue LoadError
14
14
  puts "INFO: perftools.rb gem not installed"
15
15
  end
@@ -17,7 +17,7 @@ module FFI_Yajl
17
17
  return if defined?(RubyProf)
18
18
 
19
19
  filename = File.expand_path(File.join(File.dirname(__FILE__), "subjects", "ohai.json"))
20
- json = File.new(filename, 'r').read
20
+ json = File.new(filename, "r").read
21
21
 
22
22
  times = 1000
23
23
  puts "Starting profiling encoding #{filename} #{times} times\n\n"
@@ -1,20 +1,20 @@
1
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..')
2
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..")
2
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")
3
3
 
4
- require 'rubygems'
5
- require 'benchmark'
6
- require 'yajl'
4
+ require "rubygems" unless defined?(Gem)
5
+ require "benchmark" unless defined?(Benchmark)
6
+ require "yajl"
7
7
  begin
8
- require 'json'
8
+ require "json" unless defined?(JSON)
9
9
  rescue LoadError
10
10
  end
11
11
  begin
12
- require 'active_support'
12
+ require "active_support"
13
13
  rescue LoadError
14
14
  end
15
15
 
16
- filename = 'benchmark/subjects/twitter_stream.json'
17
- json = File.new(filename, 'r')
16
+ filename = "benchmark/subjects/twitter_stream.json"
17
+ json = File.new(filename, "r")
18
18
 
19
19
  times = ARGV[0] ? ARGV[0].to_i : 100
20
20
  puts "Starting benchmark parsing JSON stream (#{File.size(filename)} bytes of JSON data with 430 JSON separate strings) #{times} times\n\n"
@@ -33,7 +33,7 @@ Benchmark.bmbm do |x|
33
33
  puts "JSON.parse"
34
34
  times.times do
35
35
  json.rewind
36
- while chunk = json.gets
36
+ while ( chunk = json.gets )
37
37
  JSON.parse(chunk, max_nesting: false)
38
38
  end
39
39
  end
@@ -44,7 +44,7 @@ Benchmark.bmbm do |x|
44
44
  puts "ActiveSupport::JSON.decode"
45
45
  times.times do
46
46
  json.rewind
47
- while chunk = json.gets
47
+ while ( chunk = json.gets )
48
48
  ActiveSupport::JSON.decode(chunk)
49
49
  end
50
50
  end
@@ -41,7 +41,15 @@ module FFI_Yajl
41
41
  # call either the ext or ffi hook
42
42
  str = do_yajl_encode(obj, yajl_gen_opts, opts)
43
43
  # we can skip cleaning the whole string for utf-8 issues if we have yajl validate as we go
44
- str.encode!("utf-8", "binary", undef: :replace) unless yajl_gen_opts[:yajl_gen_validate_utf8]
44
+
45
+ str.force_encoding("UTF-8")
46
+ unless yajl_gen_opts[:yajl_gen_validate_utf8]
47
+ if str.respond_to?(:scrub)
48
+ str.scrub!
49
+ else
50
+ str.encode!("UTF-16le", undef: :replace, invalid: :replace).encode!("UTF-8")
51
+ end
52
+ end
45
53
  str
46
54
  end
47
55
 
@@ -56,7 +64,12 @@ module FFI_Yajl
56
64
 
57
65
  def self.raise_error_for_status(status, token = nil)
58
66
  # scrub token to valid utf-8 since we may be issuing an exception on an invalid utf-8 token
59
- token = token.to_s.encode("utf-8", "binary", undef: :replace)
67
+ token = token.to_s.force_encoding("UTF-8")
68
+ if token.respond_to?(:scrub)
69
+ token.scrub!
70
+ else
71
+ token.encode!("UTF-16le", undef: :replace, invalid: :replace).encode!("UTF-8")
72
+ end
60
73
  case status
61
74
  when 1 # yajl_gen_keys_must_be_strings
62
75
  raise FFI_Yajl::EncodeError, "YAJL internal error: attempted use of non-string object as key"
@@ -20,16 +20,16 @@
20
20
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
 
23
- require 'rubygems'
23
+ require "rubygems" unless defined?(Gem)
24
24
 
25
- require 'ffi_yajl/encoder'
26
- require 'ffi_yajl/parser'
27
- require 'ffi_yajl/ext/dlopen'
28
- require 'ffi_yajl/map_library_name'
25
+ require_relative "encoder"
26
+ require_relative "parser"
27
+ require "ffi_yajl/ext/dlopen"
28
+ require_relative "map_library_name"
29
29
 
30
30
  # needed so the encoder c-code can find these symbols
31
- require 'stringio'
32
- require 'date'
31
+ require "stringio" unless defined?(StringIO)
32
+ require "date"
33
33
 
34
34
  module FFI_Yajl
35
35
  extend FFI_Yajl::MapLibraryName
@@ -38,12 +38,12 @@ module FFI_Yajl
38
38
  dlopen_yajl_library
39
39
 
40
40
  class Parser
41
- require 'ffi_yajl/ext/parser'
41
+ require "ffi_yajl/ext/parser"
42
42
  include FFI_Yajl::Ext::Parser
43
43
  end
44
44
 
45
45
  class Encoder
46
- require 'ffi_yajl/ext/encoder'
46
+ require "ffi_yajl/ext/encoder"
47
47
  include FFI_Yajl::Ext::Encoder
48
48
  end
49
49
  end
@@ -20,18 +20,18 @@
20
20
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
 
23
- require 'rubygems'
23
+ require "rubygems" unless defined?(Gem)
24
24
 
25
- require 'libyajl2'
25
+ require "libyajl2"
26
26
  begin
27
- require 'ffi'
27
+ require "ffi" unless defined?(FFI)
28
28
  rescue LoadError
29
29
  $stderr.puts "FATAL: to use the ffi extension instead of the compiled C extension, the ffi gem must be installed"
30
30
  $stderr.puts " (it is optional, so you must include it in your bundle manually)"
31
31
  exit 1
32
32
  end
33
33
 
34
- require 'ffi_yajl/map_library_name'
34
+ require_relative "map_library_name"
35
35
 
36
36
  module FFI_Yajl
37
37
  extend ::FFI::Library
@@ -42,24 +42,24 @@ module FFI_Yajl
42
42
 
43
43
  class YajlCallbacks < ::FFI::Struct
44
44
  layout :yajl_null, :pointer,
45
- :yajl_boolean, :pointer,
46
- :yajl_integer, :pointer,
47
- :yajl_double, :pointer,
48
- :yajl_number, :pointer,
49
- :yajl_string, :pointer,
50
- :yajl_start_map, :pointer,
51
- :yajl_map_key, :pointer,
52
- :yajl_end_map, :pointer,
53
- :yajl_start_array, :pointer,
54
- :yajl_end_array, :pointer
45
+ :yajl_boolean, :pointer,
46
+ :yajl_integer, :pointer,
47
+ :yajl_double, :pointer,
48
+ :yajl_number, :pointer,
49
+ :yajl_string, :pointer,
50
+ :yajl_start_map, :pointer,
51
+ :yajl_map_key, :pointer,
52
+ :yajl_end_map, :pointer,
53
+ :yajl_start_array, :pointer,
54
+ :yajl_end_array, :pointer
55
55
  end
56
56
 
57
- enum :yajl_status, [
58
- :yajl_status_ok,
59
- :yajl_status_client_canceled,
60
- :yajl_status_insufficient_data,
61
- :yajl_status_error,
62
- ]
57
+ enum :yajl_status, %i{
58
+ yajl_status_ok
59
+ yajl_status_client_canceled
60
+ yajl_status_insufficient_data
61
+ yajl_status_error
62
+ }
63
63
 
64
64
  # FFI::Enums are slow, should remove the rest
65
65
  # enum :yajl_gen_status, [
@@ -97,22 +97,22 @@ module FFI_Yajl
97
97
  # const char *yajl_status_to_string (yajl_status code)
98
98
  attach_function :yajl_status_to_string, [ :yajl_status ], :string
99
99
  # yajl_handle yajl_alloc(const yajl_callbacks * callbacks, yajl_alloc_funcs * afs, void * ctx)
100
- attach_function :yajl_alloc, [:pointer, :pointer, :pointer], :yajl_handle
100
+ attach_function :yajl_alloc, %i{pointer pointer pointer}, :yajl_handle
101
101
  # void yajl_free (yajl_handle handle)
102
102
  attach_function :yajl_free, [:yajl_handle], :void
103
103
  # yajl_status yajl_parse (yajl_handle hand, const unsigned char *jsonText, unsigned int jsonTextLength)
104
- attach_function :yajl_parse, [:yajl_handle, :ustring, :uint], :yajl_status
104
+ attach_function :yajl_parse, %i{yajl_handle ustring uint}, :yajl_status
105
105
  # yajl_status yajl_parse_complete (yajl_handle hand)
106
106
  attach_function :yajl_complete_parse, [:yajl_handle], :yajl_status
107
107
  # unsigned char *yajl_get_error (yajl_handle hand, int verbose, const unsigned char *jsonText, unsigned int jsonTextLength)
108
- attach_function :yajl_get_error, [:yajl_handle, :int, :ustring, :int], :ustring
108
+ attach_function :yajl_get_error, %i{yajl_handle int ustring int}, :ustring
109
109
  # void yajl_free_error (yajl_handle hand, unsigned char *str)
110
- attach_function :yajl_free_error, [:yajl_handle, :ustring], :void
110
+ attach_function :yajl_free_error, %i{yajl_handle ustring}, :void
111
111
 
112
112
  #
113
- attach_function :yajl_config, [:yajl_handle, :yajl_option, :varargs], :int
113
+ attach_function :yajl_config, %i{yajl_handle yajl_option varargs}, :int
114
114
 
115
- attach_function :yajl_gen_config, [:yajl_gen, :yajl_gen_option, :varargs], :int
115
+ attach_function :yajl_gen_config, %i{yajl_gen yajl_gen_option varargs}, :int
116
116
 
117
117
  # yajl_gen yajl_gen_alloc (const yajl_alloc_funcs *allocFuncs)
118
118
  attach_function :yajl_gen_alloc, [:pointer], :yajl_gen
@@ -121,33 +121,33 @@ module FFI_Yajl
121
121
  # void yajl_gen_free (yajl_gen handle)
122
122
  attach_function :yajl_gen_free, [:yajl_gen], :void
123
123
 
124
- attach_function :yajl_gen_integer, [:yajl_gen, :long_long], :int
125
- attach_function :yajl_gen_double, [:yajl_gen, :double], :int
126
- attach_function :yajl_gen_number, [:yajl_gen, :ustring, :int], :int
127
- attach_function :yajl_gen_string, [:yajl_gen, :ustring, :int], :int
124
+ attach_function :yajl_gen_integer, %i{yajl_gen long_long}, :int
125
+ attach_function :yajl_gen_double, %i{yajl_gen double}, :int
126
+ attach_function :yajl_gen_number, %i{yajl_gen ustring int}, :int
127
+ attach_function :yajl_gen_string, %i{yajl_gen ustring int}, :int
128
128
  attach_function :yajl_gen_null, [:yajl_gen], :int
129
- attach_function :yajl_gen_bool, [:yajl_gen, :int], :int
129
+ attach_function :yajl_gen_bool, %i{yajl_gen int}, :int
130
130
  attach_function :yajl_gen_map_open, [:yajl_gen], :int
131
131
  attach_function :yajl_gen_map_close, [:yajl_gen], :int
132
132
  attach_function :yajl_gen_array_open, [:yajl_gen], :int
133
133
  attach_function :yajl_gen_array_close, [:yajl_gen], :int
134
134
  # yajl_gen_status yajl_gen_get_buf (yajl_gen hand, const unsigned char **buf, unsigned int *len)
135
- attach_function :yajl_gen_get_buf, [:yajl_gen, :pointer, :pointer], :int
135
+ attach_function :yajl_gen_get_buf, %i{yajl_gen pointer pointer}, :int
136
136
  # void yajl_gen_clear (yajl_gen hand)
137
137
  attach_function :yajl_gen_clear, [:yajl_gen], :void
138
138
  end
139
139
 
140
- require 'ffi_yajl/encoder'
141
- require 'ffi_yajl/parser'
140
+ require_relative "encoder"
141
+ require_relative "parser"
142
142
 
143
143
  module FFI_Yajl
144
144
  class Parser
145
- require 'ffi_yajl/ffi/parser'
145
+ require_relative "ffi/parser"
146
146
  include FFI_Yajl::FFI::Parser
147
147
  end
148
148
 
149
149
  class Encoder
150
- require 'ffi_yajl/ffi/encoder'
150
+ require_relative "ffi/encoder"
151
151
  include FFI_Yajl::FFI::Encoder
152
152
  end
153
153
  end