easyxs/easyxs_structref.h

filter: Statementstmt 100% 6 / 6 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 6 / 6 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« Document.xs ↑ Summary
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 20 static inline SV* _exs_new_structref_f (pTHX_ unsigned size, const char* classname) {
11  
12 20 SV* referent = newSV(size);
13 20 SvPOK_on(referent);
14  
15 20 SV* reference = newRV_noinc(referent);
16 20 sv_bless(reference, gv_stashpv(classname, FALSE));
17  
18 20 return reference;
19 }
20  
21 #endif
« Document.xs ↑ Summary