#endif
struct php_persistent_handle_globals {
- ulong limit;
+ unsigned long limit;
HashTable hash;
};
}
static inline php_persistent_handle_list_t *php_persistent_handle_list_find(
- php_persistent_handle_provider_t *provider, zend_string *ident)
+ php_persistent_handle_provider_t *provider, zend_string *ident,
+ zend_bool create)
{
php_persistent_handle_list_t *list;
zval *zlist = zend_symtable_find(&provider->list.free, ident);
return list;
}
- if ((list = php_persistent_handle_list_init(NULL))) {
+ if (create && (list = php_persistent_handle_list_init(NULL))) {
zval p, *rv;
zend_string *id;
php_persistent_handle_list_t *list;
if (ident && ident->len) {
- if ((list = php_persistent_handle_list_find(provider, ident))) {
+ if ((list = php_persistent_handle_list_find(provider, ident, 0))) {
zend_hash_apply_with_argument(&list->free,
php_persistent_handle_apply_cleanup_ex,
&provider->rf);
void *handle = NULL;
php_persistent_handle_list_t *list;
- list = php_persistent_handle_list_find(a->provider, a->ident);
+ list = php_persistent_handle_list_find(a->provider, a->ident, 1);
if (list) {
zend_hash_internal_pointer_end(&list->free);
key = zend_hash_get_current_key(&list->free, NULL, &index);
new_handle = php_resource_factory_handle_copy(&a->provider->rf, handle);
if (handle) {
- list = php_persistent_handle_list_find(a->provider, a->ident);
+ list = php_persistent_handle_list_find(a->provider, a->ident, 1);
if (list) {
++list->used;
}
{
php_persistent_handle_list_t *list;
- list = php_persistent_handle_list_find(a->provider, a->ident);
+ list = php_persistent_handle_list_find(a->provider, a->ident, 1);
if (list) {
if (a->provider->list.used >= PHP_RAPHF_G->persistent_handle.limit) {
#if PHP_RAPHF_DEBUG_PHANDLES
if (zprovider && (provider = Z_PTR_P(zprovider))) {
if (ident) {
- list = php_persistent_handle_list_find(provider, ident);
+ list = php_persistent_handle_list_find(provider, ident, 0);
if (list) {
zend_hash_apply_with_argument(&list->free,
php_persistent_handle_apply_cleanup_ex,
zend_hash_key *super_key = va_arg(argv, zend_hash_key *);
char used[21], free[21];
- slprintf(used, sizeof(used), "%u", list->used);
+ slprintf(used, sizeof(used), "%lu", list->used);
slprintf(free, sizeof(free), "%d", zend_hash_num_elements(&list->free));
php_info_print_table_row(4, super_key->key->val, key->key->val, used, free);