Re: RETURN_STRING...
| From: | Zeev Suraski | Date: | Wed, 22 Nov 2000 19:28:37 +0000 |
| Subject: | Re: RETURN_STRING... | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-38941@lists.php.net to get a copy of this message | ||
The engine expects to receive an allocated string, and assumes responsibility for freeing it.
So, you should duplicate the string if:
1. The string is static (e.g., RETURN_STRING("foo",...))
2. The string is referenced by other parts in PHP. For instance, if you return a string that you got as an argument to your function, you must duplicate it.
Zeev
At 21:01 22/11/2000, David Muse wrote:
I'm working on a PHP module and have several functions which return the (char *) results of other functions. I assume I should use RETURN_STRING to do this, but under what circumstances should I tell RETURN_STRING to duplicate the string? David Muse david.muse@zapmedia.com -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net-- Zeev Suraski <zeev@zend.com> CTO, Zend Technologies Ltd. http://www.zend.com/