duplicate should only ever be set to 0 on this (or any of the
macros) when
the string *is* allocated with emalloc. Otherwise the
enegine would get in
trouble freeing it later on.
No. :(
You can use ZVAL_RT_STRING(&fname, "strlen", 0), then call
zend_call_function(&fname) and do not destroy fname.
Doi, of course, good point...
Okay, then the options are:
(1) Assume auto_free for RETURN_RT_STRING(s,0) specifically as in this case,
my statement above is valid since the engine IS going to try it eventually.
Leave all other macros alone and make the calling scope handle the original
string with the existing if (UG(unicode)) efree(s); Not my favorite.
(2) Expand (ZVAL|RETVAL)_RT_STRING(s, 0) to include auto_free argument.
This coule be done in conjunction with (1) or in place of it.
(3) Overload duplicate argument to include (should I auto-free?) logic.
(4) Duplicate the macros to one auto-free, and one non-auto-free version.
I like the #1/#2 combo personally.
-Sara
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php