X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-raphf;a=blobdiff_plain;f=php_raphf.h;h=916f540cc68919cc5f682bb29277cb6fb251387a;hp=f363576ccd130cede4d253f8c50b64f9c76b7bfe;hb=270daf8e9486880a685a7a1837e6b847a288da4e;hpb=7dc5f4466f37d9681f9eb1c5130f13bc03edc63b diff --git a/php_raphf.h b/php_raphf.h index f363576..916f540 100644 --- a/php_raphf.h +++ b/php_raphf.h @@ -16,7 +16,7 @@ extern zend_module_entry raphf_module_entry; #define phpext_raphf_ptr &raphf_module_entry -#define PHP_RAPHF_VERSION "1.0.0" +#define PHP_RAPHF_VERSION "1.0.2" #ifdef PHP_WIN32 # define PHP_RAPHF_API __declspec(dllexport) @@ -30,9 +30,12 @@ extern zend_module_entry raphf_module_entry; # include "TSRM.h" #endif -typedef void *(*php_resource_factory_handle_ctor_t)(void *opaque, void *init_arg TSRMLS_DC); -typedef void *(*php_resource_factory_handle_copy_t)(void *opaque, void *handle TSRMLS_DC); -typedef void (*php_resource_factory_handle_dtor_t)(void *opaque, void *handle TSRMLS_DC); +typedef void *(*php_resource_factory_handle_ctor_t)(void *opaque, + void *init_arg TSRMLS_DC); +typedef void *(*php_resource_factory_handle_copy_t)(void *opaque, + void *handle TSRMLS_DC); +typedef void (*php_resource_factory_handle_dtor_t)(void *opaque, + void *handle TSRMLS_DC); typedef struct php_resource_factory_ops { php_resource_factory_handle_ctor_t ctor; @@ -49,14 +52,19 @@ typedef struct php_resource_factory { unsigned refcount; } php_resource_factory_t; -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_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_RAPHF_API unsigned php_resource_factory_addref(php_resource_factory_t *rf); PHP_RAPHF_API void php_resource_factory_dtor(php_resource_factory_t *f); PHP_RAPHF_API void php_resource_factory_free(php_resource_factory_t **f); -PHP_RAPHF_API void *php_resource_factory_handle_ctor(php_resource_factory_t *f, void *init_arg TSRMLS_DC); -PHP_RAPHF_API void *php_resource_factory_handle_copy(php_resource_factory_t *f, void *handle TSRMLS_DC); -PHP_RAPHF_API void php_resource_factory_handle_dtor(php_resource_factory_t *f, void *handle TSRMLS_DC); +PHP_RAPHF_API void *php_resource_factory_handle_ctor(php_resource_factory_t *f, + void *init_arg TSRMLS_DC); +PHP_RAPHF_API void *php_resource_factory_handle_copy(php_resource_factory_t *f, + void *handle TSRMLS_DC); +PHP_RAPHF_API void php_resource_factory_handle_dtor(php_resource_factory_t *f, + void *handle TSRMLS_DC); typedef struct php_persistent_handle_list { HashTable free; @@ -70,8 +78,10 @@ typedef struct php_persistent_handle_provider { typedef struct php_persistent_handle_factory php_persistent_handle_factory_t; -typedef void (*php_persistent_handle_wakeup_t)(php_persistent_handle_factory_t *f, void **handle TSRMLS_DC); -typedef void (*php_persistent_handle_retire_t)(php_persistent_handle_factory_t *f, void **handle TSRMLS_DC); +typedef void (*php_persistent_handle_wakeup_t)( + php_persistent_handle_factory_t *f, void **handle TSRMLS_DC); +typedef void (*php_persistent_handle_retire_t)( + php_persistent_handle_factory_t *f, void **handle TSRMLS_DC); struct php_persistent_handle_factory { php_persistent_handle_provider_t *provider; @@ -92,16 +102,28 @@ struct php_persistent_handle_globals { HashTable hash; }; -PHP_RAPHF_API int /* SUCCESS|FAILURE */ php_persistent_handle_provide(const char *name_str, size_t name_len, php_resource_factory_ops_t *fops, void *data, void (*dtor)(void *) TSRMLS_DC); -PHP_RAPHF_API 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_persistent_handle_retire_t retire TSRMLS_DC); -PHP_RAPHF_API void php_persistent_handle_abandon(php_persistent_handle_factory_t *a); -PHP_RAPHF_API void *php_persistent_handle_acquire(php_persistent_handle_factory_t *a, void *init_arg TSRMLS_DC); -PHP_RAPHF_API void php_persistent_handle_release(php_persistent_handle_factory_t *a, void *handle TSRMLS_DC); -PHP_RAPHF_API void *php_persistent_handle_accrete(php_persistent_handle_factory_t *a, void *handle TSRMLS_DC); - -PHP_RAPHF_API php_resource_factory_ops_t *php_persistent_handle_get_resource_factory_ops(void); - -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); +PHP_RAPHF_API int /* SUCCESS|FAILURE */ php_persistent_handle_provide( + const char *name_str, size_t name_len, php_resource_factory_ops_t *fops, + void *data, void (*dtor)(void *) TSRMLS_DC); +PHP_RAPHF_API 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_persistent_handle_retire_t retire TSRMLS_DC); +PHP_RAPHF_API void php_persistent_handle_abandon( + php_persistent_handle_factory_t *a); +PHP_RAPHF_API void *php_persistent_handle_acquire( + php_persistent_handle_factory_t *a, void *init_arg TSRMLS_DC); +PHP_RAPHF_API void php_persistent_handle_release( + php_persistent_handle_factory_t *a, void *handle TSRMLS_DC); +PHP_RAPHF_API void *php_persistent_handle_accrete( + php_persistent_handle_factory_t *a, void *handle TSRMLS_DC); + +PHP_RAPHF_API php_resource_factory_ops_t * +php_persistent_handle_get_resource_factory_ops(void); + +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); PHP_RAPHF_API HashTable *php_persistent_handle_statall(HashTable *ht TSRMLS_DC); ZEND_BEGIN_MODULE_GLOBALS(raphf) @@ -109,7 +131,8 @@ ZEND_BEGIN_MODULE_GLOBALS(raphf) ZEND_END_MODULE_GLOBALS(raphf) #ifdef ZTS -# define PHP_RAPHF_G ((zend_raphf_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(raphf_globals_id)]) +# 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