Debian Codegraph @

typemap

raw
1 TYPEMAP
2 char * O_CHAR
3 const char * T_PV
4 GeoIP * O_OBJECT
5 GeoIPRecord * O_OBJECT
6 float T_FLOAT
7
8 INPUT
9 O_OBJECT
10 if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
11 $var = ($type)SvIV((SV*)SvRV( $arg ));
12 else{
13 warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" );
14 XSRETURN_UNDEF;
15 }
16
17 # this is just here because a O_CHAR input is required to compile,
18 # should be same as if O_CHAR wasn't defined
19 O_CHAR
20 $var = ($type)SvPVbyte_nolen ($arg)
21
22 OUTPUT
23
24 # The Perl object is blessed into 'CLASS', which should be a
25 # char* having the name of the package for the blessing.
26 O_OBJECT
27 sv_setref_pv( $arg, (char *)CLASS, (void*)$var );
28
29 # prevent memory leaks with malloc'ed returned char * strings
30 O_CHAR
31 if($var != NULL) {
32 $arg = newSVpv($var, strlen($var));
33 free($var);
34 sv_2mortal($arg);
35 }