Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- use TSRMLS_*C instead of TSRMLS_FETCH in zend_list_insert

  • Loading branch information...
commit aa0ed267a29b83099715c48f25bcbf9642bf7bb2 1 parent 14e7748
@pierrejoye pierrejoye authored
View
19 UPGRADING.INTERNALS
@@ -66,4 +66,23 @@ ZEND_FAST_FREE_REL(p, fc_type)
Use emalloc, emalloc_rel, efree or efree_rel instead.
+ f. zend_list_insert
+zend_list_insert uses now TSRMLS_DC:
+ZEND_API int zend_list_insert(void *ptr, int type TSRMLS_DC);
+
+it has to be called using:
+
+zend_list_insert(a, SOMETYPE TSRMLS_CC);
+
+If zend_list_insert is used to register a resource, ZEND_REGISTER_RESOURCE
+could be used instead.
+
+ g. php_le_stream_context(TSRMLS_C)
+php_le_stream_context 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);
View
7 Zend/zend_list.c
@@ -32,11 +32,10 @@ ZEND_API int le_index_ptr;
static HashTable list_destructors;
-ZEND_API int zend_list_insert(void *ptr, int type)
+ZEND_API int zend_list_insert(void *ptr, int type TSRMLS_DC)
{
int index;
zend_rsrc_list_entry le;
- TSRMLS_FETCH();
le.ptr=ptr;
le.type=type;
@@ -92,11 +91,11 @@ ZEND_API int _zend_list_addref(int id TSRMLS_DC)
}
-ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type)
+ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC)
{
int rsrc_id;
- rsrc_id = zend_list_insert(rsrc_pointer, rsrc_type);
+ rsrc_id = zend_list_insert(rsrc_pointer, rsrc_type TSRMLS_CC);
if (rsrc_result) {
rsrc_result->value.lval = rsrc_id;
View
6 Zend/zend_list.h
@@ -70,7 +70,7 @@ void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC);
int zend_init_rsrc_list_dtors(void);
void zend_destroy_rsrc_list_dtors(void);
-ZEND_API int zend_list_insert(void *ptr, int type);
+ZEND_API int zend_list_insert(void *ptr, int type TSRMLS_DC);
ZEND_API int _zend_list_addref(int id TSRMLS_DC);
ZEND_API int _zend_list_delete(int id TSRMLS_DC);
ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC);
@@ -79,7 +79,7 @@ ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC);
#define zend_list_delete(id) _zend_list_delete(id TSRMLS_CC)
#define zend_list_find(id, type) _zend_list_find(id, type TSRMLS_CC)
-ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type);
+ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...);
ZEND_API char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC);
@@ -107,7 +107,7 @@ extern ZEND_API int le_index_ptr; /* list entry type for index pointers */
(rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2))
#define ZEND_REGISTER_RESOURCE(rsrc_result, rsrc_pointer, rsrc_type) \
- zend_register_resource(rsrc_result, rsrc_pointer, rsrc_type);
+ zend_register_resource(rsrc_result, rsrc_pointer, rsrc_type TSRMLS_CC);
#define ZEND_GET_RESOURCE_TYPE_ID(le_id, le_type_name) \
if (le_id == 0) { \
View
2  ext/com_dotnet/com_persist.c
@@ -277,7 +277,7 @@ PHPAPI IStream *php_com_wrapper_export_stream(php_stream *stream TSRMLS_DC)
stm->stream = stream;
zend_list_addref(stream->rsrc_id);
- stm->id = zend_list_insert(stm, le_istream);
+ stm->id = zend_list_insert(stm, le_istream TSRMLS_CC);
return (IStream*)stm;
}
View
2  ext/com_dotnet/com_wrapper.c
@@ -548,7 +548,7 @@ static php_dispatchex *disp_constructor(zval *object TSRMLS_DC)
Z_ADDREF_P(object);
disp->object = object;
- disp->id = zend_list_insert(disp, le_dispatch);
+ disp->id = zend_list_insert(disp, le_dispatch TSRMLS_CC);
return disp;
}
View
2  ext/interbase/ibase_query.c
@@ -1857,7 +1857,7 @@ PHP_FUNCTION(ibase_execute)
if (ib_query->statement_type == isc_info_sql_stmt_exec_procedure) {
result->stmt = NULL;
}
- ib_query->result_res_id = zend_list_insert(result, le_result);
+ ib_query->result_res_id = zend_list_insert(result, le_result TSRMLS_CC);
RETVAL_RESOURCE(ib_query->result_res_id);
}
} while (0);
View
2  ext/libxml/libxml.c
@@ -313,7 +313,7 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char
}
if (LIBXML(stream_context)) {
- context = zend_fetch_resource(&LIBXML(stream_context) TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context());
+ context = zend_fetch_resource(&LIBXML(stream_context) TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context(TSRMLS_C));
}
ret_val = php_stream_open_wrapper_ex(path_to_open, (char *)mode, REPORT_ERRORS, NULL, context);
View
2  ext/mssql/php_mssql.c
@@ -1998,7 +1998,7 @@ PHP_FUNCTION(mssql_init)
statement->link = mssql_ptr;
statement->executed=FALSE;
- statement->id = zend_list_insert(statement,le_statement);
+ statement->id = zend_list_insert(statement,le_statement TSRMLS_CC);
RETURN_RESOURCE(statement->id);
}
View
10 ext/oci8/oci8.c
@@ -1909,7 +1909,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
memcmp(tmp->hash_key, hashed_details.c, hashed_details.len) == 0 && zend_list_addref(connection->rsrc_id) == SUCCESS) {
/* do nothing */
} else {
- connection->rsrc_id = zend_list_insert(connection, le_pconnection);
+ connection->rsrc_id = zend_list_insert(connection, le_pconnection TSRMLS_CC);
/* Persistent connections: For old close semantics we artificially
* bump up the refcount to prevent the non-persistent destructor
* from getting called until request shutdown. The refcount is
@@ -2053,7 +2053,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
new_le.ptr = connection;
new_le.type = le_pconnection;
connection->used_this_request = 1;
- connection->rsrc_id = zend_list_insert(connection, le_pconnection);
+ connection->rsrc_id = zend_list_insert(connection, le_pconnection TSRMLS_CC);
/* Persistent connections: For old close semantics we artificially bump up the refcount to
* prevent the non-persistent destructor from getting called until request shutdown. The
@@ -2066,13 +2066,13 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
OCI_G(num_persistent)++;
OCI_G(num_links)++;
} else if (!exclusive) {
- connection->rsrc_id = zend_list_insert(connection, le_connection);
+ connection->rsrc_id = zend_list_insert(connection, le_connection TSRMLS_CC);
new_le.ptr = (void *)connection->rsrc_id;
new_le.type = le_index_ptr;
zend_hash_update(&EG(regular_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
OCI_G(num_links)++;
} else {
- connection->rsrc_id = zend_list_insert(connection, le_connection);
+ connection->rsrc_id = zend_list_insert(connection, le_connection TSRMLS_CC);
OCI_G(num_links)++;
}
@@ -2765,7 +2765,7 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *
}
spool_le.ptr = session_pool;
spool_le.type = le_psessionpool;
- zend_list_insert(session_pool, le_psessionpool);
+ zend_list_insert(session_pool, le_psessionpool TSRMLS_CC);
zend_hash_update(&EG(persistent_list), session_pool->spool_hash_key, strlen(session_pool->spool_hash_key)+1,(void *)&spool_le, sizeof(zend_rsrc_list_entry),NULL);
} else if (spool_out_le->type == le_psessionpool &&
strlen(((php_oci_spool *)(spool_out_le->ptr))->spool_hash_key) == spool_hashed_details.len &&
View
6 ext/odbc/birdstep.c
@@ -224,11 +224,11 @@ PHP_MSHUTDOWN_FUNCTION(birdstep)
/* Some internal functions. Connections and result manupulate */
-static int birdstep_add_conn(HashTable *list,VConn *conn,HDBC hdbc)
+static int birdstep_add_conn(HashTable *list,VConn *conn,HDBC hdbc TSRMLS_DC)
{
int ind;
- ind = zend_list_insert(conn,php_birdstep_module.le_link);
+ ind = zend_list_insert(conn,php_birdstep_module.le_link TSRMLS_CC);
conn->hdbc = hdbc;
conn->index = ind;
@@ -314,7 +314,7 @@ PHP_FUNCTION(birdstep_connect)
RETURN_FALSE;
}
new = (VConn *)emalloc(sizeof(VConn));
- ind = birdstep_add_conn(list,new,hdbc);
+ ind = birdstep_add_conn(list,new,hdbc TSRMLS_CC);
php_birdstep_module.num_links++;
RETURN_LONG(ind);
}
View
18 ext/openssl/openssl.c
@@ -1236,7 +1236,7 @@ static X509 * php_openssl_x509_from_zval(zval ** val, int makeresource, long * r
}
if (cert && makeresource && resourceval) {
- *resourceval = zend_list_insert(cert, le_x509);
+ *resourceval = zend_list_insert(cert, le_x509 TSRMLS_CC);
}
return cert;
}
@@ -2435,7 +2435,7 @@ PHP_FUNCTION(openssl_csr_sign)
}
/* Succeeded; lets return the cert */
- RETVAL_RESOURCE(zend_list_insert(new_cert, le_x509));
+ RETVAL_RESOURCE(zend_list_insert(new_cert, le_x509 TSRMLS_CC));
new_cert = NULL;
cleanup:
@@ -2512,7 +2512,7 @@ PHP_FUNCTION(openssl_csr_new)
RETVAL_TRUE;
if (X509_REQ_sign(csr, req.priv_key, req.digest)) {
- RETVAL_RESOURCE(zend_list_insert(csr, le_csr));
+ RETVAL_RESOURCE(zend_list_insert(csr, le_csr TSRMLS_CC));
csr = NULL;
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error signing request");
@@ -2521,7 +2521,7 @@ PHP_FUNCTION(openssl_csr_new)
if (we_made_the_key) {
/* and a resource for the private key */
zval_dtor(out_pkey);
- ZVAL_RESOURCE(out_pkey, zend_list_insert(req.priv_key, le_key));
+ ZVAL_RESOURCE(out_pkey, zend_list_insert(req.priv_key, le_key TSRMLS_CC));
req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */
} else if (key_resource != -1) {
req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */
@@ -2594,7 +2594,7 @@ PHP_FUNCTION(openssl_csr_get_public_key)
}
tpubkey=X509_REQ_get_pubkey(csr);
- RETVAL_RESOURCE(zend_list_insert(tpubkey, le_key));
+ RETVAL_RESOURCE(zend_list_insert(tpubkey, le_key TSRMLS_CC));
return;
}
/* }}} */
@@ -2948,7 +2948,7 @@ PHP_FUNCTION(openssl_pkey_new)
OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, iqmp);
if (rsa->n && rsa->d) {
if (EVP_PKEY_assign_RSA(pkey, rsa)) {
- RETURN_RESOURCE(zend_list_insert(pkey, le_key));
+ RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC));
}
}
RSA_free(rsa);
@@ -2972,7 +2972,7 @@ PHP_FUNCTION(openssl_pkey_new)
DSA_generate_key(dsa);
}
if (EVP_PKEY_assign_DSA(pkey, dsa)) {
- RETURN_RESOURCE(zend_list_insert(pkey, le_key));
+ RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC));
}
}
DSA_free(dsa);
@@ -2995,7 +2995,7 @@ PHP_FUNCTION(openssl_pkey_new)
DH_generate_key(dh);
}
if (EVP_PKEY_assign_DH(pkey, dh)) {
- RETURN_RESOURCE(zend_list_insert(pkey, le_key));
+ RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC));
}
}
DH_free(dh);
@@ -3012,7 +3012,7 @@ PHP_FUNCTION(openssl_pkey_new)
{
if (php_openssl_generate_private_key(&req TSRMLS_CC)) {
/* pass back a key resource */
- RETVAL_RESOURCE(zend_list_insert(req.priv_key, le_key));
+ RETVAL_RESOURCE(zend_list_insert(req.priv_key, le_key TSRMLS_CC));
/* make sure the cleanup code doesn't zap it! */
req.priv_key = NULL;
}
View
4 ext/openssl/xp_ssl.c
@@ -471,7 +471,7 @@ static inline int php_openssl_enable_crypto(php_stream *stream,
zval_is_true(*val)) {
MAKE_STD_ZVAL(zcert);
ZVAL_RESOURCE(zcert, zend_list_insert(peer_cert,
- php_openssl_get_x509_list_id()));
+ php_openssl_get_x509_list_id() TSRMLS_CC));
php_stream_context_set_option(stream->context,
"ssl", "peer_certificate",
zcert);
@@ -500,7 +500,7 @@ static inline int php_openssl_enable_crypto(php_stream *stream,
MAKE_STD_ZVAL(zcert);
ZVAL_RESOURCE(zcert,
zend_list_insert(mycert,
- php_openssl_get_x509_list_id()));
+ php_openssl_get_x509_list_id() TSRMLS_CC));
add_next_index_zval(arr, zcert);
FREE_ZVAL(zcert);
}
View
2  ext/pgsql/pgsql.c
@@ -3169,7 +3169,7 @@ PHP_FUNCTION(pg_lo_open)
} else {
pgsql_lofp->conn = pgsql;
pgsql_lofp->lofd = pgsql_lofd;
- Z_LVAL_P(return_value) = zend_list_insert(pgsql_lofp, le_lofp);
+ Z_LVAL_P(return_value) = zend_list_insert(pgsql_lofp, le_lofp TSRMLS_CC);
Z_TYPE_P(return_value) = IS_LONG;
}
}
View
2  ext/pspell/pspell.c
@@ -347,7 +347,7 @@ static PHP_FUNCTION(pspell_new)
}
manager = to_pspell_manager(ret);
- ind = zend_list_insert(manager, le_pspell);
+ ind = zend_list_insert(manager, le_pspell TSRMLS_CC);
RETURN_LONG(ind);
}
/* }}} */
View
2  ext/shmop/shmop.c
@@ -226,7 +226,7 @@ PHP_FUNCTION(shmop_open)
shmop->size = shm.shm_segsz;
- rsid = zend_list_insert(shmop, shm_type);
+ rsid = zend_list_insert(shmop, shm_type TSRMLS_CC);
RETURN_LONG(rsid);
err:
efree(shmop);
View
2  ext/soap/php_http.c
@@ -380,7 +380,7 @@ int make_http_soap_request(zval *this_ptr,
if (stream) {
zval **cookies, **login, **password;
- int ret = zend_list_insert(phpurl, le_url);
+ int ret = zend_list_insert(phpurl, le_url TSRMLS_CC);
add_property_resource(this_ptr, "httpurl", ret);
/*zend_list_addref(ret);*/
View
6 ext/soap/soap.c
@@ -1298,7 +1298,7 @@ PHP_METHOD(SoapServer, SoapServer)
service->typemap = soap_create_typemap(service->sdl, typemap_ht TSRMLS_CC);
}
- ret = zend_list_insert(service, le_service);
+ ret = zend_list_insert(service, le_service TSRMLS_CC);
add_property_resource(this_ptr, "service", ret);
SOAP_SERVER_END_CODE();
@@ -2621,7 +2621,7 @@ PHP_METHOD(SoapClient, SoapClient)
SOAP_GLOBAL(soap_version) = soap_version;
sdl = get_sdl(this_ptr, Z_STRVAL_P(wsdl), cache_wsdl TSRMLS_CC);
- ret = zend_list_insert(sdl, le_sdl);
+ ret = zend_list_insert(sdl, le_sdl TSRMLS_CC);
add_property_resource(this_ptr, "sdl", ret);
@@ -2633,7 +2633,7 @@ PHP_METHOD(SoapClient, SoapClient)
if (typemap) {
int ret;
- ret = zend_list_insert(typemap, le_typemap);
+ ret = zend_list_insert(typemap, le_typemap TSRMLS_CC);
add_property_resource(this_ptr, "typemap", ret);
}
}
View
2  ext/standard/file.c
@@ -138,7 +138,7 @@ php_file_globals file_globals;
/* sharing globals is *evil* */
static int le_stream_context = FAILURE;
-PHPAPI int php_le_stream_context(void)
+PHPAPI int php_le_stream_context(TSRMLS_D)
{
return le_stream_context;
}
View
2  ext/standard/file.h
@@ -72,7 +72,7 @@ PHP_FUNCTION(sys_get_temp_dir);
PHP_MINIT_FUNCTION(user_streams);
-PHPAPI int php_le_stream_context(void);
+PHPAPI int php_le_stream_context(TSRMLS_D);
PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC);
PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC);
PHPAPI int php_copy_file_ex(char *src, char *dest, int src_chk TSRMLS_DC);
View
2  ext/standard/streamsfuncs.c
@@ -953,7 +953,7 @@ static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC)
{
php_stream_context *context = NULL;
- context = zend_fetch_resource(&contextresource TSRMLS_CC, -1, NULL, NULL, 1, php_le_stream_context());
+ context = zend_fetch_resource(&contextresource TSRMLS_CC, -1, NULL, NULL, 1, php_le_stream_context(TSRMLS_C));
if (context == NULL) {
php_stream *stream;
View
2  ext/sysvmsg/sysvmsg.c
@@ -271,7 +271,7 @@ PHP_FUNCTION(msg_get_queue)
RETURN_FALSE;
}
}
- RETVAL_RESOURCE(zend_list_insert(mq, le_sysvmsg));
+ RETVAL_RESOURCE(zend_list_insert(mq, le_sysvmsg TSRMLS_CC));
}
/* }}} */
View
2  main/streams/php_stream_context.h
@@ -33,7 +33,7 @@ typedef void (*php_stream_notification_func)(php_stream_context *context,
If no context was passed, use the default context
The the default context has not yet been created, do it now. */
#define php_stream_context_from_zval(zcontext, nocontext) ( \
- (zcontext) ? zend_fetch_resource(&(zcontext) TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_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()) )
View
4 main/streams/streams.c
@@ -1998,7 +1998,7 @@ PHPAPI void php_stream_context_free(php_stream_context *context)
efree(context);
}
-PHPAPI php_stream_context *php_stream_context_alloc(void)
+PHPAPI php_stream_context *php_stream_context_alloc(TSRMLS_D)
{
php_stream_context *context;
@@ -2007,7 +2007,7 @@ PHPAPI php_stream_context *php_stream_context_alloc(void)
MAKE_STD_ZVAL(context->options);
array_init(context->options);
- context->rsrc_id = ZEND_REGISTER_RESOURCE(NULL, context, php_le_stream_context());
+ context->rsrc_id = ZEND_REGISTER_RESOURCE(NULL, context, php_le_stream_context(TSRMLS_C));
return context;
}
Please sign in to comment.
Something went wrong with that request. Please try again.