zval_ptr_dtor(&retval);
}
+static void user_space_stream_notifier_dtor(php_stream_notifier *notifier)
+{
+ if (notifier && notifier->ptr) {
+ zval_ptr_dtor((zval **)&(notifier->ptr));
+ notifier->ptr = NULL;
+ }
+}
+
static int parse_context_options(php_stream_context *context, zval *options)
{
HashPosition pos, opos;
context->notifier->func = user_space_stream_notifier;
context->notifier->ptr = *tmp;
ZVAL_ADDREF(*tmp);
+ context->notifier->dtor = user_space_stream_notifier_dtor;
}
if ((ret = zend_hash_find(Z_ARRVAL_P(params), "options", sizeof("options"), (void**)&tmp)) == SUCCESS) {
parse_context_options(context, *tmp);
typedef struct _php_stream_wrapper php_stream_wrapper;
typedef struct _php_stream_context php_stream_context;
typedef struct _php_stream_filter php_stream_filter;
+typedef struct _php_stream_notifier php_stream_notifier;
/* callback for status notifications */
typedef void (*php_stream_notification_func)(php_stream_context *context,
#define PHP_STREAM_NOTIFIER_PROGRESS 1
-typedef struct _php_stream_notifier {
+struct _php_stream_notifier {
php_stream_notification_func func;
+ void (*dtor)(php_stream_notifier *notifier);
void *ptr;
int mask;
size_t progress, progress_max; /* position for progress notification */
-} php_stream_notifier;
+};
struct _php_stream_context {
php_stream_notifier *notifier;