logo       

Sponsor
FREE Network Mapping Tool for Microsoft® Office Visio® Professional 2007
Don't map your network by hand - let LANsurveyor Exx press for Microsoft Visio Professional 2007 automatically create network diagrams for you!

Re: Method returning non-scalar: msg#00015

kde.devel.perl

Subject: Re: Method returning non-scalar

Germain,

I have applied the patch to 3.008. Works fine for me. I have tried it with my program and it runs without problem. In my special case I'll leave it with returning a reference to a lists anyway, since it is faster and it is in an inner loop.

Thanks for your help!

Regards, Ole.

Germain Garand wrote:
Le Mardi 23 Novembre 2004 07:41, Ole Christensen a écrit :

Hi again,
are you able to test the attached? That's what I intend to commit if all is fine.
I figured we were doing some useless stack copy instead of just proxying, so that should even be faster.


Greetings,
Germain


------------------------------------------------------------------------

Index: Qt.xs
===================================================================
RCS file: /cvsroot/perlqt/PerlQt-3/PerlQt/Qt.xs,v
retrieving revision 1.87
diff -u -3 -p -r1.87 Qt.xs
--- Qt.xs 29 Mar 2004 20:31:31 -0000 1.87
+++ Qt.xs 23 Nov 2004 07:50:55 -0000
@@ -993,17 +993,16 @@ XS(XS_AUTOLOAD) {
sv_this = newSVsv(ST(0));
}
- ENTER;
- SAVETMPS;
PUSHMARK(SP - items + withObject);
PUTBACK;
- int count = call_sv((SV*)GvCV(gv), G_SCALAR|G_EVAL);
+ I32 gimme = GIMME_V;
+ int count = call_sv((SV*)GvCV(gv), gimme|G_EVAL);
SPAGAIN;
- SV *ret = newSVsv(TOPs);
- SP -= count;
- PUTBACK;
- FREETMPS;
- LEAVE;
+ SP -= count;
+ if (withObject) // shift the stack
+ for (int i=0; i<count; i++)
+ ST(i) = ST(i+1);
+ PUTBACK;
if(withObject && !isSuper) {
SvREFCNT_dec(sv_this);
@@ -1014,8 +1013,10 @@ XS(XS_AUTOLOAD) {
if(SvTRUE(ERRSV))
croak(SvPV_nolen(ERRSV));
- ST(0) = sv_2mortal(ret);
- XSRETURN(1);
+ if (gimme == G_VOID)
+ XSRETURN_UNDEF;
+ else
+ XSRETURN(count);
}
else if(!strcmp(method, "DESTROY")) {
SV *old_this;


------------------------------------------------------------------------





Only community members can participate in forum threads. You must Register or log in to contribute.

<Prev in Thread] Current Thread [Next in Thread>
Sponsor
FREE Network Mapping Tool for Microsoft® OfficeVisio Professional 2007
Don't map your network by hand - let LANsurveyor Express for Microsoft Visio Professional 2007
automatically create network diagrams for you!
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | sitemap | advertise | OSDir is an inevitable website. super tiny logo