Permalink
Browse files

Fix enums in jruby

Jruby does not yield FFI::MemoryPointer. Gathering possible values of an
enum field relied on that. This commit uses a different syntax.
  • Loading branch information...
1 parent 94fc091 commit 01fc06c7e483a3386da50200433649ba20431794 @libc committed Dec 11, 2012
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/tidy_ffi/interface.rb
View
@@ -100,15 +100,16 @@ def pick_list_for(opt)
pick_list = []
- FFI::MemoryPointer.new(:pointer, 1) do |pointer|
- pointer.put_pointer(0, iterator)
- until iterator.null?
- pick_list << LibTidy.tidyOptGetNextPick(opt, pointer)
- iterator = pointer.get_pointer(0)
- end
+ pointer = FFI::MemoryPointer.new(:pointer, 1)
+ pointer.put_pointer(0, iterator)
+ until iterator.null?
+ pick_list << LibTidy.tidyOptGetNextPick(opt, pointer)
+ iterator = pointer.get_pointer(0)
end
pick_list
+ ensure
+ pointer.free if pointer
end
private :pick_list_for

0 comments on commit 01fc06c

Please sign in to comment.