Re: Re: cvs: php-src / NEWS /ext/pgsql config.m4 config.w32pgsql.c /ext/pgsql/tests 08escape.phpt 25async_query_params.phpt
| From: | Rasmus Lerdorf | Date: | Wed, 30 Mar 2005 04:48:06 +0000 |
| Subject: | Re: Re: cvs: php-src / NEWS /ext/pgsql config.m4 config.w32pgsql.c /ext/pgsql/tests 08escape.phpt 25async_query_params.phpt | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-15678@lists.php.net to get a copy of this message | ||
Christopher Kings-Lynne wrote:
Ah, I see your confusion. Do this:But if you return and duplicate, you have no chance to free() the original string, no?take a look at the RETURN_STRING[L] macro. the last argument determines whether the string passed to it is duplicated by PHP before returning it to the user.
RETVAL_STRINGL(str, strlen, 1);
free(str);
The trick is that the RETVAL_* macros simply fill in the magic return_value zval whereas the RETURN_* macros return straight away.
-Rasmus