Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix libpcre2 bindings function pointers #13090

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/regex/lib_pcre2.cr
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,10 @@ lib LibPCRE2
fun get_ovector_pointer = pcre2_get_ovector_pointer_8(match_data : MatchData*) : LibC::SizeT*
fun get_ovector_count = pcre2_get_ovector_count_8(match_data : MatchData*) : UInt32

# void *private_malloc(Int, void *);
# void private_free(void *, void *);
fun general_context_create = pcre2_general_context_create_8(private_malloc : Void*, private_free : Void*, memory_data : Void*) : GeneralContext
fun general_context_create = pcre2_general_context_create_8(
private_malloc : LibC::SizeT, Void* -> Void,
private_free : Void*, Void* -> Void,
memory_data : Void*
) : GeneralContext
fun config = pcre2_config_8(what : UInt32, where : Void*) : Int
end
2 changes: 1 addition & 1 deletion src/regex/pcre2.cr
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ module Regex::PCRE2
end

class_getter general_context do
LibPCRE2.general_context_create(->(size : LibC::Int, data : Void*) { GC.malloc(size) }.pointer, ->(pointer : Void*, data : Void*) { GC.free(pointer) }.pointer, nil)
LibPCRE2.general_context_create(->(size, _data) { GC.malloc(size) }, ->(pointer, _data) { GC.free(pointer) }, nil)
end

# Returns a JIT stack that's shared in the current thread.
Expand Down