Skip to content

Commit

Permalink
minor improvement on plus
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpclark committed Sep 10, 2017
1 parent 75ad228 commit f4ff481
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
8 changes: 1 addition & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ task :build_src do
sh "cargo build --release"
end

desc "Build Rust extension"
task :test_build_src do
puts "Building extension..."
sh "cargo build"
end

desc "Clean up Rust build"
task :clean_src do
puts "Cleaning up build..."
Expand Down Expand Up @@ -68,7 +62,7 @@ task :cargo do
sh "cargo test -- --nocapture"
end

Rake::TestTask.new(minitest: :test_build_src) do |t|
Rake::TestTask.new(minitest: :build_lib) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList['test/**/*_test.rb']
Expand Down
1 change: 0 additions & 1 deletion lib/faster_path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def to_a
attach_function :dirname_for_chop, [ :string ], :string
attach_function :has_trailing_separator, [ :string ], :bool
attach_function :entries, [ :string ], FromRustArray.by_value
# attach_function :free_array, [ FromRustArray ], :void
end
private_constant :Rust
end
6 changes: 2 additions & 4 deletions lib/ffi/plus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

class FasterPath::Plus < FFI::AutoPointer
def self.release(ptr)
!null? and Binding.free(ptr)
Binding.free(ptr)
end

def to_s
@str ||= begin
null? ? nil : read_string.force_encoding('UTF-8')
end
@str ||= read_string
end

module Binding
Expand Down

0 comments on commit f4ff481

Please sign in to comment.