X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=php_http_request_factory.c;h=e739f53701ef0e345177c526adc873c29dfa3138;hb=4e5827ad559e50a1bfa4dc1807add9248acb3be4;hp=1f5f24141805ede4010b01966c801ec9beefcaef;hpb=a4fd0a809ae831f21cbaec14e24c3d3ee0569c12;p=m6w6%2Fext-http diff --git a/php_http_request_factory.c b/php_http_request_factory.c index 1f5f241..e739f53 100644 --- a/php_http_request_factory.c +++ b/php_http_request_factory.c @@ -113,13 +113,12 @@ PHP_METHOD(HttpRequestFactory, __construct) PHP_METHOD(HttpRequestFactory, createRequest) { - char *url_str = NULL; - int url_len; - long meth = -1; + char *meth_str = NULL, *url_str = NULL; + int meth_len, url_len; zval *options = NULL; with_error_handling(EH_THROW, php_http_exception_class_entry) { - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!la!", &url_str, &url_len, &meth, &options)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!a!", &url_str, &url_len, &meth_str, &meth_len, &options)) { with_error_handling(EH_THROW, php_http_exception_class_entry) { zval *zdriver, *os; zend_object_value ov; @@ -147,13 +146,7 @@ PHP_METHOD(HttpRequestFactory, createRequest) name_len = spprintf(&name_str, 0, "http_request.%s", Z_STRVAL_P(zdriver)); if ((pf = php_http_persistent_handle_concede(NULL , name_str, name_len, Z_STRVAL_P(phi), Z_STRLEN_P(phi) TSRMLS_CC))) { - php_http_resource_factory_ops_t ops = { - (php_http_resource_factory_handle_ctor_t) php_http_persistent_handle_acquire, - (php_http_resource_factory_handle_copy_t) php_http_persistent_handle_accrete, - (php_http_resource_factory_handle_dtor_t) php_http_persistent_handle_release - }; - - rf = php_http_resource_factory_init(NULL, &ops, pf, (void (*)(void *)) php_http_persistent_handle_abandon); + rf = php_http_resource_factory_init(NULL, php_http_persistent_handle_resource_factory_ops(), pf, (void (*)(void *)) php_http_persistent_handle_abandon); } efree(name_str); @@ -172,8 +165,8 @@ PHP_METHOD(HttpRequestFactory, createRequest) if (url_str) { zend_update_property_stringl(php_http_request_class_entry, return_value, ZEND_STRL("url"), url_str, url_len TSRMLS_CC); } - if (meth > 0) { - zend_update_property_long(php_http_request_class_entry, return_value, ZEND_STRL("method"), meth TSRMLS_CC); + if (meth_str) { + zend_update_property_stringl(php_http_request_class_entry, return_value, ZEND_STRL("method"), meth_str, meth_len TSRMLS_CC); } if (options) { zend_call_method_with_1_params(&return_value, Z_OBJCE_P(return_value), NULL, "setoptions", NULL, options); @@ -224,13 +217,7 @@ PHP_METHOD(HttpRequestFactory, createPool) name_len = spprintf(&name_str, 0, "http_request_pool.%s", Z_STRVAL_P(zdriver)); if ((pf = php_http_persistent_handle_concede(NULL , name_str, name_len, Z_STRVAL_P(phi), Z_STRLEN_P(phi) TSRMLS_CC))) { - php_http_resource_factory_ops_t ops = { - (php_http_resource_factory_handle_ctor_t) php_http_persistent_handle_acquire, - (php_http_resource_factory_handle_copy_t) php_http_persistent_handle_accrete, - (php_http_resource_factory_handle_dtor_t) php_http_persistent_handle_release - }; - - rf = php_http_resource_factory_init(NULL, &ops, pf, (void (*)(void *)) php_http_persistent_handle_abandon); + rf = php_http_resource_factory_init(NULL, php_http_persistent_handle_resource_factory_ops(), pf, (void (*)(void *)) php_http_persistent_handle_abandon); } efree(name_str); @@ -291,13 +278,7 @@ PHP_METHOD(HttpRequestFactory, createDataShare) name_len = spprintf(&name_str, 0, "http_request_datashare.%s", Z_STRVAL_P(zdriver)); if ((pf = php_http_persistent_handle_concede(NULL , name_str, name_len, Z_STRVAL_P(phi), Z_STRLEN_P(phi) TSRMLS_CC))) { - php_http_resource_factory_ops_t ops = { - (php_http_resource_factory_handle_ctor_t) php_http_persistent_handle_acquire, - (php_http_resource_factory_handle_copy_t) php_http_persistent_handle_accrete, - (php_http_resource_factory_handle_dtor_t) php_http_persistent_handle_release - }; - - rf = php_http_resource_factory_init(NULL, &ops, pf, (void (*)(void *)) php_http_persistent_handle_abandon); + rf = php_http_resource_factory_init(NULL, php_http_persistent_handle_resource_factory_ops(), pf, (void (*)(void *)) php_http_persistent_handle_abandon); } efree(name_str);