| 1 |
|
| MODULE = FFI::Raw PACKAGE = FFI::Raw::Callback |
| 2 |
|
| |
| 3 |
|
| FFI_Raw_Callback_t * |
| 4 |
|
| new(class, coderef, ret_type, ...) |
| 5 |
|
| SV *class |
| 6 |
|
| SV *coderef |
| 7 |
|
| SV *ret_type |
| 8 |
|
| |
| 9 |
|
| PREINIT: |
| 10 |
|
| int status; |
| 11 |
|
| |
| 12 |
|
| FFI_Raw_Callback_t *ffi_raw_cb; |
| 13 |
|
| |
| 14 |
|
| CODE: |
| 15 |
7 |
| Newx(ffi_raw_cb, 1, FFI_Raw_Callback_t); |
| 16 |
|
| |
| 17 |
7 |
| ffi_raw_cb -> coderef = SvREFCNT_inc(coderef); |
| 18 |
7 |
| ffi_raw_cb -> ret_value = NULL; |
| 19 |
|
| |
| 20 |
7 |
| ffi_raw_cb -> closure = ffi_closure_alloc( |
| 21 |
|
| sizeof(ffi_closure), |
| 22 |
|
| &ffi_raw_cb -> fn |
| 23 |
|
| ); |
| 24 |
|
| |
| 25 |
10 |
▶ | INIT_FFI_CIF(ffi_raw_cb, 3) |
Branch: 2 branches
| Branch | True | False | Total |
| INIT_FFI_CIF(ffi_raw_cb, 3) |
3 |
7 |
10 |
| INIT_FFI_CIF(ffi_raw_cb, 3) |
0 |
7 |
7 |
|
| 26 |
|
| |
| 27 |
7 |
| status = ffi_prep_closure_loc( |
| 28 |
|
| ffi_raw_cb -> closure, &ffi_raw_cb -> cif, |
| 29 |
|
| _ffi_raw_cb_wrap, ffi_raw_cb, |
| 30 |
|
| ffi_raw_cb -> fn |
| 31 |
|
| ); |
| 32 |
|
| |
| 33 |
7 |
| RETVAL = ffi_raw_cb; |
| 34 |
|
| |
| 35 |
|
| OUTPUT: RETVAL |
| 36 |
|
| |
| 37 |
|
| void |
| 38 |
|
| DESTROY(self) |
| 39 |
|
| FFI_Raw_Callback_t *self |
| 40 |
|
| |
| 41 |
|
| CODE: |
| 42 |
7 |
| SvREFCNT_dec(self -> coderef); |
| 43 |
|
| |
| 44 |
7 |
| ffi_closure_free(self -> closure); |
| 45 |
|
| |
| 46 |
7 |
▶ | if (self -> ret_value != NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (self -> ret_value != NULL) |
0 |
7 |
7 |
|
| 47 |
0 |
| Safefree(self -> ret_value); |
| 48 |
7 |
| Safefree(self -> args_types); |
| 49 |
7 |
| Safefree(self -> args); |
| 50 |
7 |
| Safefree(self); |