Add doc comment to SetCallout function

This commit is contained in:
Elara 2023-07-16 23:27:57 -07:00
parent 23f1d484df
commit 709b261b4e

View File

@ -626,6 +626,9 @@ type CalloutBlock struct {
CalloutFlags CalloutFlags CalloutFlags CalloutFlags
} }
// SetCallout sets a callout function that will be called at specified points in the matching operation.
// fn should return zero if it ran successfully or a non-zero integer to force an error.
// See https://www.pcre.org/current/doc/html/pcre2callout.html for more information.
func (r *Regexp) SetCallout(fn func(cb *CalloutBlock) int32) error { func (r *Regexp) SetCallout(fn func(cb *CalloutBlock) int32) error {
cfn := func(tls *libc.TLS, cbptr, data uintptr) int32 { cfn := func(tls *libc.TLS, cbptr, data uintptr) int32 {
ccb := (*lib.Tpcre2_callout_block_8)(unsafe.Pointer(cbptr)) ccb := (*lib.Tpcre2_callout_block_8)(unsafe.Pointer(cbptr))