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 45           static inline SV* _exs_new_structref_f (pTHX_ unsigned size, const char* classname) {
11              
12 45           SV* referent = newSV(size);
13 45           SvPOK_on(referent);
14              
15 45           SV* reference = newRV_noinc(referent);
16 45           sv_bless(reference, gv_stashpv(classname, FALSE));
17              
18 45           return reference;
19             }
20              
21             #endif