From b93e7f0e1e15a1bbbcd9031bc4b66a5c60686eca Mon Sep 17 00:00:00 2001 From: Matthew Horsfall Date: Fri, 7 Feb 2014 09:41:09 -0500 Subject: [PATCH] Add some examples to cv_set_call_checker and wrap_op_checker --- op.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/op.c b/op.c index 0174e32..2155a1a 100644 --- a/op.c +++ b/op.c @@ -10774,8 +10774,11 @@ subroutine call, not marked with C<&>, where the callee can be identified at compile time as I. The C-level function pointer is supplied in I, and an SV argument -for it is supplied in I. The function is intended to be called -in this manner: +for it is supplied in I. The function should be defined like this: + + STATIC OP * ckfun(pTHX_ OP *op, GV *namegv, SV *ckobj) + +It is intended to be called in this manner: entersubop = ckfun(aTHX_ entersubop, namegv, ckobj); @@ -12384,6 +12387,18 @@ pointer to the next function in the chain will be stored. The value of I is written into the L array, while the value previously stored there is written to I<*old_checker_p>. +The function should be defined like this: + + static OP *new_checker(pTHX_ OP *op) { ... } + +It is intended to be called in this manner: + + new_checker(aTHX_ op) + +I should be defined like this: + + static Perl_check_t old_checker_p; + L is global to an entire process, and a module wishing to hook op checking may find itself invoked more than once per process, typically in different threads. To handle that situation, this function -- 2.7.4