Free parse result.
This commit is contained in:
parent
6e34e0c8fb
commit
7bdd8b7ce2
2 changed files with 4 additions and 2 deletions
|
|
@ -53,7 +53,7 @@ module Hammer
|
|||
# h_bind_indirect
|
||||
|
||||
# free the parse result
|
||||
# h_parse_result_free
|
||||
attach_function :h_parse_result_free, [:pointer], :void
|
||||
|
||||
# TODO: Does the HParser* need to be freed?
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ module Hammer
|
|||
def parse(data)
|
||||
raise RuntimeError, '@h_parser is nil' if @h_parser.nil?
|
||||
raise ArgumentError, 'expecting a String' unless data.is_a? String # TODO: Not needed, FFI checks that.
|
||||
result = Hammer::Internal.h_parse(@h_parser, data, data.length);
|
||||
result = Hammer::Internal.h_parse(@h_parser, data, data.length)
|
||||
# TODO: Do something with the data
|
||||
# (wrap in garbage-collected object, call h_parse_result_free when destroyed by GC)
|
||||
Hammer::Internal.h_parse_result_free(result)
|
||||
!result.null?
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue