lib/ffi/clang/index.rb in ffi-clang-0.1.3 vs lib/ffi/clang/index.rb in ffi-clang-0.2.0

- old
+ new

@@ -36,24 +36,24 @@ command_line_args = Array(command_line_args) unsaved_files = unsaved_pointer_from(unsaved) translation_unit_pointer = Lib.parse_translation_unit(self, source_file, args_pointer_from(command_line_args), command_line_args.size, unsaved_files, unsaved.length, options_bitmask_from(opts)) - raise Error, "error parsing #{source_file.inspect}" unless translation_unit_pointer + raise Error, "error parsing #{source_file.inspect}" if translation_unit_pointer.null? - TranslationUnit.new translation_unit_pointer + TranslationUnit.new translation_unit_pointer, self end private def args_pointer_from(command_line_args) - args_pointer = MemoryPointer.new(:pointer) + args_pointer = MemoryPointer.new(:pointer, command_line_args.length) strings = command_line_args.map do |arg| MemoryPointer.from_string(arg.to_s) end - args_pointer.put_array_of_pointer(strings) unless strings.empty? + args_pointer.put_array_of_pointer(0, strings) unless strings.empty? args_pointer end def options_bitmask_from(opts) Lib.bitmask_from Lib::TranslationUnitFlags, opts