Skip to content

Commit

Permalink
- use TSRMLS_D/C with php_stream_context_alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrejoye committed Sep 16, 2010
1 parent daa9081 commit ed58636
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 11 deletions.
9 changes: 9 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,13 @@ PHPAPI php_stream_context *php_stream_context_alloc(TSRMLS_D)

it has to be called using:

context = php_stream_context_alloc(TSRMLS_C);

h. php_stream_context_alloc
php_stream_context_alloc uses now TSRMLS_D:

PHPAPI php_stream_context *php_stream_context_alloc(TSRMLS_D);

it has to be called using:

context = php_stream_context_alloc(TSRMLS_C);
2 changes: 1 addition & 1 deletion ext/mysqlnd/mysqlnd_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ static enum_func_status
MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC)
{
#ifdef MYSQLND_SSL_SUPPORTED
php_stream_context *context = php_stream_context_alloc();
php_stream_context *context = php_stream_context_alloc(TSRMLS_C);
DBG_ENTER("mysqlnd_net::enable_ssl");
if (!context) {
DBG_RETURN(FAIL);
Expand Down
6 changes: 3 additions & 3 deletions ext/soap/php_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3222,7 +3222,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
"_stream_context", sizeof("_stream_context"), (void**)&tmp)) {
context = php_stream_context_from_zval(*tmp, 0);
} else {
context = php_stream_context_alloc();
context = php_stream_context_alloc(TSRMLS_C);
}

if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host"), (void **) &proxy_host) == SUCCESS &&
Expand All @@ -3245,7 +3245,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
smart_str_free(&proxy);

if (!context) {
context = php_stream_context_alloc();
context = php_stream_context_alloc(TSRMLS_C);
}
php_stream_context_set_option(context, "http", "proxy", str_proxy);
zval_ptr_dtor(&str_proxy);
Expand Down Expand Up @@ -3274,7 +3274,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
zval *str_headers;

if (!context) {
context = php_stream_context_alloc();
context = php_stream_context_alloc(TSRMLS_C);
}

smart_str_0(&headers);
Expand Down
2 changes: 1 addition & 1 deletion ext/soap/soap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2524,7 +2524,7 @@ PHP_METHOD(SoapClient, SoapClient)
if (zend_hash_find(ht, "local_cert", sizeof("local_cert"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
if (!context) {
context = php_stream_context_alloc();
context = php_stream_context_alloc(TSRMLS_C);
}
php_stream_context_set_option(context, "ssl", "local_cert", *tmp);
if (zend_hash_find(ht, "passphrase", sizeof("passphrase"), (void**)&tmp) == SUCCESS &&
Expand Down
8 changes: 4 additions & 4 deletions ext/standard/streamsfuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC)
param, but then something is called which requires a context.
Don't give them the default one though since they already said they
didn't want it. */
context = stream->context = php_stream_context_alloc();
context = stream->context = php_stream_context_alloc(TSRMLS_C);
}
}
}
Expand Down Expand Up @@ -1092,7 +1092,7 @@ PHP_FUNCTION(stream_context_get_default)
}

if (FG(default_context) == NULL) {
FG(default_context) = php_stream_context_alloc();
FG(default_context) = php_stream_context_alloc(TSRMLS_C);
}
context = FG(default_context);

Expand All @@ -1116,7 +1116,7 @@ PHP_FUNCTION(stream_context_set_default)
}

if (FG(default_context) == NULL) {
FG(default_context) = php_stream_context_alloc();
FG(default_context) = php_stream_context_alloc(TSRMLS_C);
}
context = FG(default_context);

Expand All @@ -1137,7 +1137,7 @@ PHP_FUNCTION(stream_context_create)
RETURN_FALSE;
}

context = php_stream_context_alloc();
context = php_stream_context_alloc(TSRMLS_C);

if (options) {
parse_context_options(context, options TSRMLS_CC);
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ PHP_FUNCTION(get_headers)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &url, &url_len, &format) == FAILURE) {
return;
}
context = FG(default_context) ? FG(default_context) : (FG(default_context) = php_stream_context_alloc());
context = FG(default_context) ? FG(default_context) : (FG(default_context) = php_stream_context_alloc(TSRMLS_C));

if (!(stream = php_stream_open_wrapper_ex(url, "r", REPORT_ERRORS | STREAM_USE_URL | STREAM_ONLY_GET_HEADERS, NULL, context))) {
RETURN_FALSE;
Expand Down
2 changes: 1 addition & 1 deletion main/streams/php_stream_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef void (*php_stream_notification_func)(php_stream_context *context,
(zcontext) ? zend_fetch_resource(&(zcontext) TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context(TSRMLS_C)) : \
(nocontext) ? NULL : \
FG(default_context) ? FG(default_context) : \
(FG(default_context) = php_stream_context_alloc()) )
(FG(default_context) = php_stream_context_alloc(TSRMLS_C)) )

#define php_stream_context_to_zval(context, zval) { ZVAL_RESOURCE(zval, (context)->rsrc_id); zend_list_addref((context)->rsrc_id); }

Expand Down

0 comments on commit ed58636

Please sign in to comment.