Re: String encoding in extension API
| From: | Stas Malyshev | Date: | Mon, 27 May 2013 04:12:02 +0000 |
| Subject: | Re: String encoding in extension API | ||
| References: | 1 2 3 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-10689@lists.php.net to get a copy of this message | ||
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