Re: [Dbi-interbase-devel] set_txn_param fix confirmed
Status: Beta
Brought to you by:
edpratomo
From: Daniel R. <dan...@gm...> - 2001-08-01 17:38:54
|
it was the first time i was using XS... why it is better? * short answer: because it now works :-) * long answer: because SvRV dereferences a Perl reference (RV*) and returns an SV*, AV* or HV*. to which one you have to cast it to can be figured out using SvTYPE. to check if a SV* contains a reference you can use SvROK....(SvRV should always be used in combination with SvROK -> value = SvRV(SvROK(reference)); but av_fetch() returns a SV** which is only a pointer to an SV*, not a RV*, so dereferencing a non RV* crashes Perl.... see http://www.perldoc.com/perl5.6/pod/perlguts.html for explaination of these macros, and http://www.perldoc.com/perl5.6/pod/perlxs.html for an XS manual, http://www.perldoc.com/perl5.6/pod/perlxstut.html for a (still incomplete) XS tutorial, http://gisle.aas.no/perl/illguts/ for detailed description of Perl data structures rgds -daniel ----- Original Message ----- From: "Mark D. Anderson" <md...@di...> To: <dbi...@li...> Sent: Wednesday, August 01, 2001 7:02 PM Subject: [Dbi-interbase-devel] set_txn_param fix confirmed > thanks for the fix in 28.4. > > for us XS neophytes, what was the bug? > > why is > svp = av_fetch(av, j, FALSE); > if ( strEQ( SvPV_nolen(*svp), "read_committed" )) > > better than > sv = (SV*)SvRV(*av_fetch(av, j, FALSE)); > if ( strEQ( SvPV(sv, PL_na), "read_committed" )) { > > -mda > > > > _______________________________________________ > Dbi-interbase-devel mailing list > Dbi...@li... > http://lists.sourceforge.net/lists/listinfo/dbi-interbase-devel > |