Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19879 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33813 invoked by uid 1010); 1 Nov 2005 09:25:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 33798 invoked from network); 1 Nov 2005 09:25:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Nov 2005 09:25:50 -0000 X-Host-Fingerprint: 80.123.98.46 unknown Received: from ([80.123.98.46:19799] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 25/FC-02082-C9437634 for ; Tue, 01 Nov 2005 04:25:48 -0500 Message-ID: <25.FC.02082.C9437634@pb1.pair.com> To: internals@lists.php.net Date: Tue, 01 Nov 2005 10:29:21 +0100 User-Agent: Thunderbird 1.4 (Windows/20050908) MIME-Version: 1.0 References: <002f01c5deb0$2a2e87b0$5d54edc6@jake> In-Reply-To: <002f01c5deb0$2a2e87b0$5d54edc6@jake> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Posted-By: 80.123.98.46 Subject: Re: Question on return_value From: mike@php.net (Michael Wallner) Bob Silva wrote: > Hi, >=20 > I have an internal function defined that returns an array zval: > zval *pow_zstring_internal_split(Z_STRVAL_P(ivalue), separator, count, = 0 > TSRMLS_DC); > =20 >=20 > When I call it like this, return_value is NULL in userland. >=20 > return_value =3D pow_zstring_internal_split(Z_STRVAL_P(ivalue), separat= or, > count, 0 TSRMLS_CC); The outta world doesn't care if you let return_value point else where in your function. Look up the chapter pointers in your book. Short version:= You need a pointer to a pointer so that the caller gets another pointer. > But when I call it like this, it works as expected and an array is retu= rned > to userland >=20 > array =3D pow_zstring_internal_split(Z_STRVAL_P(ivalue), separator, cou= nt, 0 > TSRMLS_CC); >=20 > *return_value =3D *array; Yes, because you change the members of the struct the pointer points at a= nd the pointer is still the same of that of the "outta world". > I'm sure there is an obvious answer, but given my background (or lack > thereof) in C, I can't figure it out. >=20 > How does the temporary assignment change things inside the engine? H=E4? :) Regards, --=20 Michael - http://dev.iworks.at/ext-http/http-functions.h= tml.gz