File Coverage

easyxs/easyxs_structref.h
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine n/a
pod n/a
total 6 6 100.0


line stmt bran cond sub pod time code
1             #ifndef EASYXS_STRUCTREF_H
2             #define EASYXS_STRUCTREF_H 1
3              
4             #include "init.h"
5              
6             #define exs_new_structref(type, classname) _exs_new_structref_f(aTHX_ sizeof(type), classname)
7              
8             #define exs_structref_ptr(svrv) ( (void *) SvPVX( SvRV(svrv) ) )
9              
10 19           static inline SV* _exs_new_structref_f (pTHX_ unsigned size, const char* classname) {
11              
12 19           SV* referent = newSV(size);
13 19           SvPOK_on(referent);
14              
15 19           SV* reference = newRV_noinc(referent);
16 19           sv_bless(reference, gv_stashpv(classname, FALSE));
17              
18 19           return reference;
19             }
20              
21             #endif