-static inline STATUS php_persistent_handle_do_acquire(php_persistent_handle_provider_t *provider, const char *ident_str, size_t ident_len, void *init_arg, void **handle TSRMLS_DC)
-{
- ulong index;
- void **handle_ptr;
- php_persistent_handle_list_t *list;
-
- if ((list = php_persistent_handle_list_find(provider, ident_str, ident_len TSRMLS_CC))) {
- zend_hash_internal_pointer_end(&list->free);
- if (HASH_KEY_NON_EXISTANT != zend_hash_get_current_key(&list->free, NULL, &index, 0) && SUCCESS == zend_hash_get_current_data(&list->free, (void *) &handle_ptr)) {
- *handle = *handle_ptr;
- zend_hash_index_del(&list->free, index);
- } else {
- *handle = php_resource_factory_handle_ctor(&provider->rf, init_arg TSRMLS_CC);
- }
-#if PHP_RAPHF_DEBUG_PHANDLES
- fprintf(stderr, "CREATED: %p\n", *handle);
-#endif
- if (*handle) {
- ++provider->list.used;
- ++list->used;
- return SUCCESS;
- }
- } else {
- *handle = NULL;
- }
-
- return FAILURE;
-}
-
-static inline STATUS php_persistent_handle_do_release(php_persistent_handle_provider_t *provider, const char *ident_str, size_t ident_len, void **handle TSRMLS_DC)
-{
- php_persistent_handle_list_t *list;
-
- if ((list = php_persistent_handle_list_find(provider, ident_str, ident_len TSRMLS_CC))) {
- if (provider->list.used >= PHP_RAPHF_G->persistent_handle.limit) {
-#if PHP_RAPHF_DEBUG_PHANDLES
- fprintf(stderr, "DESTROY: %p\n", *handle);
-#endif
- php_resource_factory_handle_dtor(&provider->rf, *handle TSRMLS_CC);
- } else {
- if (SUCCESS != zend_hash_next_index_insert(&list->free, (void *) handle, sizeof(void *), NULL)) {
- return FAILURE;
- }
- }
-
- *handle = NULL;
- --provider->list.used;
- --list->used;
- return SUCCESS;
- }
-
- return FAILURE;
-}
-
-static inline STATUS php_persistent_handle_do_accrete(php_persistent_handle_provider_t *provider, const char *ident_str, size_t ident_len, void *old_handle, void **new_handle TSRMLS_DC)
-{
- php_persistent_handle_list_t *list;
-
- if ((*new_handle = php_resource_factory_handle_copy(&provider->rf, old_handle TSRMLS_CC))) {
- if ((list = php_persistent_handle_list_find(provider, ident_str, ident_len TSRMLS_CC))) {
- ++list->used;
- }
- ++provider->list.used;
- return SUCCESS;
- }
- return FAILURE;
-}
-