#include "ext/standard/info.h"
#include "php_raphf.h"
+struct php_persistent_handle_globals {
+ ulong limit;
+ HashTable hash;
+};
+
+ZEND_BEGIN_MODULE_GLOBALS(raphf)
+ struct php_persistent_handle_globals persistent_handle;
+ZEND_END_MODULE_GLOBALS(raphf)
+
+#ifdef ZTS
+# define PHP_RAPHF_G ((zend_raphf_globals *) \
+ (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(raphf_globals_id)])
+#else
+# define PHP_RAPHF_G (&raphf_globals)
+#endif
+
ZEND_DECLARE_MODULE_GLOBALS(raphf)
typedef int STATUS;
# define inline
#endif
-PHP_RAPHF_API php_resource_factory_t *php_resource_factory_init(
- php_resource_factory_t *f, php_resource_factory_ops_t *fops, void *data,
- void (*dtor)(void *data))
+php_resource_factory_t *php_resource_factory_init(php_resource_factory_t *f,
+ php_resource_factory_ops_t *fops, void *data, void (*dtor)(void *data))
{
if (!f) {
f = emalloc(sizeof(*f));
return f;
}
-PHP_RAPHF_API unsigned php_resource_factory_addref(php_resource_factory_t *rf)
+unsigned php_resource_factory_addref(php_resource_factory_t *rf)
{
return ++rf->refcount;
}
-PHP_RAPHF_API void php_resource_factory_dtor(php_resource_factory_t *f)
+void php_resource_factory_dtor(php_resource_factory_t *f)
{
--f->refcount;
}
}
-PHP_RAPHF_API void php_resource_factory_free(php_resource_factory_t **f)
+void php_resource_factory_free(php_resource_factory_t **f)
{
if (*f) {
php_resource_factory_dtor(*f);
}
}
-PHP_RAPHF_API void *php_resource_factory_handle_ctor(php_resource_factory_t *f,
+void *php_resource_factory_handle_ctor(php_resource_factory_t *f,
void *init_arg TSRMLS_DC)
{
if (f->fops.ctor) {
return NULL;
}
-PHP_RAPHF_API void *php_resource_factory_handle_copy(php_resource_factory_t *f,
+void *php_resource_factory_handle_copy(php_resource_factory_t *f,
void *handle TSRMLS_DC)
{
if (f->fops.copy) {
return NULL;
}
-PHP_RAPHF_API void php_resource_factory_handle_dtor(php_resource_factory_t *f,
+void php_resource_factory_handle_dtor(php_resource_factory_t *f,
void *handle TSRMLS_DC)
{
if (f->fops.dtor) {
return status;
}
-PHP_RAPHF_API php_persistent_handle_factory_t *php_persistent_handle_concede(
+php_persistent_handle_factory_t *php_persistent_handle_concede(
php_persistent_handle_factory_t *a, const char *name_str,
size_t name_len, const char *ident_str, size_t ident_len,
php_persistent_handle_wakeup_t wakeup,
}
}
-PHP_RAPHF_API void *php_persistent_handle_acquire(
+void *php_persistent_handle_acquire(
php_persistent_handle_factory_t *a, void *init_arg TSRMLS_DC)
{
int key;
return handle;
}
-PHP_RAPHF_API void *php_persistent_handle_accrete(
+void *php_persistent_handle_accrete(
php_persistent_handle_factory_t *a, void *handle TSRMLS_DC)
{
void *new_handle = NULL;
return new_handle;
}
-PHP_RAPHF_API void php_persistent_handle_release(
+void php_persistent_handle_release(
php_persistent_handle_factory_t *a, void *handle TSRMLS_DC)
{
php_persistent_handle_list_t *list;
}
}
-PHP_RAPHF_API void php_persistent_handle_cleanup(const char *name_str,
- size_t name_len, const char *ident_str, size_t ident_len TSRMLS_DC)
+void php_persistent_handle_cleanup(const char *name_str, size_t name_len,
+ const char *ident_str, size_t ident_len TSRMLS_DC)
{
php_persistent_handle_provider_t *provider;
php_persistent_handle_list_t *list;
}
}
-PHP_RAPHF_API HashTable *php_persistent_handle_statall(HashTable *ht TSRMLS_DC)
+HashTable *php_persistent_handle_statall(HashTable *ht TSRMLS_DC)
{
if (zend_hash_num_elements(&PHP_RAPHF_G->persistent_handle.hash)) {
if (!ht) {
(php_resource_factory_handle_dtor_t) php_persistent_handle_release
};
-PHP_RAPHF_API php_resource_factory_ops_t *
-php_persistent_handle_get_resource_factory_ops(void)
+php_resource_factory_ops_t *php_persistent_handle_get_resource_factory_ops(void)
{
return &php_persistent_handle_resource_factory_ops;
}