Re: String encoding in extension API
| From: | Behnam Esfahbod | Date: | Mon, 27 May 2013 04:20:43 +0000 |
| Subject: | Re: String encoding in extension API | ||
| References: | 1 2 3 4 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-10690@lists.php.net to get a copy of this message | ||
Thanks, Stag. That's what I thought. (couldn't find it in the documentation
though!)
-Behnam
On Mon, May 27, 2013 at 12:12 AM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:
> Hi!
>
> > I've just another quick question about RETURN_STRINGL(). I'm returning an
> > emalloc()-ed string and my understanding is that when the duplicate flag
> is
> > set to false, there's no need to efree() the memory of the returned
> result.
> > Is that correct?
>
> If duplicate is set to false, this means the returned string is owned by
> the receiving code, so you should not free it (and it is assumed it is
> emalloc-ed, so if it's not, never use duplicate=false on such string).
> If duplicate is set to true, the receiving code gets the duplicate, so
> you can do whatever you want with the original string.
>
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
>
--
Behnam Esfahbod | بهنام اسفهبد
http://behnam.es/
GPG-FP: 3E7F B4B6 6F4C A8AB 9BB9 7520 5701 CA40 259E 0F8B