remove pass_state callback flag
authorMichael Wallner <mike@php.net>
Wed, 12 Dec 2012 11:41:20 +0000 (11:41 +0000)
committerMichael Wallner <mike@php.net>
Wed, 12 Dec 2012 11:41:20 +0000 (11:41 +0000)
php_http_client.c
php_http_client.h

index 80de97724fa72300180653f5ab784605a99da534..5aca3bce113917231e7be63815f9975a92e0b521 100644 (file)
@@ -395,7 +395,6 @@ STATUS php_http_client_object_handle_request(zval *zclient, zval **zreq TSRMLS_D
                        php_http_client_progress_callback_t *callback = emalloc(sizeof(*callback));
 
                        callback->type = PHP_HTTP_CLIENT_PROGRESS_CALLBACK_USER;
-                       callback->pass_state = 0;
                        MAKE_STD_ZVAL(callback->func.user);
                        array_init(callback->func.user);
                        Z_ADDREF_P(zclient);
@@ -984,7 +983,7 @@ PHP_METHOD(HttpClient, send)
 
 PHP_MINIT_FUNCTION(http_client)
 {
-       PHP_HTTP_REGISTER_CLASS(http\\Client, AbstractClient, http_client, php_http_object_get_class_entry(), ZEND_ACC_ABSTRACT);
+       PHP_HTTP_REGISTER_CLASS(http\\Client, AbstractClient, http_client, php_http_object_get_class_entry(), ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
        php_http_client_class_entry->create_object = php_http_client_object_new;
        memcpy(&php_http_client_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
        php_http_client_object_handlers.clone_obj = php_http_client_object_clone;
index 8e3d8b46e6bb71d9e82a39a63ed95c406a82d7c9..fb4a600027017be46e15e93c616585be0f5559cb 100644 (file)
@@ -38,7 +38,6 @@ typedef struct php_http_client_progress_callback {
                void (*intern)(php_http_client_progress_state_t* TSRMLS_DC);
        } func;
        unsigned type:1;
-       unsigned pass_state:1;
 } php_http_client_progress_callback_t;
 
 typedef struct php_http_client_progress {
@@ -69,32 +68,12 @@ static inline void php_http_client_progress_notify(php_http_client_progress_t *p
                with_error_handling(EH_NORMAL, NULL) {
                        switch (progress->callback->type) {
                                case PHP_HTTP_CLIENT_PROGRESS_CALLBACK_USER:
-                                       if (progress->callback->pass_state) {
-                                               zval *param;
-
-                                               MAKE_STD_ZVAL(param);
-                                               array_init(param);
-                                               add_assoc_bool(param, "started", progress->state.started);
-                                               add_assoc_bool(param, "finished", progress->state.finished);
-                                               add_assoc_string(param, "info", estrdup(progress->state.info), 0);
-                                               add_assoc_double(param, "dltotal", progress->state.dl.total);
-                                               add_assoc_double(param, "dlnow", progress->state.dl.now);
-                                               add_assoc_double(param, "ultotal", progress->state.ul.total);
-                                               add_assoc_double(param, "ulnow", progress->state.ul.now);
-
-                                               progress->in_cb = 1;
-                                               call_user_function(EG(function_table), NULL, progress->callback->func.user, &retval, 1, &param TSRMLS_CC);
-                                               progress->in_cb = 0;
-
-                                               zval_ptr_dtor(&param);
-                                       } else {
-                                               progress->in_cb = 1;
-                                               call_user_function(EG(function_table), NULL, progress->callback->func.user, &retval, 0, NULL TSRMLS_CC);
-                                               progress->in_cb = 0;
-                                       }
+                                       progress->in_cb = 1;
+                                       call_user_function(EG(function_table), NULL, progress->callback->func.user, &retval, 0, NULL TSRMLS_CC);
+                                       progress->in_cb = 0;
                                        break;
                                case PHP_HTTP_CLIENT_PROGRESS_CALLBACK_INTERN:
-                                       progress->callback->func.intern(progress->callback->pass_state ? &progress->state : NULL TSRMLS_CC);
+                                       progress->callback->func.intern(&progress->state TSRMLS_CC);
                                        break;
                                default:
                                        break;