Re: Re: [DICUSS]Cleanup resource handling APIs
| From: | Xinchen Hui | Date: | Wed, 04 Feb 2015 04:05:18 +0000 |
| Subject: | Re: Re: [DICUSS]Cleanup resource handling APIs | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81758@lists.php.net to get a copy of this message | ||
Hey:
On Tue, Feb 3, 2015 at 12:37 AM, François Laupretre
<francois@tekwire.net> wrote:
>> De : Xinchen Hui [mailto:laruence@php.net]
>> furthermore, I'd like to discuss remove the handle in zend_resource struct..
>>
>> it may breaks some usage (use resource as long/double/string)
>>
>> case IS_RESOURCE: {
>> char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG];
>> int len;
>>
>> len = snprintf(buf, sizeof(buf), "Resource id #"
>> ZEND_LONG_FMT, (zend_long)Z_RES_HANDLE_P(op));
>> return zend_string_init(buf, len, 0);
>> }
>
> I don't understand how you can delete the resource if you remove the handle from the
> zend_resource struct. Or would you store the index elsewhere ?
if you use HashTable , yes, it's hard to get rid of it, but we can
hidden it from user land..
and actually, we only use integer index of regular_list for zend_resource...
if we decide to remove handle, then it maybe easy to re-implement it
as a plain c array like zend_resource[];
and when doing realloce, we allocate new segment, and link them togther. etc
thanks
>
> Regards
>
> François
>
--
Xinchen Hui
@Laruence
http://www.laruence.com/