summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2001-07-28 11:36:37 +0000
committerZeev Suraski <zeev@php.net>2001-07-28 11:36:37 +0000
commitd87cc976e1156b839fc6d4aa6b473a126802b8e3 (patch)
tree8acb068dd7458e1c8df3a7d8ecb87d065990fdb1 /ext
parentb4f3b9d3ce9f55cf040fb5aa8f201c64646cab43 (diff)
downloadphp-git-d87cc976e1156b839fc6d4aa6b473a126802b8e3.tar.gz
Redesigned thread safety mechanism - nua nua
Diffstat (limited to 'ext')
-rw-r--r--ext/com/COM.c2
-rw-r--r--ext/cpdf/cpdf.c299
-rw-r--r--ext/crack/crack.c13
-rw-r--r--ext/crack/php_crack.h4
-rw-r--r--ext/ctype/ctype.c1
-rw-r--r--ext/ctype/php_ctype.h6
-rw-r--r--ext/curl/curl.c1
-rw-r--r--ext/cybermut/php_cybermut.h4
-rw-r--r--ext/db/db.c20
-rw-r--r--ext/dbase/dbase.c2
-rw-r--r--ext/dbplus/php_dbplus.h4
-rw-r--r--ext/dbx/php_dbx.h12
-rw-r--r--ext/ereg/ereg.c4
-rw-r--r--ext/ereg/php_ereg.h12
-rw-r--r--ext/fbsql/php_fbsql.c112
-rw-r--r--ext/fbsql/php_fbsql.h12
-rw-r--r--ext/fdf/fdf.c3
-rw-r--r--ext/filepro/filepro.c3
-rw-r--r--ext/fribidi/php_fribidi.h4
-rw-r--r--ext/gd/gd.c1
-rw-r--r--ext/gd/gd_ctx.c1
-rw-r--r--ext/gmp/php_gmp.h4
-rw-r--r--ext/hyperwave/hw.c11
-rw-r--r--ext/hyperwave/php_hyperwave.h12
-rw-r--r--ext/iconv/iconv.c4
-rw-r--r--ext/iconv/php_iconv.h8
-rw-r--r--ext/imap/php_imap.c36
-rw-r--r--ext/imap/php_imap.h12
-rw-r--r--ext/ingres_ii/ii.c44
-rw-r--r--ext/ingres_ii/ii.h2
-rw-r--r--ext/ingres_ii/php_ii.h12
-rw-r--r--ext/interbase/interbase.c68
-rw-r--r--ext/interbase/php_interbase.h7
-rw-r--r--ext/java/java.c2
-rw-r--r--ext/ldap/ldap.c11
-rw-r--r--ext/ldap/php_ldap.h12
-rwxr-xr-xext/mailparse/php_mailparse.h4
-rwxr-xr-xext/mailparse/rfc2045.c2
-rw-r--r--ext/mailparse/rfc2045acchk.c2
-rw-r--r--ext/mbstring/mbstring.c60
-rw-r--r--ext/mbstring/mbstring.h12
-rw-r--r--ext/mcrypt/mcrypt.c30
-rw-r--r--ext/mcrypt/php_mcrypt.h12
-rw-r--r--ext/msql/php_msql.c2
-rw-r--r--ext/mssql/php_mssql.c83
-rw-r--r--ext/mssql/php_mssql.h12
-rw-r--r--ext/muscat/muscat.c3
-rw-r--r--ext/muscat/php_muscat.h4
-rw-r--r--ext/mysql/php_mysql.c60
-rw-r--r--ext/mysql/php_mysql.h12
-rw-r--r--ext/oci8/oci8.c46
-rw-r--r--ext/oci8/php_oci8.h12
-rw-r--r--ext/odbc/php_odbc.c36
-rw-r--r--ext/odbc/php_odbc.h12
-rw-r--r--ext/oracle/oracle.c18
-rw-r--r--ext/oracle/php_oracle.h12
-rw-r--r--ext/pcre/php_pcre.c5
-rw-r--r--ext/pdf/php_pdf.h3
-rw-r--r--ext/pfpro/pfpro.c12
-rw-r--r--ext/pfpro/php_pfpro.h4
-rw-r--r--ext/pgsql/pgsql.c41
-rw-r--r--ext/pgsql/php_pgsql.h13
-rw-r--r--ext/posix/posix.c1
-rw-r--r--ext/readline/readline.c2
-rw-r--r--ext/recode/php_recode.h12
-rw-r--r--ext/recode/recode.c11
-rw-r--r--ext/rpc/com/com_wrapper.c2
-rw-r--r--ext/rpc/java/java.c2
-rw-r--r--ext/sablot/php_sablot.h14
-rw-r--r--ext/sablot/sablot.c42
-rw-r--r--ext/session/php_session.h26
-rw-r--r--ext/session/session.c156
-rw-r--r--ext/shmop/php_shmop.h4
-rw-r--r--ext/standard/array.c19
-rw-r--r--ext/standard/assert.c87
-rw-r--r--ext/standard/basic_functions.c46
-rw-r--r--ext/standard/basic_functions.h12
-rw-r--r--ext/standard/browscap.c1
-rw-r--r--ext/standard/datetime.c2
-rw-r--r--ext/standard/dir.c25
-rw-r--r--ext/standard/dl.c3
-rw-r--r--ext/standard/exec.c4
-rw-r--r--ext/standard/file.c30
-rw-r--r--ext/standard/file.h12
-rw-r--r--ext/standard/filestat.c12
-rw-r--r--ext/standard/fsock.c29
-rw-r--r--ext/standard/fsock.h2
-rw-r--r--ext/standard/head.c5
-rw-r--r--ext/standard/http_fopen_wrapper.c3
-rw-r--r--ext/standard/incomplete_class.c2
-rw-r--r--ext/standard/info.c1
-rw-r--r--ext/standard/lcg.c6
-rw-r--r--ext/standard/link.c2
-rw-r--r--ext/standard/mail.c1
-rw-r--r--ext/standard/pageinfo.c18
-rw-r--r--ext/standard/php_array.h12
-rw-r--r--ext/standard/php_incomplete_class.h4
-rw-r--r--ext/standard/php_lcg.h6
-rw-r--r--ext/standard/rand.c13
-rw-r--r--ext/standard/reg.c4
-rw-r--r--ext/standard/reg.h12
-rw-r--r--ext/standard/string.c15
-rw-r--r--ext/standard/syslog.c19
-rw-r--r--ext/standard/url_scanner.c4
-rw-r--r--ext/standard/url_scanner_ex.c25
-rw-r--r--ext/standard/url_scanner_ex.re26
-rw-r--r--ext/standard/var.c7
-rw-r--r--ext/swf/php_swf.h6
-rw-r--r--ext/swf/swf.c5
-rw-r--r--ext/sybase/php_sybase_db.c1
-rw-r--r--ext/sybase_ct/php_sybase_ct.c54
-rw-r--r--ext/sybase_ct/php_sybase_ct.h12
-rw-r--r--ext/vpopmail/php_vpopmail.c29
-rw-r--r--ext/vpopmail/php_vpopmail.h4
-rw-r--r--ext/wddx/wddx.c7
-rw-r--r--ext/xml/php_xml.h12
-rw-r--r--ext/xml/xml.c4
-rw-r--r--ext/yp/php_yp.h12
-rw-r--r--ext/yp/yp.c39
-rw-r--r--ext/zlib/php_zlib.h11
-rw-r--r--ext/zlib/zlib.c26
121 files changed, 678 insertions, 1562 deletions
diff --git a/ext/com/COM.c b/ext/com/COM.c
index 360c689b77..35b0ee3e4d 100644
--- a/ext/com/COM.c
+++ b/ext/com/COM.c
@@ -352,7 +352,7 @@ static PHP_INI_MH(OnTypelibFileChange)
char *typelib_name_buffer;
char *strtok_buf = NULL;
int interactive;
- CLS_FETCH();
+ TSRMLS_FETCH();
interactive = CG(interactive);
diff --git a/ext/cpdf/cpdf.c b/ext/cpdf/cpdf.c
index ce785cf6e2..12682c8ae2 100644
--- a/ext/cpdf/cpdf.c
+++ b/ext/cpdf/cpdf.c
@@ -65,12 +65,10 @@ typedef struct cpdflib_global_struct{
#endif
} cpdflib_global_struct;
-# define CPDF_GLOBAL(a) cpdflib_globals->a
-# define CPDF_TLS_VARS cpdflib_global_struct *cpdflib_globals=TlsGetValue(CPDFlibTls)
+# define CPDF_GLOBAL(v) TSRMG(CPDFlibTls, cpdflib_global_struct *, v)
#else
-# define CPDF_GLOBAL(a) a
-# define CPDF_TLS_VARS
+# define CPDF_GLOBAL(a) a
static int le_cpdf;
static int le_outline;
#if HAVE_LIBGD13
@@ -213,10 +211,10 @@ PHP_MSHUTDOWN_FUNCTION(cpdf){
/* {{{ proto void cpdf_global_set_document_limits(int maxPages, int maxFonts, int maxImages, int maxAnnots, int maxObjects)
Sets document settings for all documents */
-PHP_FUNCTION(cpdf_global_set_document_limits) {
+PHP_FUNCTION(cpdf_global_set_document_limits)
+{
pval *argv[5];
int argc;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if(argc != 5)
@@ -238,12 +236,11 @@ PHP_FUNCTION(cpdf_global_set_document_limits) {
/* {{{ proto bool cpdf_set_creator(int pdfdoc, string creator)
Sets the creator field */
-PHP_FUNCTION(cpdf_set_creator) {
+PHP_FUNCTION(cpdf_set_creator)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -266,12 +263,11 @@ PHP_FUNCTION(cpdf_set_creator) {
/* {{{ proto bool cpdf_set_title(int pdfptr, string title)
Fills the title field of the info structure */
-PHP_FUNCTION(cpdf_set_title) {
+PHP_FUNCTION(cpdf_set_title)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -294,11 +290,11 @@ PHP_FUNCTION(cpdf_set_title) {
/* {{{ proto bool cpdf_set_subject(int pdfptr, string subject)
Fills the subject field of the info structure */
-PHP_FUNCTION(cpdf_set_subject) {
+PHP_FUNCTION(cpdf_set_subject)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
@@ -322,12 +318,11 @@ PHP_FUNCTION(cpdf_set_subject) {
/* {{{ proto bool cpdf_set_keywords(int pdfptr, string keywords)
Fills the keywords field of the info structure */
-PHP_FUNCTION(cpdf_set_keywords) {
+PHP_FUNCTION(cpdf_set_keywords)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -350,15 +345,13 @@ PHP_FUNCTION(cpdf_set_keywords) {
/* {{{ proto void cpdf_set_viewer_preferences(int pdfdoc, array preferences)
How to show the document in the viewer */
-PHP_FUNCTION(cpdf_set_viewer_preferences) {
+PHP_FUNCTION(cpdf_set_viewer_preferences)
+{
zval *arg1, *arg2;
zval **zvalue;
-
int id, type;
-
CPDFdoc *pdf;
CPDFviewerPrefs vP = { 0, 0, 0, 0, 0, 0, 0, 0 };
- CPDF_TLS_VARS;
if(ZEND_NUM_ARGS() != 2)
WRONG_PARAM_COUNT;
@@ -426,11 +419,11 @@ PHP_FUNCTION(cpdf_set_viewer_preferences) {
/* {{{ proto int cpdf_open(int compression [, string filename [, array doc_limits]])
Opens a new pdf document */
-PHP_FUNCTION(cpdf_open) {
+PHP_FUNCTION(cpdf_open)
+{
pval *arg1, *arg2, *arg3;
int id, argc;
CPDFdoc *cpdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
switch(argc) {
@@ -480,11 +473,11 @@ PHP_FUNCTION(cpdf_open) {
/* {{{ proto void cpdf_close(int pdfdoc)
Closes the pdf document */
-PHP_FUNCTION(cpdf_close) {
+PHP_FUNCTION(cpdf_close)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -506,13 +499,13 @@ PHP_FUNCTION(cpdf_close) {
#define BUFFERLEN 40
/* {{{ proto void cpdf_page_init(int pdfdoc, int pagenr, int orientation, int height, int width [, double unit])
Starts page */
-PHP_FUNCTION(cpdf_page_init) {
+PHP_FUNCTION(cpdf_page_init)
+{
pval *argv[6];
int id, type, pagenr, orientation;
int height, width, argc;
char buffer[BUFFERLEN];
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if(argc < 5 || argc > 6)
@@ -551,11 +544,11 @@ PHP_FUNCTION(cpdf_page_init) {
/* {{{ proto void cpdf_finalize_page(int pdfdoc, int pagenr)
Ends the page to save memory */
-PHP_FUNCTION(cpdf_finalize_page) {
+PHP_FUNCTION(cpdf_finalize_page)
+{
pval *arg1, *arg2;
int id, type, pagenr;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -579,11 +572,11 @@ PHP_FUNCTION(cpdf_finalize_page) {
/* {{{ proto void cpdf_set_current_page(int pdfdoc, int pagenr)
Sets page for output */
-PHP_FUNCTION(cpdf_set_current_page) {
+PHP_FUNCTION(cpdf_set_current_page)
+{
pval *arg1, *arg2;
int id, type, pagenr;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -607,11 +600,11 @@ PHP_FUNCTION(cpdf_set_current_page) {
/* {{{ proto void cpdf_begin_text(int pdfdoc)
Starts text section */
-PHP_FUNCTION(cpdf_begin_text) {
+PHP_FUNCTION(cpdf_begin_text)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -633,11 +626,11 @@ PHP_FUNCTION(cpdf_begin_text) {
/* {{{ proto void cpdf_end_text(int pdfdoc)
Ends text section */
-PHP_FUNCTION(cpdf_end_text) {
+PHP_FUNCTION(cpdf_end_text)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -659,11 +652,11 @@ PHP_FUNCTION(cpdf_end_text) {
/* {{{ proto void cpdf_show(int pdfdoc, string text)
Output text at current position */
-PHP_FUNCTION(cpdf_show) {
+PHP_FUNCTION(cpdf_show)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -686,11 +679,11 @@ PHP_FUNCTION(cpdf_show) {
/* {{{ proto void cpdf_show_xy(int pdfdoc, string text, double x-koor, double y-koor [, int mode])
Output text at position */
-PHP_FUNCTION(cpdf_show_xy) {
+PHP_FUNCTION(cpdf_show_xy)
+{
pval *argv[5];
int id, type, argc, mode=0;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 4) || (argc > 5))
@@ -724,11 +717,11 @@ PHP_FUNCTION(cpdf_show_xy) {
/* {{{ proto void cpdf_continue_text(int pdfdoc, string text)
Output text in next line */
-PHP_FUNCTION(cpdf_continue_text) {
+PHP_FUNCTION(cpdf_continue_text)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -751,11 +744,11 @@ PHP_FUNCTION(cpdf_continue_text) {
/* {{{ proto void cpdf_text(int pdfdoc, string text [, double x-koor, double y-koor [, int mode [, double orientation [, int alignmode]]]])
Output text */
-PHP_FUNCTION(cpdf_text) {
+PHP_FUNCTION(cpdf_text)
+{
pval *argv[7];
int id, type, argc, mode=0;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 2) || (argc == 3) || (argc > 7) || getParametersArray(ht, argc, argv) == FAILURE)
@@ -841,11 +834,11 @@ PHP_FUNCTION(cpdf_text) {
/* {{{ proto void cpdf_set_font(int pdfdoc, string font, double size, string encoding)
Select the current font face, size and encoding */
-PHP_FUNCTION(cpdf_set_font) {
+PHP_FUNCTION(cpdf_set_font)
+{
pval *arg1, *arg2, *arg3, *arg4;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -875,11 +868,11 @@ PHP_FUNCTION(cpdf_set_font) {
/* {{{ proto void cpdf_set_font_directories(int pdfdoc, string pfmdir, string pfbdir)
Set directories to search when using external fonts. */
-PHP_FUNCTION(cpdf_set_font_directories) {
+PHP_FUNCTION(cpdf_set_font_directories)
+{
pval *arg1, *arg2, *arg3;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -903,11 +896,11 @@ PHP_FUNCTION(cpdf_set_font_directories) {
/* {{{ proto void cpdf_set_font_map_file(int pdfdoc, string filename)
Set fontname to filename translation map when using external fonts. */
-PHP_FUNCTION(cpdf_set_font_map_file) {
+PHP_FUNCTION(cpdf_set_font_map_file)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -930,11 +923,11 @@ PHP_FUNCTION(cpdf_set_font_map_file) {
/* {{{ proto void cpdf_set_leading(int pdfdoc, double distance)
Sets distance between text lines */
-PHP_FUNCTION(cpdf_set_leading) {
+PHP_FUNCTION(cpdf_set_leading)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -957,11 +950,11 @@ PHP_FUNCTION(cpdf_set_leading) {
/* {{{ proto void cpdf_set_text_rendering(int pdfdoc, int rendermode)
Determines how text is rendered */
-PHP_FUNCTION(cpdf_set_text_rendering) {
+PHP_FUNCTION(cpdf_set_text_rendering)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -984,11 +977,11 @@ PHP_FUNCTION(cpdf_set_text_rendering) {
/* {{{ proto void cpdf_set_horiz_scaling(int pdfdoc, double scale)
Sets horizontal scaling of text */
-PHP_FUNCTION(cpdf_set_horiz_scaling) {
+PHP_FUNCTION(cpdf_set_horiz_scaling)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1011,11 +1004,11 @@ PHP_FUNCTION(cpdf_set_horiz_scaling) {
/* {{{ proto void cpdf_set_text_rise(int pdfdoc, double value)
Sets the text rise */
-PHP_FUNCTION(cpdf_set_text_rise) {
+PHP_FUNCTION(cpdf_set_text_rise)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1038,14 +1031,14 @@ PHP_FUNCTION(cpdf_set_text_rise) {
/* {{{ proto void cpdf_set_text_matrix(int pdfdoc, arry matrix)
Sets the text matrix */
-PHP_FUNCTION(cpdf_set_text_matrix) {
+PHP_FUNCTION(cpdf_set_text_matrix)
+{
pval *arg1, *arg2, *data;
int id, type, i;
HashTable *matrix;
CPDFdoc *pdf;
float *pdfmatrixptr;
float pdfmatrix[6];
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1091,11 +1084,11 @@ PHP_FUNCTION(cpdf_set_text_matrix) {
/* {{{ proto void cpdf_set_text_pos(int pdfdoc, double x, double y [, int mode])
Set the position of text for the next cpdf_show call */
-PHP_FUNCTION(cpdf_set_text_pos) {
+PHP_FUNCTION(cpdf_set_text_pos)
+{
pval *argv[4];
int id, type, argc, mode=0;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 3) || (argc > 4))
@@ -1128,11 +1121,11 @@ PHP_FUNCTION(cpdf_set_text_pos) {
/* {{{ proto void cpdf_rotate_text(int pdfdoc, double angle)
Sets character spacing */
-PHP_FUNCTION(cpdf_rotate_text) {
+PHP_FUNCTION(cpdf_rotate_text)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1155,11 +1148,11 @@ PHP_FUNCTION(cpdf_rotate_text) {
/* {{{ proto void cpdf_set_char_spacing(int pdfdoc, double space)
Sets character spacing */
-PHP_FUNCTION(cpdf_set_char_spacing) {
+PHP_FUNCTION(cpdf_set_char_spacing)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1182,11 +1175,11 @@ PHP_FUNCTION(cpdf_set_char_spacing) {
/* {{{ proto void cpdf_set_word_spacing(int pdfdoc, double space)
Sets spacing between words */
-PHP_FUNCTION(cpdf_set_word_spacing) {
+PHP_FUNCTION(cpdf_set_word_spacing)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1209,12 +1202,12 @@ PHP_FUNCTION(cpdf_set_word_spacing) {
/* {{{ proto double cpdf_stringwidth(int pdfdoc, string text)
Returns width of text in current font */
-PHP_FUNCTION(cpdf_stringwidth) {
+PHP_FUNCTION(cpdf_stringwidth)
+{
pval *arg1, *arg2;
int id, type;
double width;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1237,11 +1230,11 @@ PHP_FUNCTION(cpdf_stringwidth) {
/* {{{ proto void cpdf_save(int pdfdoc)
Saves current enviroment */
-PHP_FUNCTION(cpdf_save) {
+PHP_FUNCTION(cpdf_save)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1263,11 +1256,11 @@ PHP_FUNCTION(cpdf_save) {
/* {{{ proto void cpdf_restore(int pdfdoc)
Restores formerly saved enviroment */
-PHP_FUNCTION(cpdf_restore) {
+PHP_FUNCTION(cpdf_restore)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1289,11 +1282,11 @@ PHP_FUNCTION(cpdf_restore) {
/* {{{ proto void cpdf_translate(int pdfdoc, double x, double y)
Sets origin of coordinate system */
-PHP_FUNCTION(cpdf_translate) {
+PHP_FUNCTION(cpdf_translate)
+{
pval *arg1, *arg2, *arg3;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1317,11 +1310,11 @@ PHP_FUNCTION(cpdf_translate) {
/* {{{ proto void cpdf_scale(int pdfdoc, double x-scale, double y-scale)
Sets scaling */
-PHP_FUNCTION(cpdf_scale) {
+PHP_FUNCTION(cpdf_scale)
+{
pval *arg1, *arg2, *arg3;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1345,11 +1338,11 @@ PHP_FUNCTION(cpdf_scale) {
/* {{{ proto void cpdf_rotate(int pdfdoc, double angle)
Sets rotation */
-PHP_FUNCTION(cpdf_rotate) {
+PHP_FUNCTION(cpdf_rotate)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1372,11 +1365,11 @@ PHP_FUNCTION(cpdf_rotate) {
/* {{{ proto void cpdf_setflat(int pdfdoc, double value)
Sets flatness */
-PHP_FUNCTION(cpdf_setflat) {
+PHP_FUNCTION(cpdf_setflat)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1404,11 +1397,11 @@ PHP_FUNCTION(cpdf_setflat) {
/* {{{ proto void cpdf_setlinejoin(int pdfdoc, int value)
Sets linejoin parameter */
-PHP_FUNCTION(cpdf_setlinejoin) {
+PHP_FUNCTION(cpdf_setlinejoin)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1436,11 +1429,11 @@ PHP_FUNCTION(cpdf_setlinejoin) {
/* {{{ proto void cpdf_setlinecap(int pdfdoc, int value)
Sets linecap parameter */
-PHP_FUNCTION(cpdf_setlinecap) {
+PHP_FUNCTION(cpdf_setlinecap)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1468,11 +1461,11 @@ PHP_FUNCTION(cpdf_setlinecap) {
/* {{{ proto void cpdf_setmiterlimit(int pdfdoc, double value)
Sets miter limit */
-PHP_FUNCTION(cpdf_setmiterlimit) {
+PHP_FUNCTION(cpdf_setmiterlimit)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1500,11 +1493,11 @@ PHP_FUNCTION(cpdf_setmiterlimit) {
/* {{{ proto void cpdf_setlinewidth(int pdfdoc, double width)
Sets line width */
-PHP_FUNCTION(cpdf_setlinewidth) {
+PHP_FUNCTION(cpdf_setlinewidth)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1528,12 +1521,12 @@ PHP_FUNCTION(cpdf_setlinewidth) {
#define BUFFERLEN 20
/* {{{ proto void cpdf_setdash(int pdfdoc, long white, long black)
Sets dash pattern */
-PHP_FUNCTION(cpdf_setdash) {
+PHP_FUNCTION(cpdf_setdash)
+{
pval *arg1, *arg2, *arg3;
int id, type;
char buffer[BUFFERLEN];
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1559,11 +1552,11 @@ PHP_FUNCTION(cpdf_setdash) {
/* {{{ proto void cpdf_moveto(int pdfdoc, double x, double y [, int mode])
Sets current point */
-PHP_FUNCTION(cpdf_moveto) {
+PHP_FUNCTION(cpdf_moveto)
+{
pval *argv[4];
int id, type, argc, mode=0;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 3) || (argc > 4))
@@ -1596,11 +1589,11 @@ PHP_FUNCTION(cpdf_moveto) {
/* {{{ proto void cpdf_rmoveto(int pdfdoc, double x, double y [, int mode])
Sets current point */
-PHP_FUNCTION(cpdf_rmoveto) {
+PHP_FUNCTION(cpdf_rmoveto)
+{
pval *argv[4];
int id, type, argc, mode=0;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 3) || (argc > 4))
@@ -1633,11 +1626,11 @@ PHP_FUNCTION(cpdf_rmoveto) {
/* {{{ proto void cpdf_curveto(int pdfdoc, double x1, double y1, double x2, double y2, double x3, double y3 [, int mode])
Draws a curve */
-PHP_FUNCTION(cpdf_curveto) {
+PHP_FUNCTION(cpdf_curveto)
+{
pval *argv[8];
int id, type, argc, mode=0;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 7) || (argc > 8))
@@ -1684,11 +1677,11 @@ PHP_FUNCTION(cpdf_curveto) {
/* {{{ proto void cpdf_lineto(int pdfdoc, double x, double y [, int mode])
Draws a line */
-PHP_FUNCTION(cpdf_lineto) {
+PHP_FUNCTION(cpdf_lineto)
+{
pval *argv[4];
int id, type, argc, mode=0;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 3) || (argc > 4))
@@ -1721,11 +1714,11 @@ PHP_FUNCTION(cpdf_lineto) {
/* {{{ proto void cpdf_rlineto(int pdfdoc, double x, double y [, int mode])
Draws a line relative to current point */
-PHP_FUNCTION(cpdf_rlineto) {
+PHP_FUNCTION(cpdf_rlineto)
+{
pval *argv[4];
int id, type, argc, mode=0;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 3) || (argc > 4))
@@ -1758,11 +1751,11 @@ PHP_FUNCTION(cpdf_rlineto) {
/* {{{ proto void cpdf_circle(int pdfdoc, double x, double y, double radius [, int mode])
Draws a circle */
-PHP_FUNCTION(cpdf_circle) {
+PHP_FUNCTION(cpdf_circle)
+{
pval *argv[5];
int id, type, argc, mode=0;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 4) || (argc > 5))
@@ -1796,11 +1789,11 @@ PHP_FUNCTION(cpdf_circle) {
/* {{{ proto void cpdf_arc(int pdfdoc, double x, double y, double radius, double start, double end [, int mode])
Draws an arc */
-PHP_FUNCTION(cpdf_arc) {
+PHP_FUNCTION(cpdf_arc)
+{
pval *argv[7];
int id, type, argc, mode=0;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 6) || (argc > 7))
@@ -1836,11 +1829,11 @@ PHP_FUNCTION(cpdf_arc) {
/* {{{ proto void cpdf_rect(int pdfdoc, double x, double y, double width, double height [, int mode])
Draws a rectangle */
-PHP_FUNCTION(cpdf_rect) {
+PHP_FUNCTION(cpdf_rect)
+{
pval *argv[6];
int id, type, argc, mode=0;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 5) || (argc > 6))
@@ -1881,11 +1874,11 @@ PHP_FUNCTION(cpdf_rect) {
/* {{{ proto void cpdf_newpath(int pdfdoc)
Starts new path */
-PHP_FUNCTION(cpdf_newpath) {
+PHP_FUNCTION(cpdf_newpath)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1907,11 +1900,11 @@ PHP_FUNCTION(cpdf_newpath) {
/* {{{ proto void cpdf_closepath(int pdfdoc)
Close path */
-PHP_FUNCTION(cpdf_closepath) {
+PHP_FUNCTION(cpdf_closepath)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1933,11 +1926,11 @@ PHP_FUNCTION(cpdf_closepath) {
/* {{{ proto void cpdf_closepath_stroke(int pdfdoc)
Close path and draw line along path */
-PHP_FUNCTION(cpdf_closepath_stroke) {
+PHP_FUNCTION(cpdf_closepath_stroke)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1960,11 +1953,11 @@ PHP_FUNCTION(cpdf_closepath_stroke) {
/* {{{ proto void cpdf_stroke(int pdfdoc)
Draw line along path path */
-PHP_FUNCTION(cpdf_stroke) {
+PHP_FUNCTION(cpdf_stroke)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1986,11 +1979,11 @@ PHP_FUNCTION(cpdf_stroke) {
/* {{{ proto void cpdf_fill(int pdfdoc)
Fill current path */
-PHP_FUNCTION(cpdf_fill) {
+PHP_FUNCTION(cpdf_fill)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2012,11 +2005,11 @@ PHP_FUNCTION(cpdf_fill) {
/* {{{ proto void cpdf_fill_stroke(int pdfdoc)
Fill and stroke current path */
-PHP_FUNCTION(cpdf_fill_stroke) {
+PHP_FUNCTION(cpdf_fill_stroke)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2039,11 +2032,11 @@ PHP_FUNCTION(cpdf_fill_stroke) {
/* {{{ proto void cpdf_closepath_fill_stroke(int pdfdoc)
Close, fill and stroke current path */
-PHP_FUNCTION(cpdf_closepath_fill_stroke) {
+PHP_FUNCTION(cpdf_closepath_fill_stroke)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2067,11 +2060,11 @@ PHP_FUNCTION(cpdf_closepath_fill_stroke) {
/* {{{ proto void cpdf_clip(int pdfdoc)
Clips to current path */
-PHP_FUNCTION(cpdf_clip) {
+PHP_FUNCTION(cpdf_clip)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2093,11 +2086,11 @@ PHP_FUNCTION(cpdf_clip) {
/* {{{ proto void cpdf_setgray_fill(int pdfdoc, double value)
Sets filling color to gray value */
-PHP_FUNCTION(cpdf_setgray_fill) {
+PHP_FUNCTION(cpdf_setgray_fill)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2120,11 +2113,11 @@ PHP_FUNCTION(cpdf_setgray_fill) {
/* {{{ proto void cpdf_setgray_stroke(int pdfdoc, double value)
Sets drawing color to gray value */
-PHP_FUNCTION(cpdf_setgray_stroke) {
+PHP_FUNCTION(cpdf_setgray_stroke)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2147,11 +2140,11 @@ PHP_FUNCTION(cpdf_setgray_stroke) {
/* {{{ proto void cpdf_setgray(int pdfdoc, double value)
Sets drawing and filling color to gray value */
-PHP_FUNCTION(cpdf_setgray) {
+PHP_FUNCTION(cpdf_setgray)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2174,11 +2167,11 @@ PHP_FUNCTION(cpdf_setgray) {
/* {{{ proto void cpdf_setrgbcolor_fill(int pdfdoc, double red, double green, double blue)
Sets filling color to rgb color value */
-PHP_FUNCTION(cpdf_setrgbcolor_fill) {
+PHP_FUNCTION(cpdf_setrgbcolor_fill)
+{
pval *arg1, *arg2, *arg3, *arg4;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2203,11 +2196,11 @@ PHP_FUNCTION(cpdf_setrgbcolor_fill) {
/* {{{ proto void cpdf_setrgbcolor_stroke(int pdfdoc, double red, double green, double blue)
Sets drawing color to rgb color value */
-PHP_FUNCTION(cpdf_setrgbcolor_stroke) {
+PHP_FUNCTION(cpdf_setrgbcolor_stroke)
+{
pval *arg1, *arg2, *arg3, *arg4;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2232,11 +2225,11 @@ PHP_FUNCTION(cpdf_setrgbcolor_stroke) {
/* {{{ proto void cpdf_setrgbcolor(int pdfdoc, double red, double green, double blue)
Sets drawing and filling color to rgb color value */
-PHP_FUNCTION(cpdf_setrgbcolor) {
+PHP_FUNCTION(cpdf_setrgbcolor)
+{
pval *arg1, *arg2, *arg3, *arg4;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2261,11 +2254,11 @@ PHP_FUNCTION(cpdf_setrgbcolor) {
/* {{{ proto void cpdf_set_page_animation(int pdfdoc, int transition, double duration, double direction, int orientation, int inout)
Sets transition between pages */
-PHP_FUNCTION(cpdf_set_page_animation) {
+PHP_FUNCTION(cpdf_set_page_animation)
+{
pval *arg1, *arg2, *arg3, *arg4, *arg5, *arg6;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 6 || getParameters(ht, 6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2293,11 +2286,11 @@ PHP_FUNCTION(cpdf_set_page_animation) {
/* {{{ proto array cpdf_finalize(int pdfdoc)
Creates pdf doc in memory */
-PHP_FUNCTION(cpdf_finalize) {
+PHP_FUNCTION(cpdf_finalize)
+{
pval *arg1;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2319,12 +2312,12 @@ PHP_FUNCTION(cpdf_finalize) {
/* {{{ proto array cpdf_output_buffer(int pdfdoc)
Returns the internal memory stream as string */
-PHP_FUNCTION(cpdf_output_buffer) {
+PHP_FUNCTION(cpdf_output_buffer)
+{
pval *arg1;
int id, type, lenght;
CPDFdoc *pdf;
char *buffer;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2348,11 +2341,11 @@ PHP_FUNCTION(cpdf_output_buffer) {
/* {{{ proto array cpdf_save_to_file(int pdfdoc, string filename)
Saves the internal memory stream to a file */
-PHP_FUNCTION(cpdf_save_to_file) {
+PHP_FUNCTION(cpdf_save_to_file)
+{
pval *arg1, *arg2;
int id, type;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2380,12 +2373,12 @@ PHP_FUNCTION(cpdf_save_to_file) {
/* {{{ proto void cpdf_import_jpeg(int pdfdoc, string filename, double x, double y, double angle, double width, double height, double x-scale, double y-scale, int gsave [, int mode])
Includes jpeg image */
-PHP_FUNCTION(cpdf_import_jpeg) {
+PHP_FUNCTION(cpdf_import_jpeg)
+{
pval *argv[11];
int id, type, argc, mode=0;
float width, height, xscale, yscale;
CPDFdoc *pdf;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 10) || (argc > 11))
@@ -2448,14 +2441,14 @@ PHP_FUNCTION(cpdf_import_jpeg) {
#if HAVE_LIBGD13
/* {{{ proto void cpdf_place_inline_image(int pdfdoc, int gdimage, double x, double y, double angle, fload width, float height, int gsave [, int mode])
Includes image */
-PHP_FUNCTION(cpdf_place_inline_image) {
+PHP_FUNCTION(cpdf_place_inline_image)
+{
pval *argv[11];
int id, gid, type, argc, mode=0;
int count, i, j, color;
CPDFdoc *pdf;
unsigned char *buffer, *ptr;
gdImagePtr im;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 8) || (argc > 9))
@@ -2540,12 +2533,12 @@ PHP_FUNCTION(cpdf_place_inline_image) {
/* {{{ proto void cpdf_add_annotation(int pdfdoc, double xll, double yll, double xur, double xur, string title, string text [, int mode])
Sets annotation */
-PHP_FUNCTION(cpdf_add_annotation) {
+PHP_FUNCTION(cpdf_add_annotation)
+{
pval *argv[11];
int id, type, argc, mode=0;
CPDFdoc *pdf;
CPDFannotAttrib attrib;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 7) || (argc > 8))
@@ -2600,12 +2593,12 @@ PHP_FUNCTION(cpdf_add_annotation) {
/* {{{ proto void cpdf_set_action_url(int pdfdoc, double xll, double yll, double xur, double xur, string url [, int mode])
Sets Hyperlink */
-PHP_FUNCTION(cpdf_set_action_url) {
+PHP_FUNCTION(cpdf_set_action_url)
+{
pval *argv[11];
int id, type, argc, mode=0;
CPDFdoc *pdf;
CPDFannotAttrib attrib;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if((argc < 6) || (argc > 7))
@@ -2657,12 +2650,12 @@ PHP_FUNCTION(cpdf_set_action_url) {
/* {{{ proto int cpdf_add_outline(int pdfdoc, int lastoutline, int sublevel, int open, int pagenr, string title)
Add outline */
-PHP_FUNCTION(cpdf_add_outline) {
+PHP_FUNCTION(cpdf_add_outline)
+{
pval *argv[11];
int id, oid, type, argc;
CPDFdoc *pdf;
CPDFoutlineEntry *lastoutline;
- CPDF_TLS_VARS;
argc = ZEND_NUM_ARGS();
if(argc != 6)
diff --git a/ext/crack/crack.c b/ext/crack/crack.c
index 131d5d57ac..a3e2d8916d 100644
--- a/ext/crack/crack.c
+++ b/ext/crack/crack.c
@@ -65,8 +65,7 @@ long _crack_open_dict(char *dictpath)
{
PWDICT *pwdict;
long resource;
-
- CRACKLS_FETCH();
+ TSRMLS_FETCH();
if (CRACKG(current_id) != -1) {
zend_error(E_WARNING, "Can not use more than one open dictionary with this implementation of libcrack");
@@ -111,8 +110,6 @@ ZEND_MSHUTDOWN_FUNCTION(crack)
ZEND_RINIT_FUNCTION(crack)
{
- CRACKLS_FETCH();
-
CRACKG(last_message) = NULL;
CRACKG(current_id) = -1;
@@ -121,7 +118,7 @@ ZEND_RINIT_FUNCTION(crack)
ZEND_RSHUTDOWN_FUNCTION(crack)
{
- CRACKLS_FETCH();
+ TSRMLS_FETCH();
if (NULL != CRACKG(last_message)) {
efree(CRACKG(last_message));
@@ -168,8 +165,6 @@ ZEND_FUNCTION(crack_closedict)
zval **dictionary;
long id;
- CRACKLS_FETCH();
-
switch (ZEND_NUM_ARGS()) {
case 0:
id = CRACKG(current_id);
@@ -205,8 +200,6 @@ ZEND_FUNCTION(crack_check)
PWDICT *pwdict;
long id;
- CRACKLS_FETCH();
-
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_get_parameters_ex(1, &password) == FAILURE) {
@@ -254,8 +247,6 @@ ZEND_FUNCTION(crack_check)
Returns the message from the last obscure check. */
ZEND_FUNCTION(crack_getlastmessage)
{
- CRACKLS_FETCH();
-
if (ZEND_NUM_ARGS() != 0) {
WRONG_PARAM_COUNT;
}
diff --git a/ext/crack/php_crack.h b/ext/crack/php_crack.h
index 17ad313481..c3f2961f72 100644
--- a/ext/crack/php_crack.h
+++ b/ext/crack/php_crack.h
@@ -30,11 +30,9 @@ ZEND_BEGIN_MODULE_GLOBALS(crack)
ZEND_END_MODULE_GLOBALS(crack)
#ifdef ZTS
-#define CRACKG(v) (crack_globals->v)
-#define CRACKLS_FETCH() zend_crack_globals *crack_globals = ts_resource(crack_globals_id)
+#define CRACKG(v) TSRMG(crack_globals_id, zend_crack_globals *, v)
#else
#define CRACKG(v) (crack_globals.v)
-#define CRACKLS_FETCH()
#endif
#else
diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c
index 4fe50ef9de..5265f1d5b1 100644
--- a/ext/ctype/ctype.c
+++ b/ext/ctype/ctype.c
@@ -86,7 +86,6 @@ ZEND_GET_MODULE(ctype)
PHP_MINFO_FUNCTION(ctype)
{
TSRMLS_FETCH();
- SLS_FETCH();
php_info_print_table_start();
php_info_print_table_row(2, "ctype functions", "enabled (experimental)");
diff --git a/ext/ctype/php_ctype.h b/ext/ctype/php_ctype.h
index 8b4ff6f4fd..279aa7c1b4 100644
--- a/ext/ctype/php_ctype.h
+++ b/ext/ctype/php_ctype.h
@@ -62,18 +62,16 @@ ZEND_END_MODULE_GLOBALS(ctype)
*/
/* In every function that needs to use variables in php_ctype_globals,
- do call CTYPELS_FETCH(); after declaring other variables used by
+ do call TSRMLS_FETCH(); after declaring other variables used by
that function, and always refer to them as CTYPEG(variable).
You are encouraged to rename these macros something shorter, see
examples in any other php module directory.
*/
#ifdef ZTS
-#define CTYPEG(v) (ctype_globals->v)
-#define CTYPELS_FETCH() php_ctype_globals *ctype_globals = ts_resource(ctype_globals_id)
+#define CTYPEG(v) TSRMG(ctype_globals_id, php_ctype_globals *, v)
#else
#define CTYPEG(v) (ctype_globals.v)
-#define CTYPELS_FETCH()
#endif
#else
diff --git a/ext/curl/curl.c b/ext/curl/curl.c
index 238ca58c65..ef242ef5fa 100644
--- a/ext/curl/curl.c
+++ b/ext/curl/curl.c
@@ -274,7 +274,6 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
zval *argv[2];
zval *retval;
int error;
- TSRMLS_FETCH();
MAKE_STD_ZVAL(argv[0]);
MAKE_STD_ZVAL(argv[1]);
diff --git a/ext/cybermut/php_cybermut.h b/ext/cybermut/php_cybermut.h
index a4c0755b2c..5683c097d7 100644
--- a/ext/cybermut/php_cybermut.h
+++ b/ext/cybermut/php_cybermut.h
@@ -57,11 +57,9 @@ ZEND_END_MODULE_GLOBALS(cybermut)
*/
#ifdef ZTS
-#define CYBERMUTG(v) (cybermut_globals->v)
-#define CYBERMUTLS_FETCH() php_cybermut_globals *cybermut_globals = ts_resource(cybermut_globals_id)
+#define CYBERMUTG(v) TSRMG(cybermut_globals_id, php_cybermut_globals *, v)
#else
#define CYBERMUTG(v) (cybermut_globals.v)
-#define CYBERMUTLS_FETCH()
#endif
#endif /* PHP_CYBERMUT_H */
diff --git a/ext/db/db.c b/ext/db/db.c
index 1166c82bc9..323641b235 100644
--- a/ext/db/db.c
+++ b/ext/db/db.c
@@ -284,7 +284,8 @@ PHP_FUNCTION(dbmopen) {
/* {{{ php_dbm_open
*/
-dbm_info *php_dbm_open(char *filename, char *mode) {
+dbm_info *php_dbm_open(char *filename, char *mode)
+{
dbm_info *info;
int ret, lock=0;
char *lockfn = NULL;
@@ -298,7 +299,7 @@ dbm_info *php_dbm_open(char *filename, char *mode) {
DBM_TYPE dbf=NULL;
DBM_MODE_TYPE imode;
- PLS_FETCH();
+ TSRMLS_FETCH();
if (filename == NULL) {
php_error(E_WARNING, "NULL filename passed to php_dbm_open()");
@@ -564,11 +565,12 @@ PHP_FUNCTION(dbmreplace)
/* {{{ php_dbm_replace
*/
-int php_dbm_replace(dbm_info *info, char *key, char *value) {
+int php_dbm_replace(dbm_info *info, char *key, char *value)
+{
DBM_TYPE dbf;
int ret;
datum key_datum, value_datum;
- PLS_FETCH();
+ TSRMLS_FETCH();
if (PG(magic_quotes_runtime)) {
php_stripslashes(key,NULL);
@@ -629,11 +631,12 @@ PHP_FUNCTION(dbmfetch)
/* {{{ php_dbm_fetch
*/
-char *php_dbm_fetch(dbm_info *info, char *key) {
+char *php_dbm_fetch(dbm_info *info, char *key)
+{
datum key_datum, value_datum;
char *ret;
DBM_TYPE dbf;
- PLS_FETCH();
+ TSRMLS_FETCH();
key_datum.dptr = key;
key_datum.dsize = strlen(key);
@@ -863,11 +866,12 @@ PHP_FUNCTION(dbmnextkey)
/* {{{ php_dbm_nextkey
*/
-char *php_dbm_nextkey(dbm_info *info, char *key) {
+char *php_dbm_nextkey(dbm_info *info, char *key)
+{
datum key_datum, ret_datum;
char *ret;
DBM_TYPE dbf;
- PLS_FETCH();
+ TSRMLS_FETCH();
key_datum.dptr = key;
key_datum.dsize = strlen(key);
diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c
index 68833bd4a2..bbb93558cf 100644
--- a/ext/dbase/dbase.c
+++ b/ext/dbase/dbase.c
@@ -119,7 +119,6 @@ PHP_FUNCTION(dbase_open) {
pval *dbf_name, *options;
dbhead_t *dbh;
int handle;
- PLS_FETCH();
DBase_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&dbf_name,&options)==FAILURE) {
@@ -583,7 +582,6 @@ PHP_FUNCTION(dbase_create) {
int num_fields;
dbfield_t *dbf, *cur_f;
int i, rlen, handle;
- PLS_FETCH();
DBase_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&filename,&fields)==FAILURE) {
diff --git a/ext/dbplus/php_dbplus.h b/ext/dbplus/php_dbplus.h
index e4f4dc1b7e..ab72fb2dfa 100644
--- a/ext/dbplus/php_dbplus.h
+++ b/ext/dbplus/php_dbplus.h
@@ -105,11 +105,9 @@ ZEND_END_MODULE_GLOBALS(dbplus)
*/
#ifdef ZTS
-#define DBPLUSG(v) (dbplus_globals->v)
-#define DBPLUSLS_FETCH() php_dbplus_globals *dbplus_globals = ts_resource(dbplus_globals_id)
+#define AG(v) TSRMG(dbplus_globals_id, php_dbplus_globals *, v)
#else
#define DBPLUSG(v) (dbplus_globals.v)
-#define DBPLUSLS_FETCH()
#endif
diff --git a/ext/dbx/php_dbx.h b/ext/dbx/php_dbx.h
index 08d753d648..ef4d1e9ba8 100644
--- a/ext/dbx/php_dbx.h
+++ b/ext/dbx/php_dbx.h
@@ -69,19 +69,9 @@ ZEND_END_MODULE_GLOBALS(dbx)
*/
#ifdef ZTS
-#define DBXLS_D zend_dbx_globals *dbx_globals
-#define DBXLS_DC , DBXLS_D
-#define DBXLS_C dbx_globals
-#define DBXLS_CC , DBXLS_C
-#define DBXG(v) (dbx_globals->v)
-#define DBXLS_FETCH() zend_dbx_globals *dbx_globals = ts_resource(dbx_globals_id)
+#define DBXG(v) TSRMG(dbx_globals_id, zend_dbx_globals *, v)
#else
-#define DBXLS_D
-#define DBXLS_DC
-#define DBXLS_C
-#define DBXLS_CC
#define DBXG(v) (dbx_globals.v)
-#define DBXLS_FETCH()
#endif
#endif /* ZEND_PHP_DBX_H */
diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c
index c962f2b8c4..7116dad68a 100644
--- a/ext/ereg/ereg.c
+++ b/ext/ereg/ereg.c
@@ -53,7 +53,7 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
int r = 0;
int patlen = strlen(pattern);
reg_cache *rc = NULL;
- REGLS_FETCH();
+ TSRMLS_FETCH();
if(zend_hash_find(&REG(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == FAILURE ||
rc->cflags != cflags) {
@@ -102,7 +102,7 @@ PHP_MINIT_FUNCTION(regex)
PHP_MSHUTDOWN_FUNCTION(regex)
{
- REGLS_FETCH();
+ TSRMLS_FETCH();
zend_hash_destroy(&REG(ht_rc));
return SUCCESS;
diff --git a/ext/ereg/php_ereg.h b/ext/ereg/php_ereg.h
index cb34b15e7c..c8adf74956 100644
--- a/ext/ereg/php_ereg.h
+++ b/ext/ereg/php_ereg.h
@@ -42,19 +42,9 @@ PHP_MINFO_FUNCTION(regex);
#ifdef ZTS
-#define REGLS_D php_reg_globals *reg_globals
-#define REGLS_DC , REGLS_D
-#define REGLS_C reg_globals
-#define REGLS_CC , REGLS_C
-#define REG(v) (reg_globals->v)
-#define REGLS_FETCH() php_reg_globals *reg_globals = ts_resource(reg_globals_id)
+#define REG(v) TSRMG(reg_globals_id, php_reg_globals *, v)
#else
-#define REGLS_D
-#define REGLS_DC
-#define REGLS_C
-#define REGLS_CC
#define REG(v) (reg_globals.v)
-#define REGLS_FETCH()
#endif
#endif /* REG_H */
diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c
index 747b1a4d31..7428cf7790 100644
--- a/ext/fbsql/php_fbsql.c
+++ b/ext/fbsql/php_fbsql.c
@@ -243,7 +243,8 @@ static void phpfbReleasePLink (zend_rsrc_list_entry *rsrc);
static void phpfbReleaseResult(zend_rsrc_list_entry *rsrc)
{
PHPFBResult* result = (PHPFBResult *)rsrc->ptr;
- FBSQLLS_FETCH();
+ TSRMLS_FETCH();
+
if (result)
{
if (result->fetchHandle) {
@@ -262,7 +263,8 @@ static void phpfbReleaseResult(zend_rsrc_list_entry *rsrc)
static void phpfbReleaseLink (zend_rsrc_list_entry *rsrc)
{
PHPFBLink* link = (PHPFBLink *)rsrc->ptr;
- FBSQLLS_FETCH();
+ TSRMLS_FETCH();
+
if (link)
{
if (link->hostName) free(link->hostName);
@@ -284,7 +286,8 @@ static void phpfbReleaseLink (zend_rsrc_list_entry *rsrc)
static void phpfbReleasePLink (zend_rsrc_list_entry *rsrc)
{
PHPFBLink* link = (PHPFBLink *)rsrc->ptr;
- FBSQLLS_FETCH();
+ TSRMLS_FETCH();
+
if (link)
{
if (link->hostName) free(link->hostName);
@@ -306,7 +309,7 @@ static void phpfbReleasePLink (zend_rsrc_list_entry *rsrc)
static void php_fbsql_set_default_link(int id)
{
- FBSQLLS_FETCH();
+ TSRMLS_FETCH();
if (FB_SQL_G(linkIndex)!=-1) {
zend_list_delete(FB_SQL_G(linkIndex));
@@ -315,7 +318,7 @@ static void php_fbsql_set_default_link(int id)
zend_list_addref(id);
}
-static int php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS FBSQLLS_DC)
+static int php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS TSRMLS_DC)
{
if (FB_SQL_G(linkIndex)==-1) { /* no link opened yet, implicitly open one */
ht = 0;
@@ -389,8 +392,6 @@ PHP_MSHUTDOWN_FUNCTION(fbsql)
PHP_RINIT_FUNCTION(fbsql)
{
- FBSQLLS_FETCH();
-
FB_SQL_G(linkIndex) = -1;
FB_SQL_G(linkCount) = FB_SQL_G(persistantCount);
return SUCCESS;
@@ -404,7 +405,8 @@ PHP_RSHUTDOWN_FUNCTION(fbsql)
PHP_MINFO_FUNCTION(fbsql)
{
char buf[32];
- FBSQLLS_FETCH();
+ TSRMLS_FETCH();
+
php_info_print_table_start();
php_info_print_table_header(2, "FrontBase support", "enabled");
@@ -439,8 +441,6 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistant)
char *hostName = NULL, *userName = NULL, *userPassword = NULL;
int argc = ZEND_NUM_ARGS(), create_new = 0;
zval **argv[3];
- FBSQLLS_FETCH();
-
if ((argc < 0) || (argc > 3)) WRONG_PARAM_COUNT;
if (zend_get_parameters_ex(argc,&argv[0],&argv[1],&argv[2])==FAILURE) RETURN_FALSE;
@@ -627,11 +627,10 @@ PHP_FUNCTION(fbsql_close)
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL;
int id;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 1:
@@ -667,7 +666,7 @@ static int php_fbsql_select_db(char *databaseName, PHPFBLink *link)
unsigned port;
FBCDatabaseConnection* c;
FBCMetaData* md;
- FBSQLLS_FETCH();
+ TSRMLS_FETCH();
if (!link->databaseName || strcmp(link->databaseName, databaseName))
{
@@ -749,7 +748,6 @@ PHP_FUNCTION(fbsql_autocommit)
FBCMetaData* md;
zval **fbsql_link_index = NULL, **onoff = NULL;
zend_bool OnOff;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -791,11 +789,10 @@ PHP_FUNCTION(fbsql_commit)
FBCMetaData* md;
zval **fbsql_link_index = NULL;
int id;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 1:
@@ -829,11 +826,10 @@ PHP_FUNCTION(fbsql_rollback)
FBCMetaData* md;
zval **fbsql_link_index = NULL;
int id;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 1:
@@ -865,7 +861,6 @@ PHP_FUNCTION(fbsql_hostname)
{
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL, **host_name = NULL;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -900,7 +895,6 @@ PHP_FUNCTION(fbsql_database)
{
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL, **dbname = NULL;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -935,7 +929,6 @@ PHP_FUNCTION(fbsql_database_password)
{
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL, **db_password = NULL;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -970,7 +963,6 @@ PHP_FUNCTION(fbsql_username)
{
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL, **username = NULL;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -1005,7 +997,6 @@ PHP_FUNCTION(fbsql_password)
{
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL, **password = NULL;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -1042,16 +1033,15 @@ PHP_FUNCTION(fbsql_select_db)
zval **fbsql_link_index = NULL, **dbname;
int id;
char* name = NULL;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
name = FB_SQL_G(databaseName);
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
if (zend_get_parameters_ex(1, &dbname)==FAILURE) {
RETURN_FALSE;
@@ -1098,19 +1088,18 @@ PHP_FUNCTION(fbsql_change_user)
int id;
char *name = NULL, *userName, *userPassword;
char buffer[1024];
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 2:
name = FB_SQL_G(databaseName);
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
if (zend_get_parameters_ex(2, &user, &password)==FAILURE) {
RETURN_FALSE;
}
break;
case 3:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
if (zend_get_parameters_ex(3, &user, &password, &database)==FAILURE) {
RETURN_FALSE;
@@ -1158,11 +1147,10 @@ PHP_FUNCTION(fbsql_create_db)
int id;
int i, status;
char *databaseName;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
RETURN_FALSE;
@@ -1229,11 +1217,10 @@ PHP_FUNCTION(fbsql_drop_db)
int id;
int i, status;
char *databaseName;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
RETURN_FALSE;
@@ -1301,11 +1288,10 @@ PHP_FUNCTION(fbsql_start_db)
int id;
int i, status;
char *databaseName;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
RETURN_FALSE;
@@ -1377,11 +1363,10 @@ PHP_FUNCTION(fbsql_stop_db)
int id;
int i, status;
char *databaseName;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
RETURN_FALSE;
@@ -1433,11 +1418,10 @@ PHP_FUNCTION(fbsql_db_status)
zval **fbsql_link_index = NULL, **database_name;
int id;
char *databaseName;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
RETURN_FALSE;
@@ -1473,7 +1457,7 @@ int mdOk(PHPFBLink* link, FBCMetaData* md)
{
FBCDatabaseConnection* c = link->connection;
int result = 1;
- FBSQLLS_FETCH();
+ TSRMLS_FETCH();
link->errorNo = 0;
if (link->errorText)
@@ -1516,7 +1500,7 @@ static void phpfbQuery(INTERNAL_FUNCTION_PARAMETERS, char* sql, PHPFBLink* link)
char* tp;
char* fh;
unsigned int sR = 1, cR = 0;
- FBSQLLS_FETCH();
+ TSRMLS_FETCH();
meta = fbcdcExecuteDirectSQL(link->connection, sql);
@@ -1598,11 +1582,10 @@ PHP_FUNCTION(fbsql_query)
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL, **query;
int id;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
if (zend_get_parameters_ex(1, &query)==FAILURE) {
RETURN_FALSE;
@@ -1633,11 +1616,10 @@ PHP_FUNCTION(fbsql_db_query)
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL, **dbname, **query;
int id;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 2:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
if (zend_get_parameters_ex(2, &dbname, &query)==FAILURE) {
RETURN_FALSE;
@@ -1677,11 +1659,10 @@ PHP_FUNCTION(fbsql_list_dbs)
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL;
int id;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 1:
@@ -1724,11 +1705,10 @@ PHP_FUNCTION(fbsql_list_tables)
zval **fbsql_link_index = NULL, **database_name;
int id;
char *databaseName;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
RETURN_FALSE;
@@ -1771,11 +1751,10 @@ PHP_FUNCTION(fbsql_list_fields)
int id;
char *databaseName, *tableName;
char sql[1024];
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 2:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
if (zend_get_parameters_ex(2, &database_name, &table_name)==FAILURE) {
RETURN_FALSE;
@@ -1813,11 +1792,10 @@ PHP_FUNCTION(fbsql_error)
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL;
int id;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 1:
@@ -1848,11 +1826,10 @@ PHP_FUNCTION(fbsql_errno)
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL;
int id;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 1:
@@ -1877,7 +1854,6 @@ PHP_FUNCTION(fbsql_warnings)
{
int argc = ARG_COUNT(ht);
zval **argv[1];
- FBSQLLS_FETCH();
if ((argc < 0) || (argc > 1)) WRONG_PARAM_COUNT;
if (zend_get_parameters_ex(argc,&argv[0])==FAILURE) RETURN_FALSE;
@@ -1897,11 +1873,10 @@ PHP_FUNCTION(fbsql_affected_rows)
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL;
int id;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 1:
@@ -1927,11 +1902,10 @@ PHP_FUNCTION(fbsql_insert_id)
PHPFBLink* phpLink = NULL;
zval **fbsql_link_index = NULL;
int id;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 1:
@@ -2225,7 +2199,6 @@ PHP_FUNCTION(fbsql_result)
zval **fbsql_result_index = NULL, **row = NULL, **field = NULL;
int rowIndex;
int columnIndex;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -2298,7 +2271,6 @@ PHP_FUNCTION(fbsql_next_result)
{
PHPFBResult* result = NULL;
zval **fbsql_result_index = NULL;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -2348,7 +2320,6 @@ PHP_FUNCTION(fbsql_num_rows)
PHPFBResult* result = NULL;
zval **fbsql_result_index = NULL;
int rowCount;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -2382,7 +2353,6 @@ PHP_FUNCTION(fbsql_num_fields)
{
PHPFBResult* result = NULL;
zval **fbsql_result_index = NULL;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -2448,7 +2418,6 @@ static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
int rowIndex;
int i;
void **row;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -2558,7 +2527,6 @@ PHP_FUNCTION(fbsql_data_seek)
PHPFBResult* result = NULL;
zval **fbsql_result_index = NULL, **row_number = NULL;
int rowIndex;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 2:
@@ -2596,7 +2564,6 @@ PHP_FUNCTION(fbsql_fetch_lengths)
PHPFBResult* result = NULL;
zval **fbsql_result_index = NULL;
int i;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -2628,7 +2595,6 @@ PHP_FUNCTION(fbsql_fetch_field)
PHPFBResult* result = NULL;
zval **fbsql_result_index = NULL, **field_index = NULL;
int column = -1;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -2685,7 +2651,6 @@ PHP_FUNCTION(fbsql_field_seek)
PHPFBResult* result = NULL;
zval **fbsql_result_index = NULL, **field_index = NULL;
int column = -1;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -2728,7 +2693,6 @@ PHP_FUNCTION(fbsql_field_name)
PHPFBResult* result = NULL;
zval **fbsql_result_index = NULL, **field_index = NULL;
int column = -1;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -2777,7 +2741,6 @@ PHP_FUNCTION(fbsql_field_table)
PHPFBResult* result = NULL;
zval **fbsql_result_index = NULL, **field_index = NULL;
int column = -1;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -2818,7 +2781,6 @@ PHP_FUNCTION(fbsql_field_len)
PHPFBResult* result = NULL;
zval **fbsql_result_index = NULL, **field_index = NULL;
int column = -1;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -2870,7 +2832,6 @@ PHP_FUNCTION(fbsql_field_type)
PHPFBResult* result = NULL;
zval **fbsql_result_index = NULL, **field_index = NULL;
int column = -1;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -2924,7 +2885,6 @@ PHP_FUNCTION(fbsql_field_flags)
int column = -1;
char buf[512];
int len;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -3006,7 +2966,6 @@ PHP_FUNCTION(fbsql_free_result)
{
PHPFBResult* result = NULL;
zval **fbsql_result_index = NULL;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -3033,11 +2992,10 @@ PHP_FUNCTION(fbsql_get_autostart_info)
zval **fbsql_link_index = NULL;
int id;
FBCAutoStartInfo* asInfo;
- FBSQLLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
+ id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 1:
diff --git a/ext/fbsql/php_fbsql.h b/ext/fbsql/php_fbsql.h
index d10fe805d0..064ce5d954 100644
--- a/ext/fbsql/php_fbsql.h
+++ b/ext/fbsql/php_fbsql.h
@@ -113,19 +113,9 @@ ZEND_BEGIN_MODULE_GLOBALS(fbsql)
ZEND_END_MODULE_GLOBALS(fbsql)
#ifdef ZTS
-# define FBSQLLS_D zend_fbsql_globals *fbsql_globals
-# define FBSQLLS_DC , FBSQLLS_D
-# define FBSQLLS_C fbsql_globals
-# define FBSQLLS_CC , FBSQLLS_C
-# define FB_SQL_G(v) (fbsql_globals->v)
-# define FBSQLLS_FETCH() zend_fbsql_globals *fbsql_globals = ts_resource(fbsql_globals_id)
+# define FB_SQL_G(v) TSRMG(fbsql_globals_id, zend_fbsql_globals *, v)
#else
-# define FBSQLLS_D
-# define FBSQLLS_DC
-# define FBSQLLS_C
-# define FBSQLLS_CC
# define FB_SQL_G(v) (fbsql_globals.v)
-# define FBSQLLS_FETCH()
#endif
diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c
index 3c88e9397c..8fed3d3f4b 100644
--- a/ext/fdf/fdf.c
+++ b/ext/fdf/fdf.c
@@ -726,7 +726,6 @@ SAPI_POST_HANDLER_FUNC(fdf_post_handler)
ASInt32 nBytes;
zval *array_ptr = (zval *) arg;
TSRMLS_FETCH();
- PLS_FETCH();
fp=php_open_temporary_file(NULL,"fdfdata.",&filename);
if(!fp) {
@@ -768,7 +767,7 @@ SAPI_POST_HANDLER_FUNC(fdf_post_handler)
for(p=value;*p;p++) if(*p=='\r') *p='\n';
if(lastfieldname) efree(lastfieldname);
lastfieldname = estrdup(name);
- php_register_variable(name, value, array_ptr TSRMLS_CC PLS_CC);
+ php_register_variable(name, value, array_ptr TSRMLS_CC);
}
}
}
diff --git a/ext/filepro/filepro.c b/ext/filepro/filepro.c
index df66a449a5..b08a4eee31 100644
--- a/ext/filepro/filepro.c
+++ b/ext/filepro/filepro.c
@@ -197,7 +197,6 @@ PHP_FUNCTION(filepro)
char *strtok_buf = NULL;
int i;
FP_FIELD *new_field, *tmp;
- PLS_FETCH();
FP_TLS_VARS;
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &dir) == FAILURE) {
@@ -295,7 +294,6 @@ PHP_FUNCTION(filepro_rowcount)
char workbuf[MAXPATHLEN];
char readbuf[256];
int recsize = 0, records = 0;
- PLS_FETCH();
FP_TLS_VARS;
if (ZEND_NUM_ARGS() != 0) {
@@ -502,7 +500,6 @@ PHP_FUNCTION(filepro_retrieve)
char readbuf[1024]; /* FIX - Work out better buffering! */
int i, fnum, rnum;
long offset;
- PLS_FETCH();
FP_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &rno, &fno) == FAILURE) {
diff --git a/ext/fribidi/php_fribidi.h b/ext/fribidi/php_fribidi.h
index 81f25f1a77..770288a35a 100644
--- a/ext/fribidi/php_fribidi.h
+++ b/ext/fribidi/php_fribidi.h
@@ -68,11 +68,9 @@ ZEND_END_MODULE_GLOBALS(fribidi)
*/
#ifdef ZTS
-#define FRIBIDIG(v) (fribidi_globals->v)
-#define FRIBIDILS_FETCH() php_fribidi_globals *fribidi_globals = ts_resource(fribidi_globals_id)
+#define FRIBIDIG(v) TSRMG(fribidi_globals_id, php_fribidi_globals *, v)
#else
#define FRIBIDIG(v) (fribidi_globals.v)
-#define FRIBIDILS_FETCH()
#endif
#else
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 7850800b42..873272e2b1 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -1393,7 +1393,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
#if APACHE && defined(CHARSET_EBCDIC)
/* XXX this is unlikely to work any more thies@thieso.net */
- SLS_FETCH();
/* This is a binary file already: avoid EBCDIC->ASCII conversion */
ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0);
#endif
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
index c7a321cda8..aadd36aec1 100644
--- a/ext/gd/gd_ctx.c
+++ b/ext/gd/gd_ctx.c
@@ -69,7 +69,6 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
#if APACHE && defined(CHARSET_EBCDIC)
/* XXX this is unlikely to work any more thies@thieso.net */
- SLS_FETCH();
/* This is a binary file already: avoid EBCDIC->ASCII conversion */
ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0);
#endif
diff --git a/ext/gmp/php_gmp.h b/ext/gmp/php_gmp.h
index 8124dbf768..f2d7f83739 100644
--- a/ext/gmp/php_gmp.h
+++ b/ext/gmp/php_gmp.h
@@ -93,11 +93,9 @@ ZEND_END_MODULE_GLOBALS(gmp)
*/
#ifdef ZTS
-#define GMPG(v) (gmp_globals->v)
-#define GMPLS_FETCH() php_gmp_globals *gmp_globals = ts_resource(gmp_globals_id)
+#define GMPG(v) TSRMG(gmp_globals_id, php_gmp_globals *, v)
#else
#define GMPG(v) (gmp_globals.v)
-#define GMPLS_FETCH()
#endif
#else
diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c
index a8b12ac5ca..42e30a7ea7 100644
--- a/ext/hyperwave/hw.c
+++ b/ext/hyperwave/hw.c
@@ -151,7 +151,7 @@ void print_msg(hg_msg *msg, char *str, int txt);
void _close_hw_link(zend_rsrc_list_entry *rsrc)
{
hw_connection *conn = (hw_connection *)rsrc->ptr;
- HwSLS_FETCH();
+ TSRMLS_FETCH();
if(conn->hostname)
free(conn->hostname);
@@ -165,7 +165,7 @@ void _close_hw_link(zend_rsrc_list_entry *rsrc)
void _close_hw_plink(zend_rsrc_list_entry *rsrc)
{
hw_connection *conn = (hw_connection *)rsrc->ptr;
- HwSLS_FETCH();
+ TSRMLS_FETCH();
if(conn->hostname)
free(conn->hostname);
@@ -194,8 +194,10 @@ static void php_hw_init_globals(zend_hw_globals *hw_globals)
hw_globals->num_persistent = 0;
}
-static PHP_INI_MH(OnHyperwavePort) {
- HwSLS_FETCH();
+static PHP_INI_MH(OnHyperwavePort)
+{
+ TSRMLS_FETCH();
+
if (new_value==NULL) {
HwSG(default_port) = HG_SERVER_PORT;
} else {
@@ -711,7 +713,6 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
hw_connection *ptr;
int do_swap;
int version = 0;
- HwSLS_FETCH();
argc = ZEND_NUM_ARGS();
switch(argc) {
diff --git a/ext/hyperwave/php_hyperwave.h b/ext/hyperwave/php_hyperwave.h
index 7fe434df81..1ae69f4b55 100644
--- a/ext/hyperwave/php_hyperwave.h
+++ b/ext/hyperwave/php_hyperwave.h
@@ -50,19 +50,9 @@ typedef struct {
} zend_hw_globals;
#ifdef ZTS
-# define HwSLS_D zend_hw_globals *hw_globals
-# define HwSLS_DC , HwSLS_D
-# define HwSLS_C hw_globals
-# define HwSLS_CC , HwSLS_C
-# define HwSG(v) (hw_globals->v)
-# define HwSLS_FETCH() zend_hw_globals *hw_globals = ts_resource(hw_globals_id)
+# define HwSG(v) TSRMG(hw_globals_id, zend_hw_globals *, v)
#else
-# define HwSLS_D
-# define HwSLS_DC
-# define HwSLS_C
-# define HwSLS_CC
# define HwSG(v) (hw_globals.v)
-# define HwSLS_FETCH()
extern PHP_HW_API zend_hw_globals hw_globals;
#endif
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 87214ef8ff..d1b4d494cb 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -189,8 +189,6 @@ PHP_FUNCTION(ob_iconv_handler)
{
char *out_buffer;
zval **zv_string, **zv_status;
- SLS_FETCH();
- ICONVLS_FETCH();
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &zv_string, &zv_status)==FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -219,7 +217,6 @@ PHP_FUNCTION(iconv_set_encoding)
{
zval **type, **charset;
int argc = ZEND_NUM_ARGS();
- ICONVLS_FETCH();
if (argc != 2 || zend_get_parameters_ex(2, &type, &charset) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -257,7 +254,6 @@ PHP_FUNCTION(iconv_get_encoding)
{
zval **type;
int argc = ZEND_NUM_ARGS();
- ICONVLS_FETCH();
if (argc < 0 || argc > 1 || zend_get_parameters_ex(1, &type) == FAILURE) {
WRONG_PARAM_COUNT;
diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h
index 2178fa2e4e..f60097951b 100644
--- a/ext/iconv/php_iconv.h
+++ b/ext/iconv/php_iconv.h
@@ -45,15 +45,9 @@ ZEND_BEGIN_MODULE_GLOBALS(iconv)
ZEND_END_MODULE_GLOBALS(iconv)
#ifdef ZTS
-#define ICONVLS_D zend_iconv_globals *iconv_globals
-#define ICONVLS_C iconv_globals
-#define ICONVG(v) (iconv_globals->v)
-#define ICONVLS_FETCH() zend_iconv_globals *iconv_globals = ts_resource(iconv_globals_id)
+#define ICONVG(v) TSRMG(iconv_globals_id, zend_iconv_globals *, v)
#else
-#define ICONVLS_D
-#define ICONVLS_C
#define ICONVG(v) (iconv_globals.v)
-#define ICONVLS_FETCH()
#endif
#define ICONV_INPUT_ENCODING "ISO-8859-1"
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 95ff78a643..051e144c21 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -189,7 +189,7 @@ static int le_pimapchain;
void mail_close_it(zend_rsrc_list_entry *rsrc)
{
pils *imap_le_struct = (pils *)rsrc->ptr;
- IMAPLS_FETCH();
+ TSRMLS_FETCH();
mail_close_full(imap_le_struct->imap_stream, imap_le_struct->flags);
@@ -300,8 +300,6 @@ void mail_free_errorlist(ERRORLIST **errlist)
/* Author: CJH */
PHP_RINIT_FUNCTION(imap)
{
- IMAPLS_FETCH();
-
IMAPG(imap_errorstack) = NIL;
IMAPG(imap_alertstack) = NIL;
return SUCCESS;
@@ -312,7 +310,7 @@ PHP_RSHUTDOWN_FUNCTION(imap)
{
ERRORLIST *ecur = NIL;
STRINGLIST *acur = NIL;
- IMAPLS_FETCH();
+ TSRMLS_FETCH();
if (IMAPG(imap_errorstack) != NIL) {
/* output any remaining errors at their original error level */
@@ -368,7 +366,7 @@ MESSAGELIST *mail_newmessagelist(void)
*/
void mail_getquota(MAILSTREAM *stream, char *qroot,QUOTALIST *qlist)
{
- IMAPLS_FETCH();
+ TSRMLS_FETCH();
/* this should only be run through once */
for (; qlist; qlist = qlist->next)
@@ -657,7 +655,6 @@ void imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
#endif
int ind;
int myargc=ZEND_NUM_ARGS();
- IMAPLS_FETCH();
if (myargc <3 || myargc >4 || zend_get_parameters_ex(myargc, &mailbox, &user, &passwd, &options) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -1032,7 +1029,6 @@ PHP_FUNCTION(imap_get_quota)
zval **streamind, **qroot;
int ind, ind_type;
pils *imap_le_struct;
- IMAPLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &qroot) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -1465,7 +1461,6 @@ PHP_FUNCTION(imap_list)
int ind, ind_type;
pils *imap_le_struct;
STRINGLIST *cur=NIL;
- IMAPLS_FETCH();
/* set flag for normal, old mailbox list */
IMAPG(folderlist_style) = FLIST_ARRAY;
@@ -1512,7 +1507,6 @@ PHP_FUNCTION(imap_list_full)
pils *imap_le_struct;
FOBJECTLIST *cur=NIL;
char *delim=NIL;
- IMAPLS_FETCH();
/* set flag for new, improved array of objects mailbox list */
IMAPG(folderlist_style) = FLIST_OBJECT;
@@ -1571,7 +1565,6 @@ PHP_FUNCTION(imap_listscan)
int ind, ind_type;
pils *imap_le_struct;
STRINGLIST *cur=NIL;
- IMAPLS_FETCH();
if (ZEND_NUM_ARGS()!=4 || zend_get_parameters_ex(4, &streamind, &ref, &pat, &content) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -1847,8 +1840,6 @@ PHP_FUNCTION(imap_lsub)
int ind, ind_type;
pils *imap_le_struct;
STRINGLIST *cur=NIL;
- IMAPLS_FETCH();
-
/* set flag for normal, old mailbox list */
IMAPG(folderlist_style) = FLIST_ARRAY;
@@ -1893,7 +1884,7 @@ PHP_FUNCTION(imap_lsub_full)
pils *imap_le_struct;
FOBJECTLIST *cur=NIL;
char *delim=NIL;
- IMAPLS_FETCH();
+ TSRMLS_FETCH();
delim = emalloc(2 * sizeof(char));
@@ -2868,7 +2859,6 @@ PHP_FUNCTION(imap_status)
int ind, ind_type;
pils *imap_le_struct;
int myargc=ZEND_NUM_ARGS();
- IMAPLS_FETCH();
if (myargc != 3 || zend_get_parameters_ex(myargc, &streamind, &mbx, &flags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -3618,7 +3608,6 @@ PHP_FUNCTION(imap_search)
long flags;
char *search_criteria;
MESSAGELIST *cur;
- IMAPLS_FETCH();
args = ZEND_NUM_ARGS();
if (args < 2 || args > 3 || zend_get_parameters_ex(args, &streamind, &criteria, &search_flags) == FAILURE) {
@@ -3669,7 +3658,6 @@ PHP_FUNCTION(imap_alerts)
{
STRINGLIST *cur=NIL;
int arg_count = ZEND_NUM_ARGS();
- IMAPLS_FETCH();
if (arg_count > 0) {
ZEND_WRONG_PARAM_COUNT();
@@ -3697,7 +3685,6 @@ PHP_FUNCTION(imap_errors)
{
ERRORLIST *cur=NIL;
int arg_count = ZEND_NUM_ARGS();
- IMAPLS_FETCH();
if (arg_count > 0) {
ZEND_WRONG_PARAM_COUNT();
@@ -3725,7 +3712,6 @@ PHP_FUNCTION(imap_last_error)
{
ERRORLIST *cur=NIL;
int arg_count = ZEND_NUM_ARGS();
- IMAPLS_FETCH();
if (arg_count > 0) {
ZEND_WRONG_PARAM_COUNT();
@@ -4090,7 +4076,7 @@ void _php_imap_add_body(zval *arg, BODY *body)
void mm_searched(MAILSTREAM *stream,unsigned long number)
{
MESSAGELIST *cur = NIL;
- IMAPLS_FETCH();
+ TSRMLS_FETCH();
if (IMAPG(imap_messages) == NIL) {
IMAPG(imap_messages) = mail_newmessagelist();
@@ -4124,7 +4110,7 @@ void mm_flags(MAILSTREAM *stream,unsigned long number)
void mm_notify(MAILSTREAM *stream, char *str, long errflg)
{
STRINGLIST *cur = NIL;
- IMAPLS_FETCH();
+ TSRMLS_FETCH();
if (strncmp(str, "[ALERT] ", 8) == 0) {
if (IMAPG(imap_alertstack) == NIL) {
@@ -4148,7 +4134,7 @@ void mm_list(MAILSTREAM *stream,DTYPE delimiter, char *mailbox, long attributes)
{
STRINGLIST *cur=NIL;
FOBJECTLIST *ocur=NIL;
- IMAPLS_FETCH();
+ TSRMLS_FETCH();
if (IMAPG(folderlist_style) == FLIST_OBJECT) {
/* build up a the new array of objects */
@@ -4197,7 +4183,7 @@ void mm_lsub(MAILSTREAM *stream,DTYPE delimiter, char *mailbox, long attributes)
{
STRINGLIST *cur=NIL;
FOBJECTLIST *ocur=NIL;
- IMAPLS_FETCH();
+ TSRMLS_FETCH();
if (IMAPG(folderlist_style) == FLIST_OBJECT) {
/* build the array of objects */
@@ -4241,7 +4227,7 @@ void mm_lsub(MAILSTREAM *stream,DTYPE delimiter, char *mailbox, long attributes)
void mm_status(MAILSTREAM *stream, char *mailbox,MAILSTATUS *status)
{
- IMAPLS_FETCH();
+ TSRMLS_FETCH();
IMAPG(status_flags)=status->flags;
if (IMAPG(status_flags) & SA_MESSAGES) {
@@ -4264,7 +4250,7 @@ void mm_status(MAILSTREAM *stream, char *mailbox,MAILSTATUS *status)
void mm_log(char *str, long errflg)
{
ERRORLIST *cur = NIL;
- IMAPLS_FETCH();
+ TSRMLS_FETCH();
/* Author: CJH */
if (errflg != NIL) { /* CJH: maybe put these into a more comprehensive log for debugging purposes? */
@@ -4296,7 +4282,7 @@ void mm_dlog(char *str)
void mm_login(NETMBX *mb, char *user, char *pwd, long trial)
{
- IMAPLS_FETCH();
+ TSRMLS_FETCH();
if (*mb->user) {
strlcpy (user,mb->user, MAILTMPLEN);
diff --git a/ext/imap/php_imap.h b/ext/imap/php_imap.h
index a67eed086b..ea0a0685a3 100644
--- a/ext/imap/php_imap.h
+++ b/ext/imap/php_imap.h
@@ -176,19 +176,9 @@ ZEND_END_MODULE_GLOBALS(imap)
#ifdef ZTS
-# define IMAPLS_D zend_imap_globals *imap_globals
-# define IMAPLS_DC , IMAPLS_D
-# define IMAPLS_C imap_globals
-# define IMAPLS_CC , IMAPLS_C
-# define IMAPG(v) (imap_globals->v)
-# define IMAPLS_FETCH() zend_imap_globals *imap_globals = ts_resource(imap_globals_id)
+# define IMAPG(v) TSRMG(imap_globals_id, zend_imap_globals *, v)
#else
-# define IMAPLS_D
-# define IMAPLS_DC
-# define IMAPLS_C
-# define IMAPLS_CC
# define IMAPG(v) (imap_globals.v)
-# define IMAPLS_FETCH()
#endif
#define phpext_imap_ptr imap_module_ptr
diff --git a/ext/ingres_ii/ii.c b/ext/ingres_ii/ii.c
index bddf3b5c1e..6d0ff7ab4e 100644
--- a/ext/ingres_ii/ii.c
+++ b/ext/ingres_ii/ii.c
@@ -146,7 +146,7 @@ static int _rollback_transaction(II_LINK *link)
static void _close_ii_link(II_LINK *link)
{
IIAPI_DISCONNPARM disconnParm;
- IILS_FETCH();
+ TSRMLS_FETCH();
if(link->tranHandle && _rollback_transaction(link)) {
php_error(E_WARNING,"Ingres II: Unable to rollback transaction !!");
@@ -179,7 +179,7 @@ static void php_close_ii_link(zend_rsrc_list_entry *rsrc)
static void _close_ii_plink(zend_rsrc_list_entry *rsrc)
{
II_LINK *link = (II_LINK *)rsrc->ptr;
- IILS_FETCH();
+ TSRMLS_FETCH();
_close_ii_link(link);
IIG(num_persistent)--;
@@ -193,7 +193,7 @@ static void _clean_ii_plink(zend_rsrc_list_entry *rsrc)
{
II_LINK *link = (II_LINK *)rsrc->ptr;
IIAPI_AUTOPARM autoParm;
- IILS_FETCH();
+ TSRMLS_FETCH();
if(link->autocommit) {
@@ -226,7 +226,7 @@ static void _clean_ii_plink(zend_rsrc_list_entry *rsrc)
*/
static void php_ii_set_default_link(int id)
{
- IILS_FETCH();
+ TSRMLS_FETCH();
if (IIG(default_link)!=-1) {
zend_list_delete(IIG(default_link));
@@ -239,7 +239,7 @@ static void php_ii_set_default_link(int id)
if none has been set, tries to open a new one with default
parameters
*/
-static int php_ii_get_default_link(INTERNAL_FUNCTION_PARAMETERS IILS_DC)
+static int php_ii_get_default_link(INTERNAL_FUNCTION_PARAMETERS TSRMLS_DC)
{
if (IIG(default_link)==-1) { /* no link opened yet, implicitly open one */
ht = 0;
@@ -303,8 +303,6 @@ PHP_MSHUTDOWN_FUNCTION(ii)
*/
PHP_RINIT_FUNCTION(ii)
{
- IILS_FETCH();
-
IIG(default_link) = -1;
IIG(num_links) = IIG(num_persistent);
return SUCCESS;
@@ -314,7 +312,7 @@ PHP_RINIT_FUNCTION(ii)
*/
PHP_RSHUTDOWN_FUNCTION(ii)
{
- IILS_FETCH();
+ TSRMLS_FETCH();
if (IIG(default_link)!=-1) {
zend_list_delete(IIG(default_link));
@@ -328,7 +326,7 @@ PHP_RSHUTDOWN_FUNCTION(ii)
PHP_MINFO_FUNCTION(ii)
{
char buf[32];
- IILS_FETCH();
+ TSRMLS_FETCH();
php_info_print_table_start();
php_info_print_table_header(2, "Ingres II Support", "enabled");
@@ -397,8 +395,6 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
int hashed_details_length;
IIAPI_CONNPARM connParm;
II_LINK *link;
- IILS_FETCH();
- PLS_FETCH();
/* Setting db, user and pass according to sql_safe_mode, parameters and/or default values */
argc = ZEND_NUM_ARGS();
@@ -623,7 +619,6 @@ PHP_FUNCTION(ingres_close)
int argc;
int link_id = -1;
II_LINK *ii_link;
- IILS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc > 1 || (argc && zend_get_parameters_ex(argc, &link) == FAILURE)){
@@ -663,7 +658,6 @@ PHP_FUNCTION(ingres_query)
II_LINK *ii_link;
IIAPI_QUERYPARM queryParm;
IIAPI_GETDESCRPARM getDescrParm;
- IILS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &query, &link) == FAILURE){
@@ -671,7 +665,7 @@ PHP_FUNCTION(ingres_query)
}
if (argc < 2) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
+ link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
}
ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
@@ -736,7 +730,6 @@ PHP_FUNCTION(ingres_num_rows)
int link_id = -1;
II_LINK *ii_link;
IIAPI_GETQINFOPARM getQInfoParm;
- IILS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc > 1 || zend_get_parameters_ex(argc, &link) == FAILURE){
@@ -744,7 +737,7 @@ PHP_FUNCTION(ingres_num_rows)
}
if (argc < 1) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
+ link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
}
ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
@@ -778,7 +771,6 @@ PHP_FUNCTION(ingres_num_fields)
int argc;
int link_id = -1;
II_LINK *ii_link;
- IILS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc > 1 || zend_get_parameters_ex(argc, &link) == FAILURE){
@@ -786,7 +778,7 @@ PHP_FUNCTION(ingres_num_fields)
}
if (argc < 1) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
+ link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
}
ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
@@ -812,7 +804,6 @@ static void php_ii_field_info(INTERNAL_FUNCTION_PARAMETERS, int info_type)
char *name, *fun_name;
int index;
II_LINK *ii_link;
- IILS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &idx, &link) == FAILURE){
@@ -820,7 +811,7 @@ static void php_ii_field_info(INTERNAL_FUNCTION_PARAMETERS, int info_type)
}
if (argc < 2) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
+ link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
}
ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
@@ -1014,7 +1005,6 @@ static void php_ii_fetch(INTERNAL_FUNCTION_PARAMETERS, II_LINK *ii_link, int res
long value_long;
char *value_char_p;
int len, should_copy, correct_length;
- PLS_FETCH();
/* array initialization */
if (array_init(return_value)==FAILURE) {
@@ -1195,7 +1185,6 @@ PHP_FUNCTION(ingres_fetch_array)
int argc;
int link_id = -1;
II_LINK *ii_link;
- IILS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc > 2 || zend_get_parameters_ex(argc, &result_type, &link) == FAILURE){
@@ -1203,7 +1192,7 @@ PHP_FUNCTION(ingres_fetch_array)
}
if (argc != 2) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
+ link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
}
if (argc != 0) {
@@ -1225,7 +1214,6 @@ PHP_FUNCTION(ingres_fetch_row)
int argc;
int link_id = -1;
II_LINK *ii_link;
- IILS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc > 1 || zend_get_parameters_ex(argc, &link) == FAILURE){
@@ -1233,7 +1221,7 @@ PHP_FUNCTION(ingres_fetch_row)
}
if (argc != 1) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
+ link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
}
ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
@@ -1250,7 +1238,6 @@ PHP_FUNCTION(ingres_fetch_object)
int argc;
int link_id = -1;
II_LINK *ii_link;
- IILS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc > 2 || zend_get_parameters_ex(argc, &result_type, &link) == FAILURE){
@@ -1258,7 +1245,7 @@ PHP_FUNCTION(ingres_fetch_object)
}
if (argc != 2) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
+ link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
}
if (argc != 0) {
@@ -1283,7 +1270,6 @@ PHP_FUNCTION(ingres_rollback)
int argc;
int link_id = -1;
II_LINK *ii_link;
- IILS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc > 1 || (argc && zend_get_parameters_ex(argc, &link) == FAILURE)){
@@ -1311,7 +1297,6 @@ PHP_FUNCTION(ingres_commit)
int link_id = -1;
II_LINK *ii_link;
IIAPI_COMMITPARM commitParm;
- IILS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc > 1 || (argc && zend_get_parameters_ex(argc, &link) == FAILURE)){
@@ -1353,7 +1338,6 @@ PHP_FUNCTION(ingres_autocommit)
int link_id = -1;
II_LINK *ii_link;
IIAPI_AUTOPARM autoParm;
- IILS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc > 1 || (argc && zend_get_parameters_ex(argc, &link) == FAILURE)){
diff --git a/ext/ingres_ii/ii.h b/ext/ingres_ii/ii.h
index d5da50acb5..675f64a55f 100644
--- a/ext/ingres_ii/ii.h
+++ b/ext/ingres_ii/ii.h
@@ -46,7 +46,7 @@ static int _close_statement(II_LINK *link);
static int _rollback_transaction(II_LINK *link);
static void _close_ii_link(II_LINK *link);
static void _close_ii_plink(zend_rsrc_list_entry *link);
-static int php_ii_get_default_link(INTERNAL_FUNCTION_PARAMETERS IILS_DC);
+static int php_ii_get_default_link(INTERNAL_FUNCTION_PARAMETERS TSRMLS_DC);
static void php_ii_set_default_link(int id);
static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent);
static char *php_ii_field_name(II_LINK *ii_link, int index);
diff --git a/ext/ingres_ii/php_ii.h b/ext/ingres_ii/php_ii.h
index af9ee73d7a..b48e931985 100644
--- a/ext/ingres_ii/php_ii.h
+++ b/ext/ingres_ii/php_ii.h
@@ -78,19 +78,9 @@ ZEND_END_MODULE_GLOBALS(ii)
#define II_BOTH (II_ASSOC|II_NUM)
#ifdef ZTS
-#define IILS_D zend_ii_globals *ii_globals
-#define IILS_DC , IILS_D
-#define IILS_C ii_globals
-#define IILS_CC , IILS_C
-#define IIG(v) (ii_globals->v)
-#define IILS_FETCH() zend_ii_globals *ii_globals = ts_resource(ii_globals_id)
+#define IIG(v) TSRMG(ii_globals_id, zend_ii_globals *, v)
#else
-#define IILS_D
-#define IILS_DC
-#define IILS_C
-#define IILS_CC
#define IIG(v) (ii_globals.v)
-#define IILS_FETCH()
#endif
#else
diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c
index e39dfab7e8..b443bd9fa4 100644
--- a/ext/interbase/interbase.c
+++ b/ext/interbase/interbase.c
@@ -144,7 +144,6 @@ static void get_link_trans(INTERNAL_FUNCTION_PARAMETERS, zval **link_id, ibase_d
int type;
void *resource = NULL;
ibase_tr_link *ib_trans;
- IBLS_FETCH();
IBDEBUG("Transaction or database link?");
if ((resource = zend_list_find(Z_LVAL_PP(link_id), &type))) {
@@ -237,8 +236,6 @@ typedef struct {
Return error message */
PHP_FUNCTION(ibase_errmsg)
{
- IBLS_FETCH();
-
if (IBG(errmsg[0])) {
RETURN_STRING(IBG(errmsg),1);
}
@@ -252,7 +249,7 @@ static void _php_ibase_error(void)
{
char *s;
ISC_STATUS *statusp;
- IBLS_FETCH();
+ TSRMLS_FETCH();
s = IBG(errmsg);
statusp = IB_STATUS;
@@ -270,7 +267,7 @@ static void _php_ibase_module_error(char *msg, ...)
{
va_list ap;
int len;
- IBLS_FETCH();
+ TSRMLS_FETCH();
va_start(ap, msg);
len = vsnprintf(IBG(errmsg), MAX_ERRMSG - 1, msg, ap);
@@ -309,7 +306,7 @@ static void _php_ibase_free_xsqlda(XSQLDA *sqlda)
static void _php_ibase_commit_link(ibase_db_link *link)
{
int i;
- IBLS_FETCH();
+ TSRMLS_FETCH();
IBDEBUG("Checking transactions to close...");
if (link->trans[0] != NULL) { /* commit default */
@@ -341,7 +338,7 @@ static void php_ibase_commit_link_rsrc(zend_rsrc_list_entry *rsrc)
static void _php_ibase_close_link(zend_rsrc_list_entry *rsrc)
{
ibase_db_link *link = (ibase_db_link *)rsrc->ptr;
- IBLS_FETCH();
+ TSRMLS_FETCH();
_php_ibase_commit_link(link);
IBDEBUG("Closing normal link...");
@@ -355,7 +352,7 @@ static void _php_ibase_close_link(zend_rsrc_list_entry *rsrc)
static void _php_ibase_close_plink(zend_rsrc_list_entry *rsrc)
{
ibase_db_link *link = (ibase_db_link *)rsrc->ptr;
- IBLS_FETCH();
+ TSRMLS_FETCH();
_php_ibase_commit_link(link);
IBDEBUG("Closing permanent link...");
@@ -370,7 +367,7 @@ static void _php_ibase_close_plink(zend_rsrc_list_entry *rsrc)
static void _php_ibase_free_result(zend_rsrc_list_entry *rsrc)
{
ibase_result *ib_result = (ibase_result *)rsrc->ptr;
- IBLS_FETCH();
+ TSRMLS_FETCH();
IBDEBUG("Freeing result...");
if (ib_result){
@@ -403,7 +400,7 @@ static void _php_ibase_free_result(zend_rsrc_list_entry *rsrc)
/* {{{ _php_ibase_free_query() */
static void _php_ibase_free_query(ibase_query *ib_query)
{
- IBLS_FETCH();
+ TSRMLS_FETCH();
IBDEBUG("Freeing query...");
if (ib_query) {
@@ -440,7 +437,7 @@ static void php_ibase_free_query_rsrc(zend_rsrc_list_entry *rsrc)
static void _php_ibase_free_blob(zend_rsrc_list_entry *rsrc)
{
ibase_blob_handle *ib_blob = (ibase_blob_handle *)rsrc->ptr;
- IBLS_FETCH();
+ TSRMLS_FETCH();
if (ib_blob->bl_handle != NULL) { /* blob open*/
if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)) {
@@ -456,7 +453,7 @@ static void _php_ibase_free_trans(zend_rsrc_list_entry *rsrc)
{
ibase_tr_link *ib_trans = (ibase_tr_link *)rsrc->ptr;
ibase_db_link *ib_link;
- IBLS_FETCH();
+ TSRMLS_FETCH();
ib_link = (ibase_db_link *) zend_fetch_resource(NULL, ib_trans->link_rsrc, "InterBase link", NULL, 2, le_link, le_plink);
@@ -486,7 +483,7 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("ibase.timeformat", "%H:%M:%S", PHP_INI_ALL, OnUpdateString, cfg_timeformat, zend_ibase_globals, ibase_globals)
PHP_INI_END()
-static void php_ibase_init_globals(IBLS_D)
+static void php_ibase_init_globals(TSRMLS_D)
{
IBG(timestampformat) = NULL;
IBG(dateformat) = NULL;
@@ -497,7 +494,7 @@ static void php_ibase_init_globals(IBLS_D)
PHP_MINIT_FUNCTION(ibase)
{
- IBLS_FETCH();
+ TSRMLS_FETCH();
ZEND_INIT_MODULE_GLOBALS(ibase, php_ibase_init_globals, NULL);
@@ -527,8 +524,6 @@ PHP_MINIT_FUNCTION(ibase)
PHP_RINIT_FUNCTION(ibase)
{
- IBLS_FETCH();
-
IBG(default_link)= -1;
IBG(num_links) = IBG(num_persistent);
@@ -561,7 +556,7 @@ PHP_MSHUTDOWN_FUNCTION(ibase)
PHP_RSHUTDOWN_FUNCTION(ibase)
{
- IBLS_FETCH();
+ TSRMLS_FETCH();
if (IBG(timestampformat))
DL_FREE(IBG(timestampformat));
@@ -586,7 +581,7 @@ PHP_RSHUTDOWN_FUNCTION(ibase)
PHP_MINFO_FUNCTION(ibase)
{
char tmp[32];
- IBLS_FETCH();
+ TSRMLS_FETCH();
php_info_print_table_start();
php_info_print_table_row(2, "Interbase Support", "enabled");
@@ -625,7 +620,7 @@ static int _php_ibase_attach_db(char *server, char *uname, char *passwd, char *c
{
char dpb_buffer[256], *dpb, *p;
int dpb_length, len;
- IBLS_FETCH();
+ TSRMLS_FETCH();
dpb = dpb_buffer;
@@ -691,8 +686,6 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
char *hashed_details;
int hashed_details_length = 0;
ibase_db_link *ib_link = NULL;
- IBLS_FETCH();
- PLS_FETCH();
RESET_ERRMSG;
@@ -902,7 +895,6 @@ PHP_FUNCTION(ibase_close)
zval **link_arg;
ibase_db_link *ib_link;
int link_id;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -936,7 +928,7 @@ static int _php_ibase_alloc_array(ibase_array **ib_arrayp, int *array_cntp,
int i, dim, ar_cnt, ar_length;
XSQLVAR *var;
- IBLS_FETCH();
+ TSRMLS_FETCH();
IB_ARRAY = NULL;
@@ -1029,7 +1021,7 @@ static int _php_ibase_alloc_array(ibase_array **ib_arrayp, int *array_cntp,
static int _php_ibase_alloc_query(ibase_query **ib_queryp, isc_db_handle link, isc_tr_handle trans, char *query, unsigned short dialect)
{
#define IB_QUERY (*ib_queryp)
- IBLS_FETCH();
+ TSRMLS_FETCH();
IB_QUERY = emalloc(sizeof(ibase_query));
IB_QUERY->link = link;
@@ -1361,7 +1353,7 @@ static int _php_ibase_exec(ibase_result **ib_resultp, ibase_query *ib_query, int
XSQLDA *in_sqlda = NULL, *out_sqlda = NULL;
BIND_BUF *bind_buf = NULL;
int rv = FAILURE;
- IBLS_FETCH();
+ TSRMLS_FETCH();
IB_RESULT = NULL;
@@ -1441,7 +1433,6 @@ PHP_FUNCTION(ibase_trans)
int tpb_len = 0, argn, link_id, trans_n = 0, i;
ibase_db_link *ib_link;
ibase_tr_link *ib_trans;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -1526,7 +1517,7 @@ PHP_FUNCTION(ibase_trans)
/* open default transaction */
static int _php_ibase_def_trans(ibase_db_link * ib_link, int trans_n)
{
- IBLS_FETCH();
+ TSRMLS_FETCH();
if (trans_n == 0 && ib_link->trans[0] == NULL) {
if (isc_start_transaction(IB_STATUS, &ib_link->trans[0], 1, &ib_link->link, 0, NULL)) {
@@ -1546,7 +1537,6 @@ static void _php_ibase_trans_end(INTERNAL_FUNCTION_PARAMETERS, int commit)
pval **link_trans_arg = NULL;
int link_id = 0, trans_n = 0, trans_id = 0;
ibase_db_link *ib_link;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -1619,7 +1609,6 @@ PHP_FUNCTION(ibase_query)
ibase_db_link *ib_link;
ibase_query *ib_query;
ibase_result *ib_result;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -1695,8 +1684,7 @@ PHP_FUNCTION(ibase_query)
static int _php_ibase_var_pval(pval *val, void *data, int type, int len, int scale, int flag)
{
char string_data[255];
- IBLS_FETCH();
- PLS_FETCH();
+ TSRMLS_FETCH();
switch(type & ~1) {
case SQL_VARYING:
@@ -1887,7 +1875,6 @@ static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type)
int i, arr_cnt;
ibase_result *ib_result;
XSQLVAR *var;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2116,7 +2103,6 @@ PHP_FUNCTION(ibase_free_result)
{
zval **result_arg;
ibase_result *ib_result;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2139,7 +2125,6 @@ PHP_FUNCTION(ibase_prepare)
ibase_db_link *ib_link;
ibase_query *ib_query;
char *query;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2189,7 +2174,6 @@ PHP_FUNCTION(ibase_execute)
pval ***args, **bind_args = NULL;
ibase_query *ib_query;
ibase_result *ib_result;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2241,7 +2225,6 @@ PHP_FUNCTION(ibase_free_query)
{
pval **query_arg;
ibase_query *ib_query;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2263,7 +2246,6 @@ PHP_FUNCTION(ibase_timefmt)
pval ***args;
char *fmt = NULL;
int type = PHP_IBASE_TIMESTAMP;
- IBLS_FETCH();
RESET_ERRMSG; /* ??? */
@@ -2320,7 +2302,6 @@ PHP_FUNCTION(ibase_num_fields)
{
pval **result;
ibase_result *ib_result;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2349,7 +2330,6 @@ PHP_FUNCTION(ibase_field_info)
char buf[30], *s;
int len;
XSQLVAR *var;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2432,7 +2412,7 @@ static int _php_ibase_blob_info(isc_blob_handle bl_handle,IBASE_BLOBINFO *bl_inf
};
char bl_inf[sizeof(long)*8], *p;
- IBLS_FETCH();
+ TSRMLS_FETCH();
bl_info->max_segment = 0;
bl_info->num_segments = 0;
@@ -2484,7 +2464,6 @@ PHP_FUNCTION(ibase_blob_create)
int trans_n = 0, trans_id = 0, link_id;
ibase_db_link *ib_link;
ibase_blob_handle *ib_blob;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2530,7 +2509,6 @@ PHP_FUNCTION(ibase_blob_open)
{
pval *blob_arg;
ibase_blob_handle *ib_blob, *ib_blob_id;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2567,7 +2545,6 @@ PHP_FUNCTION(ibase_blob_add)
{
pval *blob_arg,*string_arg;
ibase_blob_handle *ib_blob;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2596,7 +2573,6 @@ PHP_FUNCTION(ibase_blob_get)
char *bl_data;
unsigned short max_len = 0, cur_len, seg_len;
ibase_blob_handle *ib_blob;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2645,7 +2621,6 @@ static void _php_ibase_blob_end(INTERNAL_FUNCTION_PARAMETERS, int bl_end)
{
pval *blob_arg;
ibase_blob_handle *ib_blob;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2700,7 +2675,6 @@ PHP_FUNCTION(ibase_blob_info)
pval *blob_arg, *result_var;
ibase_blob_handle *ib_blob_id;
IBASE_BLOBINFO bl_info;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2775,7 +2749,6 @@ PHP_FUNCTION(ibase_blob_echo)
char bl_data[IBASE_BLOB_SEG];
unsigned short seg_len;
ibase_blob_handle *ib_blob_id;
- IBLS_FETCH();
RESET_ERRMSG;
@@ -2833,7 +2806,6 @@ PHP_FUNCTION(ibase_blob_import)
ibase_db_link *ib_link;
char bl_data[IBASE_BLOB_SEG]; /* FIXME? blob_seg_size parameter? */
FILE *fp;
- IBLS_FETCH();
void * what;
int type;
diff --git a/ext/interbase/php_interbase.h b/ext/interbase/php_interbase.h
index e1e4e0e5cd..d7d4b55817 100644
--- a/ext/interbase/php_interbase.h
+++ b/ext/interbase/php_interbase.h
@@ -159,15 +159,10 @@ enum php_interbase_option {
};
#ifdef ZTS
-#define IBLS_D zend_ibase_globals *ibase_globals
-#define IBLS_C ibase_globals
#define IBG(v) (ibase_globals->v)
-#define IBLS_FETCH() zend_ibase_globals *ibase_globals = ts_resource(ibase_globals_id)
+#define IBG(v) TSRMG(ibase_globals_id, zend_ibase_globals *, v)
#else
-#define IBLS_D
-#define IBLS_C
#define IBG(v) (ibase_globals.v)
-#define IBLS_FETCH()
#endif
#else
diff --git a/ext/java/java.c b/ext/java/java.c
index 7a65baa4bd..955d1882d4 100644
--- a/ext/java/java.c
+++ b/ext/java/java.c
@@ -619,7 +619,7 @@ PHP_MINIT_FUNCTION(java) {
if (!classpath) classpath = getenv("CLASSPATH");
if (!libpath) {
- PLS_FETCH();
+ TSRMLS_FETCH();
libpath=PG(extension_dir);
}
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index f7479aa443..7b43f8e26f 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -139,7 +139,7 @@ ZEND_GET_MODULE(ldap)
static void _close_ldap_link(zend_rsrc_list_entry *rsrc)
{
LDAP *ld = (LDAP *)rsrc->ptr;
- LDAPLS_FETCH();
+ TSRMLS_FETCH();
ldap_unbind_s(ld);
LDAPG(num_links)--;
@@ -238,8 +238,6 @@ PHP_MINFO_FUNCTION(ldap)
double SDKVersion;
#endif
- LDAPLS_FETCH();
-
#if HAVE_NSLDAP
/* Print version information */
SDKVersion = ldap_version( &ver );
@@ -303,7 +301,6 @@ PHP_FUNCTION(ldap_connect)
/* char *hashed_details;
int hashed_details_length;*/
LDAP *ldap;
- LDAPLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
@@ -550,7 +547,6 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
int num_attribs = 0;
int i, errno;
int myargcount = ZEND_NUM_ARGS();
- LDAPLS_FETCH();
if (myargcount < 3 || myargcount > 8 || zend_get_parameters_ex(myargcount, &link, &base_dn, &filter, &attrs, &attrsonly, &sizelimit, &timelimit, &deref) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -846,7 +842,6 @@ PHP_FUNCTION(ldap_first_entry)
pval **link, **result;
LDAP *ldap;
LDAPMessage *ldap_result, *ldap_result_entry;
- LDAPLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -870,7 +865,6 @@ PHP_FUNCTION(ldap_next_entry)
pval **link, **result_entry;
LDAP *ldap;
LDAPMessage *ldap_result_entry, *ldap_result_entry_next;
- LDAPLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result_entry) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -984,7 +978,6 @@ PHP_FUNCTION(ldap_first_attribute)
LDAPMessage *ldap_result_entry;
BerElement *ber;
char *attribute;
- LDAPLS_FETCH();
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &result, &berp) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1834,7 +1827,6 @@ PHP_FUNCTION(ldap_first_reference)
LDAP *ldap;
LDAPMessage *ldap_result;
LDAPMessage *ldap_result_entry;
- LDAPLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1858,7 +1850,6 @@ PHP_FUNCTION(ldap_next_reference)
pval **link, **result_entry;
LDAP *ldap;
LDAPMessage *ldap_result_entry, *ldap_result_entry_next;
- LDAPLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result_entry) == FAILURE) {
WRONG_PARAM_COUNT;
diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h
index b35df480ff..9404c82585 100644
--- a/ext/ldap/php_ldap.h
+++ b/ext/ldap/php_ldap.h
@@ -101,19 +101,9 @@ ZEND_BEGIN_MODULE_GLOBALS(ldap)
ZEND_END_MODULE_GLOBALS(ldap)
#ifdef ZTS
-# define LDAPLS_D zend_ldap_globals *ldap_globals
-# define LDAPLS_DC , LDAPLS_D
-# define LDAPLS_C ldap_globals
-# define LDAPLS_CC , LDAPLS_C
-# define LDAPG(v) (ldap_globals->v)
-# define LDAPLS_FETCH() zend_ldap_globals *ldap_globals = ts_resource(ldap_globals_id)
+# define LDAPG(v) TSRMG(ldap_globals_id, zend_ldap_globals *, v)
#else
-# define LDAPLS_D
-# define LDAPLS_DC
-# define LDAPLS_C
-# define LDAPLS_CC
# define LDAPG(v) (ldap_globals.v)
-# define LDAPLS_FETCH()
#endif
diff --git a/ext/mailparse/php_mailparse.h b/ext/mailparse/php_mailparse.h
index 3cc0449dbf..5b76d90201 100755
--- a/ext/mailparse/php_mailparse.h
+++ b/ext/mailparse/php_mailparse.h
@@ -71,11 +71,9 @@ extern ZEND_DECLARE_MODULE_GLOBALS(mailparse);
#ifdef ZTS
-#define MAILPARSEG(v) (mailparse_globals->v)
-#define MAILPARSELS_FETCH() zend_mailparse_globals *mailparse_globals = ts_resource(mailparse_globals_id)
+#define MAILPARSEG(v) TSRMG(mailparse_globals_id, zend_mailparse_globals *, v)
#else
#define MAILPARSEG(v) (mailparse_globals.v)
-#define MAILPARSELS_FETCH()
#endif
#endif
diff --git a/ext/mailparse/rfc2045.c b/ext/mailparse/rfc2045.c
index ea61cfdb2b..d61d8ac9ba 100755
--- a/ext/mailparse/rfc2045.c
+++ b/ext/mailparse/rfc2045.c
@@ -1076,7 +1076,7 @@ void rfc2045_mimeinfo(const struct rfc2045 *p,
const char **charset_s)
{
const char *c;
- MAILPARSELS_FETCH();
+ TSRMLS_FETCH();
*content_type_s=GETINFO(p->content_type, "text/plain");
*content_transfer_encoding_s=GETINFO(p->content_transfer_encoding,
diff --git a/ext/mailparse/rfc2045acchk.c b/ext/mailparse/rfc2045acchk.c
index 8fcd16dbaf..042c3ff593 100644
--- a/ext/mailparse/rfc2045acchk.c
+++ b/ext/mailparse/rfc2045acchk.c
@@ -15,7 +15,7 @@ int rfc2045_ac_check(struct rfc2045 *p, int rwmode)
/* hasnon7bit: 8bit chars in this section or subsections */
const char *te;
int is8bitte;
- MAILPARSELS_FETCH();
+ TSRMLS_FETCH();
for (c=p->firstpart; c; c=c->next)
if (!c->isdummy)
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index b888876f23..5f76a4dcfe 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -286,7 +286,7 @@ php_mbstring_parse_encoding_array(zval *array, int **return_list, int *return_si
static PHP_INI_MH(OnUpdate_mbstring_detect_order)
{
int *list, size;
- MBSTRLS_FETCH();
+ TSRMLS_FETCH();
if (php_mbstring_parse_encoding_list(new_value, new_value_length, &list, &size, 1)) {
if (MBSTRG(detect_order_list) != NULL) {
@@ -304,7 +304,7 @@ static PHP_INI_MH(OnUpdate_mbstring_detect_order)
static PHP_INI_MH(OnUpdate_mbstring_http_input)
{
int *list, size;
- MBSTRLS_FETCH();
+ TSRMLS_FETCH();
if (php_mbstring_parse_encoding_list(new_value, new_value_length, &list, &size, 1)) {
if (MBSTRG(http_input_list) != NULL) {
@@ -322,7 +322,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input)
static PHP_INI_MH(OnUpdate_mbstring_http_output)
{
enum mbfl_no_encoding no_encoding;
- MBSTRLS_FETCH();
+ TSRMLS_FETCH();
no_encoding = mbfl_name2no_encoding(new_value);
if (no_encoding != mbfl_no_encoding_invalid) {
@@ -340,7 +340,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output)
static PHP_INI_MH(OnUpdate_mbstring_internal_encoding)
{
enum mbfl_no_encoding no_encoding;
- MBSTRLS_FETCH();
+ TSRMLS_FETCH();
no_encoding = mbfl_name2no_encoding(new_value);
if (no_encoding != mbfl_no_encoding_invalid) {
@@ -357,7 +357,7 @@ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding)
static PHP_INI_MH(OnUpdate_mbstring_substitute_character)
{
- MBSTRLS_FETCH();
+ TSRMLS_FETCH();
if (new_value != NULL) {
if (strcasecmp("none", new_value) == 0) {
@@ -427,7 +427,7 @@ PHP_MINIT_FUNCTION(mbstring)
PHP_MSHUTDOWN_FUNCTION(mbstring)
{
- MBSTRLS_FETCH();
+ TSRMLS_FETCH();
UNREGISTER_INI_ENTRIES();
if (MBSTRG(http_input_list)) {
@@ -444,7 +444,6 @@ PHP_MSHUTDOWN_FUNCTION(mbstring)
PHP_RINIT_FUNCTION(mbstring)
{
int n, *list, *entry;
- MBSTRLS_FETCH();
MBSTRG(current_language) = MBSTRG(language);
MBSTRG(current_internal_encoding) = MBSTRG(internal_encoding);
@@ -477,7 +476,7 @@ PHP_RINIT_FUNCTION(mbstring)
PHP_RSHUTDOWN_FUNCTION(mbstring)
{
- MBSTRLS_FETCH();
+ TSRMLS_FETCH();
if (MBSTRG(current_detect_order_list) != NULL) {
efree(MBSTRG(current_detect_order_list));
@@ -521,7 +520,6 @@ PHP_FUNCTION(mb_language)
pval **arg1;
char *name;
enum mbfl_no_language no_language;
- MBSTRLS_FETCH();
if (ZEND_NUM_ARGS() == 0) {
name = (char *)mbfl_no_language2name(MBSTRG(current_language));
@@ -555,7 +553,6 @@ PHP_FUNCTION(mb_internal_encoding)
pval **arg1;
char *name;
enum mbfl_no_encoding no_encoding;
- MBSTRLS_FETCH();
if (ZEND_NUM_ARGS() == 0) {
name = (char *)mbfl_no_encoding2name(MBSTRG(current_internal_encoding));
@@ -588,7 +585,6 @@ PHP_FUNCTION(mb_http_input)
pval **arg1;
int result, retname, n, *entry;
char *name;
- MBSTRLS_FETCH();
retname = 1;
if (ZEND_NUM_ARGS() == 0) {
@@ -656,7 +652,6 @@ PHP_FUNCTION(mb_http_output)
pval **arg1;
char *name;
enum mbfl_no_encoding no_encoding;
- MBSTRLS_FETCH();
if (ZEND_NUM_ARGS() == 0) {
name = (char *)mbfl_no_encoding2name(MBSTRG(current_http_output_encoding));
@@ -689,7 +684,6 @@ PHP_FUNCTION(mb_detect_order)
pval **arg1;
int n, size, *list, *entry;
char *name;
- MBSTRLS_FETCH();
if (ZEND_NUM_ARGS() == 0) {
if (array_init(return_value) == FAILURE) {
@@ -739,7 +733,6 @@ PHP_FUNCTION(mb_detect_order)
PHP_FUNCTION(mb_substitute_character)
{
pval **arg1;
- MBSTRLS_FETCH();
if (ZEND_NUM_ARGS() == 0) {
if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
@@ -783,7 +776,6 @@ PHP_FUNCTION(mb_preferred_mime_name)
pval **arg1;
enum mbfl_no_encoding no_encoding;
const char *name;
- MBSTRLS_FETCH();
if (ZEND_NUM_ARGS() == 1 && zend_get_parameters_ex(1, &arg1) != FAILURE) {
convert_to_string_ex(arg1);
@@ -808,8 +800,8 @@ PHP_FUNCTION(mb_preferred_mime_name)
#if defined(MBSTR_ENC_TRANS)
static void
-php_mbstr_encoding_handler(zval *arg, char *res, char *separator) {
-
+php_mbstr_encoding_handler(zval *arg, char *res, char *separator)
+{
char *var, *val;
char *strtok_buf = NULL, **val_list;
zval *array_ptr = (zval *) arg;
@@ -818,9 +810,7 @@ php_mbstr_encoding_handler(zval *arg, char *res, char *separator) {
mbfl_string string, result, *ret;
mbfl_encoding_detector *identd;
mbfl_buffer_converter *convd;
- MBSTRLS_FETCH();
TSRMLS_FETCH();
- PLS_FETCH();
mbfl_string_init(&string);
mbfl_string_init(&result);
@@ -919,10 +909,10 @@ php_mbstr_encoding_handler(zval *arg, char *res, char *separator) {
ret = mbfl_buffer_converter_feed_result(convd, &string, &result);
}
if (ret != NULL) {
- php_register_variable_safe(val_list[n], ret->val, ret->len, array_ptr TSRMLS_CC PLS_CC);
+ php_register_variable_safe(val_list[n], ret->val, ret->len, array_ptr TSRMLS_CC);
efree(ret->val);
} else {
- php_register_variable_safe(val_list[n], val_list[n+1], len_list[n+1], array_ptr TSRMLS_CC PLS_CC);
+ php_register_variable_safe(val_list[n], val_list[n+1], len_list[n+1], array_ptr TSRMLS_CC);
}
n+=2;
}
@@ -942,7 +932,7 @@ php_mbstr_encoding_handler(zval *arg, char *res, char *separator) {
SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler)
{
- MBSTRLS_FETCH();
+ TSRMLS_FETCH();
MBSTRG(http_input_identify_post) = mbfl_no_encoding_invalid;
@@ -954,13 +944,12 @@ SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler)
}
/* http input processing */
-void mbstr_treat_data(int arg, char *str, zval* destArray TSRMLS_DC PLS_DC SLS_DC)
+void mbstr_treat_data(int arg, char *str, zval* destArray TSRMLS_DC)
{
char *res = NULL, *var, *val, *separator=NULL;
const char *c_var;
pval *array_ptr;
int free_buffer=0;
- MBSTRLS_FETCH();
switch (arg) {
case PARSE_POST:
@@ -987,7 +976,7 @@ void mbstr_treat_data(int arg, char *str, zval* destArray TSRMLS_DC PLS_DC SLS_D
}
if (arg==PARSE_POST) {
- sapi_handle_post(array_ptr SLS_CC);
+ sapi_handle_post(array_ptr TSRMLS_CC);
return;
}
@@ -1082,8 +1071,6 @@ PHP_FUNCTION(mb_parse_str)
mbfl_string string, resvar, resval;
mbfl_encoding_detector *identd;
mbfl_buffer_converter *convd;
- PLS_FETCH();
- MBSTRLS_FETCH();
track_vars_array = NULL;
argc = ZEND_NUM_ARGS();
@@ -1239,7 +1226,7 @@ PHP_FUNCTION(mb_parse_str)
}
n++;
/* add variable to symbol table */
- php_register_variable_safe(var, val, val_len, track_vars_array TSRMLS_CC PLS_CC);
+ php_register_variable_safe(var, val, val_len, track_vars_array TSRMLS_CC);
mbfl_string_clear(&resvar);
mbfl_string_clear(&resval);
}
@@ -1268,8 +1255,6 @@ PHP_FUNCTION(mb_output_handler)
mbfl_string string, result, *ret;
const char *mimetype, *charset;
mbfl_memory_device device;
- SLS_FETCH();
- MBSTRLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg_string, &arg_status) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1347,7 +1332,6 @@ PHP_FUNCTION(mb_strlen)
pval **arg1, **arg2;
int n;
mbfl_string string;
- MBSTRLS_FETCH();
n = ZEND_NUM_ARGS();
if ((n == 1 && zend_get_parameters_ex(1, &arg1) == FAILURE) ||
@@ -1389,7 +1373,6 @@ PHP_FUNCTION(mb_strpos)
pval **arg1, **arg2, **arg3, **arg4;
int offset, n;
mbfl_string haystack, needle;
- MBSTRLS_FETCH();
mbfl_string_init(&haystack);
mbfl_string_init(&needle);
@@ -1465,7 +1448,6 @@ PHP_FUNCTION(mb_strrpos)
pval **arg1, **arg2, **arg3;
int n;
mbfl_string haystack, needle;
- MBSTRLS_FETCH();
mbfl_string_init(&haystack);
mbfl_string_init(&needle);
@@ -1526,7 +1508,6 @@ PHP_FUNCTION(mb_substr)
pval **arg1, **arg2, **arg3, **arg4;
int argc, from, len, mblen;
mbfl_string string, result, *ret;
- MBSTRLS_FETCH();
mbfl_string_init(&string);
string.no_language = MBSTRG(current_language);
@@ -1616,7 +1597,6 @@ PHP_FUNCTION(mb_strcut)
pval **arg1, **arg2, **arg3, **arg4;
int argc, from, len;
mbfl_string string, result, *ret;
- MBSTRLS_FETCH();
mbfl_string_init(&string);
string.no_language = MBSTRG(current_language);
@@ -1700,7 +1680,6 @@ PHP_FUNCTION(mb_strwidth)
pval **arg1, **arg2;
int n;
mbfl_string string;
- MBSTRLS_FETCH();
n = ZEND_NUM_ARGS();
if ((n == 1 && zend_get_parameters_ex(1, &arg1) == FAILURE) ||
@@ -1742,7 +1721,6 @@ PHP_FUNCTION(mb_strimwidth)
pval **arg1, **arg2, **arg3, **arg4, **arg5;
int from, width;
mbfl_string string, result, marker, *ret;
- MBSTRLS_FETCH();
mbfl_string_init(&string);
mbfl_string_init(&marker);
@@ -1814,7 +1792,6 @@ PHP_FUNCTION(mb_convert_encoding)
enum mbfl_no_encoding from_encoding, to_encoding;
mbfl_buffer_converter *convd;
int size, *list;
- MBSTRLS_FETCH();
if (ZEND_NUM_ARGS() == 2) {
if (zend_get_parameters_ex(2, &arg_str, &arg_new) == FAILURE) {
@@ -1912,7 +1889,6 @@ PHP_FUNCTION(mb_detect_encoding)
const char *ret;
enum mbfl_no_encoding *elist;
int size, *list;
- MBSTRLS_FETCH();
if (ZEND_NUM_ARGS() == 1) {
if (zend_get_parameters_ex(1, &arg_str) == FAILURE) {
@@ -1978,7 +1954,6 @@ PHP_FUNCTION(mb_encode_mimeheader)
enum mbfl_no_encoding charset, transenc;
mbfl_string string, result, *ret;
char *p, *linefeed;
- MBSTRLS_FETCH();
if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 4 || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), argv) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2048,7 +2023,6 @@ PHP_FUNCTION(mb_decode_mimeheader)
{
pval **arg_str;
mbfl_string string, result, *ret;
- MBSTRLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_str) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2080,7 +2054,6 @@ PHP_FUNCTION(mb_convert_kana)
char *p;
mbfl_string string, result, *ret;
enum mbfl_no_encoding no_encoding;
- MBSTRLS_FETCH();
mbfl_string_init(&string);
string.no_language = MBSTRG(current_language);
@@ -2201,7 +2174,6 @@ PHP_FUNCTION(mb_convert_variables)
int n, argc, stack_level, stack_max, *elist, elistsz;
char *name;
void *ptmp;
- MBSTRLS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc < 3) {
@@ -2434,7 +2406,6 @@ php_mbstr_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
int argc, i, *convmap, *mapelm, mapsize;
mbfl_string string, result, *ret;
enum mbfl_no_encoding no_encoding;
- MBSTRLS_FETCH();
argc = ZEND_NUM_ARGS();
if ((argc == 2 && zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) ||
@@ -2536,7 +2507,6 @@ PHP_FUNCTION(mb_send_mail)
body_enc; /* body transfar encoding */
mbfl_memory_device device; /* automatic allocateable buffer for additional header */
int err = 0;
- MBSTRLS_FETCH();
/* initialize */
mbfl_memory_device_init(&device, 0, 0);
diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h
index 8445540e07..1c72b2d255 100644
--- a/ext/mbstring/mbstring.h
+++ b/ext/mbstring/mbstring.h
@@ -118,19 +118,9 @@ ZEND_END_MODULE_GLOBALS(mbstring);
#ifdef ZTS
-#define MBSTRLS_D zend_mbstring_globals *mbstring_globals
-#define MBSTRLS_DC , MBSTRLS_D
-#define MBSTRLS_C mbstring_globals
-#define MBSTRLS_CC , MBSTRLS_C
-#define MBSTRG(v) (mbstring_globals->v)
-#define MBSTRLS_FETCH() zend_mbstring_globals *mbstring_globals = ts_resource(mbstring_globals_id)
+#define MBSTRG(v) TSRMG(mbstring_globals_id, zend_mbstring_globals *, v)
#else
-#define MBSTRLS_D
-#define MBSTRLS_DC
-#define MBSTRLS_C
-#define MBSTRLS_CC
#define MBSTRG(v) (mbstring_globals.v)
-#define MBSTRLS_FETCH()
#endif
#else /* HAVE_MBSTRING */
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index a31a62b8a7..ca27d23639 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -352,7 +352,6 @@ PHP_MINFO_FUNCTION(mcrypt)
int i, count;
smart_str tmp1 = {0};
smart_str tmp2 = {0};
- MCLS_FETCH();
modules = mcrypt_list_algorithms (MCG(algorithms_dir), &count);
if (count == 0) {
@@ -409,7 +408,6 @@ PHP_FUNCTION(mcrypt_module_open)
zval **cipher, **cipher_directory, **mode, **mode_directory;
MCRYPT td;
int argc;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
MCRYPT_CHECK_PARAM_COUNT (4,4)
@@ -446,7 +444,6 @@ PHP_FUNCTION(mcrypt_generic_init)
int max_key_size, key_size, iv_size;
MCRYPT td;
int argc;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
MCRYPT_CHECK_PARAM_COUNT (3,3)
@@ -498,7 +495,6 @@ PHP_FUNCTION(mcrypt_generic)
int argc;
unsigned char* data_s;
int block_size, data_size;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
MCRYPT_CHECK_PARAM_COUNT (2,2)
@@ -539,7 +535,6 @@ PHP_FUNCTION(mdecrypt_generic)
int argc;
char* data_s;
int block_size, data_size;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
MCRYPT_CHECK_PARAM_COUNT (2,2)
@@ -579,7 +574,6 @@ PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes)
MCRYPT td;
int argc, i, count;
int *key_sizes;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
MCRYPT_GET_TD_ARG
@@ -606,7 +600,6 @@ PHP_FUNCTION(mcrypt_enc_self_test)
{
zval **mcryptind;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_TD_ARG
@@ -619,7 +612,6 @@ PHP_FUNCTION(mcrypt_module_close)
{
zval **mcryptind;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_TD_ARG
@@ -639,7 +631,6 @@ PHP_FUNCTION(mcrypt_generic_end)
{
zval **mcryptind;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_TD_ARG
@@ -658,7 +649,6 @@ PHP_FUNCTION(mcrypt_enc_is_block_algorithm_mode)
{
zval **mcryptind;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_TD_ARG
@@ -676,7 +666,6 @@ PHP_FUNCTION(mcrypt_enc_is_block_algorithm)
{
zval **mcryptind;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_TD_ARG
@@ -694,7 +683,6 @@ PHP_FUNCTION(mcrypt_enc_is_block_mode)
{
zval **mcryptind;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_TD_ARG
@@ -712,7 +700,6 @@ PHP_FUNCTION(mcrypt_enc_get_block_size)
{
zval **mcryptind;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_TD_ARG
@@ -727,7 +714,6 @@ PHP_FUNCTION(mcrypt_enc_get_key_size)
{
zval **mcryptind;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_TD_ARG
@@ -742,7 +728,6 @@ PHP_FUNCTION(mcrypt_enc_get_iv_size)
{
zval **mcryptind;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_TD_ARG
@@ -758,7 +743,6 @@ PHP_FUNCTION(mcrypt_enc_get_algorithms_name)
zval **mcryptind;
MCRYPT td;
char *name;
- MCLS_FETCH();
MCRYPT_GET_TD_ARG
@@ -776,7 +760,6 @@ PHP_FUNCTION(mcrypt_enc_get_modes_name)
zval **mcryptind;
MCRYPT td;
char *name;
- MCLS_FETCH();
MCRYPT_GET_TD_ARG
@@ -794,7 +777,6 @@ PHP_FUNCTION(mcrypt_module_self_test)
zval **arg1, **lib_dir;
char *lib_dir_s;
int argc;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
@@ -817,7 +799,6 @@ PHP_FUNCTION(mcrypt_module_is_block_algorithm_mode)
zval **arg1, **lib_dir;
char *lib_dir_s;
int argc;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
@@ -840,7 +821,6 @@ PHP_FUNCTION(mcrypt_module_is_block_algorithm)
zval **arg1, **lib_dir;
char *lib_dir_s;
int argc;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
@@ -863,7 +843,6 @@ PHP_FUNCTION(mcrypt_module_is_block_mode)
zval **arg1, **lib_dir;
char *lib_dir_s;
int argc;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
@@ -886,7 +865,6 @@ PHP_FUNCTION(mcrypt_module_get_algo_block_size)
zval **arg1, **lib_dir;
char *lib_dir_s;
int argc;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
@@ -904,7 +882,6 @@ PHP_FUNCTION(mcrypt_module_get_algo_key_size)
zval **arg1, **lib_dir;
char *lib_dir_s;
int argc;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
@@ -923,7 +900,6 @@ PHP_FUNCTION(mcrypt_module_get_supported_key_sizes)
char *lib_dir_s;
int argc, i, count;
int *key_sizes;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
@@ -997,7 +973,6 @@ PHP_FUNCTION(mcrypt_list_modes)
char **modules;
char *lib_dir_s;
int i, count, argc;
- MCLS_FETCH();
argc = ZEND_NUM_ARGS();
MCRYPT_CHECK_PARAM_COUNT (0,1)
@@ -1044,7 +1019,6 @@ PHP_FUNCTION(mcrypt_get_key_size)
char *module_dir_string;
long key_size;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_INI
@@ -1085,7 +1059,6 @@ PHP_FUNCTION(mcrypt_get_block_size)
char *module_dir_string;
long key_size;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_INI
@@ -1126,7 +1099,6 @@ PHP_FUNCTION(mcrypt_get_iv_size)
char *module_dir_string;
long key_size;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_INI
@@ -1166,7 +1138,6 @@ PHP_FUNCTION(mcrypt_get_cipher_name)
char *module_dir_string;
char *cipher_name;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_INI
@@ -1223,7 +1194,6 @@ static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mo
char *key_s = NULL, *iv_s;
char *data_s;
MCRYPT td;
- MCLS_FETCH();
MCRYPT_GET_INI
diff --git a/ext/mcrypt/php_mcrypt.h b/ext/mcrypt/php_mcrypt.h
index 3858abdf2a..02e147c0eb 100644
--- a/ext/mcrypt/php_mcrypt.h
+++ b/ext/mcrypt/php_mcrypt.h
@@ -67,19 +67,9 @@ ZEND_BEGIN_MODULE_GLOBALS(mcrypt)
ZEND_END_MODULE_GLOBALS(mcrypt)
#ifdef ZTS
-# define MCLS_D zend_mcrypt_globals *mcrypt_globals
-# define MCLS_DC , MCLS_D
-# define MCLS_C mcrypt_globals
-# define MCLS_CC , MCLS_C
-# define MCG(v) (mcrypt_globals->v)
-# define MCLS_FETCH() zend_mcrypt_globals *mcrypt_globals = ts_resource(mcrypt_globals_id)
+# define MCG(v) TSRMG(mcrypt_globals_id, zend_mcrypt_globals *, v)
#else
-# define MCLS_D
-# define MCLS_DC
-# define MCLS_C
-# define MCLS_CC
# define MCG(v) (mcrypt_globals.v)
-# define MCLS_FETCH()
#endif
#endif
diff --git a/ext/msql/php_msql.c b/ext/msql/php_msql.c
index c20385e38b..bca3243b0f 100644
--- a/ext/msql/php_msql.c
+++ b/ext/msql/php_msql.c
@@ -762,7 +762,6 @@ PHP_FUNCTION(msql_result)
m_query *msql_query;
m_row sql_row;
int field_offset=0;
- PLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 2:
@@ -901,7 +900,6 @@ static void php_msql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
m_query *msql_query;
int num_fields;
int i;
- PLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c
index 793d3258ca..4a304d606f 100644
--- a/ext/mssql/php_mssql.c
+++ b/ext/mssql/php_mssql.c
@@ -136,7 +136,8 @@ PHP_INI_END()
/* error handler */
static int php_mssql_error_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
{
- MSSQLLS_FETCH();
+ TSRMLS_FETCH();
+
if (severity >= MS_SQL_G(min_error_severity)) {
php_error(E_WARNING,"MS SQL error: %s (severity %d)", dberrstr, severity);
}
@@ -146,7 +147,8 @@ static int php_mssql_error_handler(DBPROCESS *dbproc, int severity, int dberr, i
/* message handler */
static int php_mssql_message_handler(DBPROCESS *dbproc, DBINT msgno,int msgstate, int severity,char *msgtext,char *srvname, char *procname,DBUSMALLINT line)
{
- MSSQLLS_FETCH();
+ TSRMLS_FETCH();
+
if (severity >= MS_SQL_G(min_message_severity)) {
php_error(E_WARNING,"MS SQL message: %s (severity %d)", msgtext, severity);
}
@@ -157,7 +159,8 @@ static int php_mssql_message_handler(DBPROCESS *dbproc, DBINT msgno,int msgstate
static int _clean_invalid_results(list_entry *le)
{
- MSSQLLS_FETCH();
+ TSRMLS_FETCH();
+
if (le->type == le_result) {
mssql_link *mssql_ptr = ((mssql_result *) le->ptr)->mssql_ptr;
@@ -214,7 +217,7 @@ static void _free_mssql_result(zend_rsrc_list_entry *rsrc)
static void php_mssql_set_default_link(int id)
{
- MSSQLLS_FETCH();
+ TSRMLS_FETCH();
if (MS_SQL_G(default_link)!=-1) {
zend_list_delete(MS_SQL_G(default_link));
@@ -226,7 +229,6 @@ static void php_mssql_set_default_link(int id)
static void _close_mssql_link(zend_rsrc_list_entry *rsrc)
{
mssql_link *mssql_ptr = (mssql_link *)rsrc->ptr;
- MSSQLLS_FETCH();
TSRMLS_FETCH();
mssql_ptr->valid = 0;
@@ -241,7 +243,7 @@ static void _close_mssql_link(zend_rsrc_list_entry *rsrc)
static void _close_mssql_plink(zend_rsrc_list_entry *rsrc)
{
mssql_link *mssql_ptr = (mssql_link *)rsrc->ptr;
- MSSQLLS_FETCH();
+ TSRMLS_FETCH();
dbclose(mssql_ptr->link);
dbfreelogin(mssql_ptr->login);
@@ -330,8 +332,6 @@ PHP_MSHUTDOWN_FUNCTION(mssql)
PHP_RINIT_FUNCTION(mssql)
{
- MSSQLLS_FETCH();
-
MS_SQL_G(default_link) = -1;
MS_SQL_G(num_links) = MS_SQL_G(num_persistent);
MS_SQL_G(appname) = estrndup("PHP 4.0",7);
@@ -348,7 +348,7 @@ PHP_RINIT_FUNCTION(mssql)
PHP_RSHUTDOWN_FUNCTION(mssql)
{
- MSSQLLS_FETCH();
+ TSRMLS_FETCH();
STR_FREE(MS_SQL_G(appname));
if (MS_SQL_G(server_message)) {
@@ -360,7 +360,7 @@ PHP_RSHUTDOWN_FUNCTION(mssql)
PHP_MINFO_FUNCTION(mssql)
{
char buf[32];
- MSSQLLS_FETCH();
+ TSRMLS_FETCH();
php_info_print_table_start();
php_info_print_table_header(2, "MSSQL Support", "enabled");
@@ -384,8 +384,6 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
int hashed_details_length;
mssql_link mssql, *mssql_ptr;
char buffer[32];
- MSSQLLS_FETCH();
-/* PLS_FETCH(); */
switch(ZEND_NUM_ARGS()) {
case 0: /* defaults */
@@ -653,7 +651,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
-static int php_mssql_get_default_link(INTERNAL_FUNCTION_PARAMETERS MSSQLLS_DC)
+static int php_mssql_get_default_link(INTERNAL_FUNCTION_PARAMETERS TSRMLS_DC)
{
if (MS_SQL_G(default_link)==-1) { /* no link opened yet, implicitly open one */
ht = 0;
@@ -687,12 +685,10 @@ PHP_FUNCTION(mssql_close)
zval **mssql_link_index=NULL;
int id;
mssql_link *mssql_ptr;
- MSSQLLS_FETCH();
-
switch (ZEND_NUM_ARGS()) {
case 0:
- id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MSSQLLS_CC);
+ id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 1:
@@ -724,15 +720,13 @@ PHP_FUNCTION(mssql_select_db)
zval **db, **mssql_link_index;
int id;
mssql_link *mssql_ptr;
- MSSQLLS_FETCH();
-
switch(ZEND_NUM_ARGS()) {
case 1:
if (zend_get_parameters_ex(1, &db)==FAILURE) {
RETURN_FALSE;
}
- id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MSSQLLS_CC);
+ id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 2:
@@ -880,7 +874,7 @@ int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int retvalue
int i, j = 0;
int *column_types;
char computed_buf[16];
- MSSQLLS_FETCH();
+ TSRMLS_FETCH();
column_types = (int *) emalloc(sizeof(int) * result->num_fields);
for (i=0; i<result->num_fields; i++) {
@@ -955,12 +949,11 @@ int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int retvalue
/* {{{ proto int mssql_fetch_batch(string result_index)
Returns the next batch of records */
-PHP_FUNCTION(mssql_fetch_batch) {
+PHP_FUNCTION(mssql_fetch_batch)
+{
zval **mssql_result_index;
mssql_result *result;
mssql_link *mssql_ptr;
- MSSQLLS_FETCH();
-
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -989,7 +982,6 @@ PHP_FUNCTION(mssql_query)
mssql_result *result;
int id, num_fields;
int batchsize;
- MSSQLLS_FETCH();
batchsize = MS_SQL_G(batchsize);
switch(ZEND_NUM_ARGS()) {
@@ -997,7 +989,7 @@ PHP_FUNCTION(mssql_query)
if (zend_get_parameters_ex(1, &query)==FAILURE) {
RETURN_FALSE;
}
- id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MSSQLLS_CC);
+ id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
case 2:
@@ -1066,10 +1058,10 @@ PHP_FUNCTION(mssql_query)
/* {{{ proto int mssql_rows_affected(int conn_id)
Returns the number of records affected by the query */
-PHP_FUNCTION(mssql_rows_affected) {
+PHP_FUNCTION(mssql_rows_affected)
+{
zval **mssql_link_index;
mssql_link *mssql_ptr;
- MSSQLLS_FETCH();
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_link_index)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1087,8 +1079,6 @@ PHP_FUNCTION(mssql_free_result)
{
zval **mssql_result_index;
mssql_result *result;
- MSSQLLS_FETCH();
-
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1109,8 +1099,6 @@ PHP_FUNCTION(mssql_free_result)
Gets the last message from the MS-SQL server */
PHP_FUNCTION(mssql_get_last_message)
{
- MSSQLLS_FETCH();
-
RETURN_STRING(MS_SQL_G(server_message),1);
}
@@ -1122,8 +1110,6 @@ PHP_FUNCTION(mssql_num_rows)
{
zval **mssql_result_index;
mssql_result *result;
- MSSQLLS_FETCH();
-
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1143,8 +1129,6 @@ PHP_FUNCTION(mssql_num_fields)
{
zval **mssql_result_index;
mssql_result *result;
- MSSQLLS_FETCH();
-
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1163,8 +1147,6 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
zval **mssql_result_index, **resulttype = NULL;
mssql_result *result;
int i;
- MSSQLLS_FETCH();
- PLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -1289,8 +1271,6 @@ PHP_FUNCTION(mssql_data_seek)
{
zval **mssql_result_index, **offset;
mssql_result *result;
- MSSQLLS_FETCH();
-
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1367,8 +1347,6 @@ PHP_FUNCTION(mssql_fetch_field)
zval **mssql_result_index, **offset;
int field_offset;
mssql_result *result;
- MSSQLLS_FETCH();
-
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -1422,8 +1400,6 @@ PHP_FUNCTION(mssql_field_length)
zval **mssql_result_index, **offset;
int field_offset;
mssql_result *result;
- MSSQLLS_FETCH();
-
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -1471,8 +1447,6 @@ PHP_FUNCTION(mssql_field_name)
zval **mssql_result_index, **offset;
int field_offset;
mssql_result *result;
- MSSQLLS_FETCH();
-
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -1521,8 +1495,6 @@ PHP_FUNCTION(mssql_field_type)
zval **mssql_result_index, **offset;
int field_offset;
mssql_result *result;
- MSSQLLS_FETCH();
-
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -1571,8 +1543,6 @@ PHP_FUNCTION(mssql_field_seek)
zval **mssql_result_index, **offset;
int field_offset;
mssql_result *result;
- MSSQLLS_FETCH();
-
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1601,8 +1571,6 @@ PHP_FUNCTION(mssql_result)
zval **row, **field, **mssql_result_index;
int field_offset=0;
mssql_result *result;
- MSSQLLS_FETCH();
-
if (ZEND_NUM_ARGS()!=3 || zend_get_parameters_ex(3, &mssql_result_index, &row, &field)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1655,8 +1623,6 @@ PHP_FUNCTION(mssql_next_result)
int retvalue;
mssql_result *result;
mssql_link *mssql_ptr;
- MSSQLLS_FETCH();
-
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1690,8 +1656,6 @@ PHP_FUNCTION(mssql_next_result)
PHP_FUNCTION(mssql_min_error_severity)
{
zval **severity;
- MSSQLLS_FETCH();
-
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &severity)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1707,8 +1671,6 @@ PHP_FUNCTION(mssql_min_error_severity)
PHP_FUNCTION(mssql_min_message_severity)
{
zval **severity;
- MSSQLLS_FETCH();
-
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &severity)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1726,14 +1688,13 @@ PHP_FUNCTION(mssql_init)
mssql_link *mssql_ptr;
mssql_statement *statement;
int id;
- MSSQLLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
if (zend_get_parameters_ex(1, &sp_name)==FAILURE) {
RETURN_FALSE;
}
- id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MSSQLLS_CC);
+ id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU TSRMLS_CC);
CHECK_LINK(id);
break;
@@ -1787,9 +1748,7 @@ PHP_FUNCTION(mssql_bind)
mssql_statement *statement;
mssql_bind bind,*bindp;
int id, status;
-
LPBYTE value;
- MSSQLLS_FETCH();
id=0;
status=0;
@@ -1955,7 +1914,6 @@ PHP_FUNCTION(mssql_execute)
int batchsize;
int ac = ZEND_NUM_ARGS();
char *parameter;
- MSSQLLS_FETCH();
batchsize = MS_SQL_G(batchsize);
if (ac !=1 || zend_get_parameters_ex(1, &stmt)==FAILURE) {
@@ -2088,7 +2046,6 @@ PHP_FUNCTION(mssql_guid_string)
int sf = 0;
char buffer[32+1];
char buffer2[36+1];
- MSSQLLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
diff --git a/ext/mssql/php_mssql.h b/ext/mssql/php_mssql.h
index f3b0dc2563..85572c4099 100644
--- a/ext/mssql/php_mssql.h
+++ b/ext/mssql/php_mssql.h
@@ -141,19 +141,9 @@ typedef struct mssql_result {
#ifdef ZTS
-# define MSSQLLS_D zend_mssql_globals *mssql_globals
-# define MSSQLLS_DC , MSSQLLS_D
-# define MSSQLLS_C mssql_globals
-# define MSSQLLS_CC , MSSQLLS_C
-# define MS_SQL_G(v) (mssql_globals->v)
-# define MSSQLLS_FETCH() zend_mssql_globals *mssql_globals = ts_resource(mssql_globals_id)
+# define MS_SQL_G(v) TSRMG(mssql_globals_id, zend_mssql_globals *, v)
#else
-# define MSSQLLS_D
-# define MSSQLLS_DC
-# define MSSQLLS_C
-# define MSSQLLS_CC
# define MS_SQL_G(v) (mssql_globals.v)
-# define MSSQLLS_FETCH()
#endif
#else
diff --git a/ext/muscat/muscat.c b/ext/muscat/muscat.c
index 89dbf82daf..f7af8bff7a 100644
--- a/ext/muscat/muscat.c
+++ b/ext/muscat/muscat.c
@@ -271,7 +271,6 @@ PHP_FUNCTION(muscat_give)
char *string = NULL;
_muscat_handle *handle;
int r;
- MUSCATLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &Muscat_handle_arg, &string_arg) == FAILURE){
WRONG_PARAM_COUNT;
@@ -296,7 +295,6 @@ PHP_FUNCTION(muscat_get)
zval **Muscat_handle_arg;
_muscat_handle *handle;
int r;
- MUSCATLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &Muscat_handle_arg) == FAILURE){
WRONG_PARAM_COUNT;
@@ -325,7 +323,6 @@ PHP_FUNCTION(muscat_close)
{
zval **muscat_handle_arg;
_muscat_handle *handle;
- MUSCATLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &muscat_handle_arg) == FAILURE){
WRONG_PARAM_COUNT;
diff --git a/ext/muscat/php_muscat.h b/ext/muscat/php_muscat.h
index 4bffeeb27c..7981a6813c 100644
--- a/ext/muscat/php_muscat.h
+++ b/ext/muscat/php_muscat.h
@@ -75,11 +75,9 @@ ZEND_END_MODULE_GLOBALS(muscat)
*/
#ifdef ZTS
-#define MUSCATG(v) (muscat_globals->v)
-#define MUSCATLS_FETCH() php_muscat_globals *muscat_globals = ts_resource(muscat_globals_id)
+#define MUSCATG(v) TSRMG(muscat_globals_id, php_muscat_globals *, v)
#else
#define MUSCATG(v) (muscat_globals.v)
-#define MUSCATLS_FETCH()
#endif
#else
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index 25d4174b72..dc46c888cc 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -213,7 +213,7 @@ static void _free_mysql_result(zend_rsrc_list_entry *rsrc)
*/
static void php_mysql_set_default_link(int id)
{
- MySLS_FETCH();
+ TSRMLS_FETCH();
if (MySG(default_link)!=-1) {
zend_list_delete(MySG(default_link));
@@ -229,7 +229,7 @@ static void _close_mysql_link(zend_rsrc_list_entry *rsrc)
{
php_mysql_conn *link = (php_mysql_conn *)rsrc->ptr;
void (*handler) (int);
- MySLS_FETCH();
+ TSRMLS_FETCH();
handler = signal(SIGPIPE, SIG_IGN);
mysql_close(&link->conn);
@@ -245,7 +245,7 @@ static void _close_mysql_plink(zend_rsrc_list_entry *rsrc)
{
php_mysql_conn *link = (php_mysql_conn *)rsrc->ptr;
void (*handler) (int);
- MySLS_FETCH();
+ TSRMLS_FETCH();
handler = signal(SIGPIPE, SIG_IGN);
mysql_close(&link->conn);
@@ -261,7 +261,7 @@ static void _close_mysql_plink(zend_rsrc_list_entry *rsrc)
*/
static PHP_INI_MH(OnMySQLPort)
{
- MySLS_FETCH();
+ TSRMLS_FETCH();
if (new_value==NULL) { /* default port */
#ifndef PHP_WIN32
@@ -347,8 +347,6 @@ PHP_MSHUTDOWN_FUNCTION(mysql)
*/
PHP_RINIT_FUNCTION(mysql)
{
- MySLS_FETCH();
-
MySG(default_link)=-1;
MySG(num_links) = MySG(num_persistent);
/* Reset connect error/errno on every request */
@@ -362,7 +360,7 @@ PHP_RINIT_FUNCTION(mysql)
*/
PHP_RSHUTDOWN_FUNCTION(mysql)
{
- MySLS_FETCH();
+ TSRMLS_FETCH();
if (MySG(connect_error)!=NULL) {
efree(MySG(connect_error));
}
@@ -375,7 +373,7 @@ PHP_RSHUTDOWN_FUNCTION(mysql)
PHP_MINFO_FUNCTION(mysql)
{
char buf[32];
- MySLS_FETCH();
+ TSRMLS_FETCH();
php_info_print_table_start();
php_info_print_table_header(2, "MySQL Support", "enabled");
@@ -417,8 +415,6 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
void (*handler) (int);
zval **z_host=NULL, **z_user=NULL, **z_passwd=NULL;
zend_bool free_host=0;
- MySLS_FETCH();
- PLS_FETCH();
socket = MySG(default_socket);
@@ -667,7 +663,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* {{{ php_mysql_get_default_link
*/
-static int php_mysql_get_default_link(INTERNAL_FUNCTION_PARAMETERS MySLS_DC)
+static int php_mysql_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
{
if (MySG(default_link)==-1) { /* no link opened yet, implicitly open one */
ht = 0;
@@ -700,7 +696,6 @@ PHP_FUNCTION(mysql_close)
zval **mysql_link=NULL;
int id;
php_mysql_conn *mysql;
- MySLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
@@ -740,14 +735,13 @@ PHP_FUNCTION(mysql_select_db)
zval **db, **mysql_link;
int id;
php_mysql_conn *mysql;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
if (zend_get_parameters_ex(1, &db)==FAILURE) {
RETURN_FALSE;
}
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
+ id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
CHECK_LINK(id);
break;
case 2:
@@ -795,11 +789,10 @@ PHP_FUNCTION(mysql_get_host_info)
zval **mysql_link;
int id;
php_mysql_conn *mysql;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
+ id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
CHECK_LINK(id);
break;
case 1:
@@ -826,11 +819,10 @@ PHP_FUNCTION(mysql_get_proto_info)
zval **mysql_link;
int id;
php_mysql_conn *mysql;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
+ id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
CHECK_LINK(id);
break;
case 1:
@@ -857,11 +849,10 @@ PHP_FUNCTION(mysql_get_server_info)
zval **mysql_link;
int id;
php_mysql_conn *mysql;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
+ id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
CHECK_LINK(id);
break;
case 1:
@@ -890,14 +881,13 @@ PHP_FUNCTION(mysql_create_db)
zval **db, **mysql_link;
int id;
php_mysql_conn *mysql;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
if (zend_get_parameters_ex(1, &db)==FAILURE) {
RETURN_FALSE;
}
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
+ id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
CHECK_LINK(id);
break;
case 2:
@@ -929,14 +919,13 @@ PHP_FUNCTION(mysql_drop_db)
zval **db, **mysql_link;
int id;
php_mysql_conn *mysql;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
if (zend_get_parameters_ex(1, &db)==FAILURE) {
RETURN_FALSE;
}
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
+ id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
CHECK_LINK(id);
break;
case 2:
@@ -968,7 +957,7 @@ static void php_mysql_do_query_general(zval **query, zval **mysql_link, int link
{
php_mysql_conn *mysql;
MYSQL_RES *mysql_result;
- MySLS_FETCH();
+ TSRMLS_FETCH();
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, link_id, "MySQL-Link", le_link, le_plink);
@@ -1031,14 +1020,13 @@ static void php_mysql_do_query(INTERNAL_FUNCTION_PARAMETERS, int use_store)
{
zval **query, **mysql_link;
int id;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
if (zend_get_parameters_ex(1, &query)==FAILURE) {
RETURN_FALSE;
}
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
+ id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
CHECK_LINK(id);
break;
case 2:
@@ -1079,14 +1067,13 @@ PHP_FUNCTION(mysql_db_query)
{
zval **db, **query, **mysql_link;
int id;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 2:
if (zend_get_parameters_ex(2, &db, &query)==FAILURE) {
RETURN_FALSE;
}
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
+ id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
CHECK_LINK(id);
break;
case 3:
@@ -1115,11 +1102,10 @@ PHP_FUNCTION(mysql_list_dbs)
int id;
php_mysql_conn *mysql;
MYSQL_RES *mysql_result;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
+ id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
CHECK_LINK(id);
break;
case 1:
@@ -1152,14 +1138,13 @@ PHP_FUNCTION(mysql_list_tables)
int id;
php_mysql_conn *mysql;
MYSQL_RES *mysql_result;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
if (zend_get_parameters_ex(1, &db)==FAILURE) {
RETURN_FALSE;
}
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
+ id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
CHECK_LINK(id);
break;
case 2:
@@ -1196,14 +1181,13 @@ PHP_FUNCTION(mysql_list_fields)
int id;
php_mysql_conn *mysql;
MYSQL_RES *mysql_result;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 2:
if (zend_get_parameters_ex(2, &db, &table)==FAILURE) {
RETURN_FALSE;
}
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
+ id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
CHECK_LINK(id);
break;
case 3:
@@ -1240,7 +1224,6 @@ PHP_FUNCTION(mysql_error)
zval **mysql_link;
int id;
php_mysql_conn *mysql;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
@@ -1279,7 +1262,6 @@ PHP_FUNCTION(mysql_errno)
zval **mysql_link;
int id;
php_mysql_conn *mysql;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
@@ -1318,7 +1300,6 @@ PHP_FUNCTION(mysql_affected_rows)
zval **mysql_link;
int id;
php_mysql_conn *mysql;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
@@ -1373,7 +1354,6 @@ PHP_FUNCTION(mysql_insert_id)
zval **mysql_link;
int id;
php_mysql_conn *mysql;
- MySLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
@@ -1409,7 +1389,6 @@ PHP_FUNCTION(mysql_result)
MYSQL_ROW sql_row;
mysql_row_length_type *sql_row_lengths;
int field_offset=0;
- PLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 2:
@@ -1552,7 +1531,6 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
mysql_row_length_type *mysql_row_lengths;
int num_fields;
int i;
- PLS_FETCH();
if (ZEND_NUM_ARGS() > expected_args) {
WRONG_PARAM_COUNT;
diff --git a/ext/mysql/php_mysql.h b/ext/mysql/php_mysql.h
index aa2213963b..a3c701077e 100644
--- a/ext/mysql/php_mysql.h
+++ b/ext/mysql/php_mysql.h
@@ -96,19 +96,9 @@ ZEND_BEGIN_MODULE_GLOBALS(mysql)
ZEND_END_MODULE_GLOBALS(mysql)
#ifdef ZTS
-# define MySLS_D zend_mysql_globals *mysql_globals
-# define MySLS_DC , MySLS_D
-# define MySLS_C mysql_globals
-# define MySLS_CC , MySLS_C
-# define MySG(v) (mysql_globals->v)
-# define MySLS_FETCH() zend_mysql_globals *mysql_globals = ts_resource(mysql_globals_id)
+# define MySG(v) TSRMG(mysql_globals_id, zend_mysql_globals *, v)
#else
-# define MySLS_D
-# define MySLS_DC
-# define MySLS_C
-# define MySLS_CC
# define MySG(v) (mysql_globals.v)
-# define MySLS_FETCH()
#endif
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 0be9dcae92..57f6da7ac7 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -395,7 +395,7 @@ CONST void ocifree(dvoid *ctx, dvoid *ptr)
/* }}} */
/* {{{ startup, shutdown and info functions */
-static void php_oci_init_globals(OCILS_D TSRMLS_DC)
+static void php_oci_init_globals(php_oci_globals *oci_globals_p TSRMLS_DC)
{
OCI(shutdown) = 0;
@@ -435,7 +435,7 @@ PHP_MINIT_FUNCTION(oci)
#ifdef ZTS
ts_allocate_id(&oci_globals_id, sizeof(php_oci_globals), (ts_allocate_ctor) php_oci_init_globals, NULL);
#else
- php_oci_init_globals(OCILS_C TSRMLS_CC);
+ php_oci_init_globals(&oci_globals TSRMLS_CC);
#endif
le_stmt = zend_register_list_destructors_ex(_oci_stmt_list_dtor, NULL, "oci8 statement", module_number);
@@ -507,8 +507,6 @@ PHP_MINIT_FUNCTION(oci)
PHP_RINIT_FUNCTION(oci)
{
- OCILS_FETCH();
-
/* XXX NYI
OCI(num_links) =
OCI(num_persistent);
@@ -537,7 +535,7 @@ static int _server_pcleanup(oci_server *server)
PHP_MSHUTDOWN_FUNCTION(oci)
{
- OCILS_FETCH();
+ TSRMLS_FETCH();
OCI(shutdown) = 1;
@@ -921,7 +919,7 @@ oci_error(OCIError *err_p, char *what, sword status)
static int oci_ping(oci_server *server)
{
char version[256];
- OCILS_FETCH();
+ TSRMLS_FETCH();
OCI(error) =
OCIServerVersion(server->pServer,
@@ -946,7 +944,7 @@ static int oci_ping(oci_server *server)
static void oci_debug(const char *format, ...)
{
- OCILS_FETCH();
+ TSRMLS_FETCH();
if (OCI(debug_mode)) {
char buffer[1024];
@@ -1055,7 +1053,7 @@ static oci_descriptor*
oci_new_desc(int type,oci_connection *connection)
{
oci_descriptor *descr;
- OCILS_FETCH();
+ TSRMLS_FETCH();
descr = emalloc(sizeof(oci_descriptor));
@@ -1253,7 +1251,7 @@ oci_setprefetch(oci_statement *statement,int size)
static oci_statement *oci_parse(oci_connection *connection, char *query, int len)
{
oci_statement *statement;
- OCILS_FETCH();
+ TSRMLS_FETCH();
statement = ecalloc(1,sizeof(oci_statement));
@@ -1998,7 +1996,7 @@ static oci_session *_oci_open_session(oci_server* server,char *username,char *pa
oci_session *session = 0, *psession = 0;
OCISvcCtx *svchp = 0;
char *hashed_details;
- OCILS_FETCH();
+ TSRMLS_FETCH();
/*
check if we already have this user authenticated
@@ -2160,7 +2158,7 @@ _oci_close_session(oci_session *session)
{
OCISvcCtx *svchp;
char *hashed_details;
- OCILS_FETCH();
+ TSRMLS_FETCH();
if (! session) {
return;
@@ -2240,7 +2238,7 @@ _oci_close_session(oci_session *session)
static oci_server *_oci_open_server(char *dbname,int persistent)
{
oci_server *server, *pserver = 0;
- OCILS_FETCH();
+ TSRMLS_FETCH();
/*
check if we already have this server open
@@ -2359,7 +2357,7 @@ _oci_close_server(oci_server *server)
{
char *dbname;
int oldopen;
- OCILS_FETCH();
+ TSRMLS_FETCH();
TSRMLS_FETCH();
oldopen = server->is_open;
@@ -2412,7 +2410,6 @@ static void oci_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent,int exclu
oci_server *server = 0;
oci_session *session = 0;
oci_connection *connection = 0;
- OCILS_FETCH();
if (zend_get_parameters_ex(3, &userParam, &passParam, &dbParam) == SUCCESS) {
convert_to_string_ex(userParam);
@@ -3656,7 +3653,6 @@ PHP_FUNCTION(ocicolumnisnull)
PHP_FUNCTION(ociinternaldebug)
{
zval **arg;
- OCILS_FETCH();
if (zend_get_parameters_ex(1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -3991,8 +3987,6 @@ PHP_FUNCTION(ocierror)
sword error = 0;
dvoid *errh = NULL;
- OCILS_FETCH();
-
if (zend_get_parameters_ex(1, &arg) == SUCCESS) {
statement = (oci_statement *) zend_fetch_resource(arg, -1, NULL, NULL, 1, le_stmt);
if (statement) {
@@ -4308,7 +4302,6 @@ PHP_FUNCTION(ocifreecollection)
int inx;
oci_collection *coll;
oci_connection *connection;
- OCILS_FETCH();
if ((id = getThis()) != 0) {
inx = _oci_get_ocicoll(id,&coll);
@@ -4352,8 +4345,6 @@ PHP_FUNCTION(ocicollappend)
int inx;
double ndx;
- OCILS_FETCH();
-
if ((id = getThis()) != 0) {
if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
RETURN_FALSE;
@@ -4461,8 +4452,6 @@ PHP_FUNCTION(ocicollgetelem)
int len;
double dnum;
- OCILS_FETCH();
-
if ((id = getThis()) != 0) {
if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
RETURN_FALSE;
@@ -4540,8 +4529,6 @@ PHP_FUNCTION(ocicollassign)
oci_collection *coll,*from_coll;
int inx;
- OCILS_FETCH();
-
if ((id = getThis()) != 0) {
if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
RETURN_FALSE;
@@ -4586,8 +4573,6 @@ PHP_FUNCTION(ocicollassignelem)
OCIDate dt;
double dnum;
- OCILS_FETCH();
-
if ((id = getThis()) != 0) {
if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
RETURN_FALSE;
@@ -4699,8 +4684,6 @@ PHP_FUNCTION(ocicollsize)
sb4 sz;
int inx;
- OCILS_FETCH();
-
if ((id = getThis()) != 0) {
if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
RETURN_FALSE;
@@ -4727,7 +4710,6 @@ PHP_FUNCTION(ocicollmax)
oci_collection *coll;
sb4 sz;
int inx;
- OCILS_FETCH();
if ((id = getThis()) != 0) {
if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
@@ -4749,8 +4731,6 @@ PHP_FUNCTION(ocicolltrim)
oci_collection *coll;
int inx;
- OCILS_FETCH();
-
if ((id = getThis()) != 0) {
if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
RETURN_FALSE;
@@ -4783,10 +4763,6 @@ PHP_FUNCTION(ocinewcollection)
oci_collection *coll;
int ac = ZEND_NUM_ARGS();
- OCILS_FETCH();
-
-
-
if (ac < 2 || ac > 3 || zend_get_parameters_ex(ac, &conn, &tdo, &schema) == FAILURE) {
WRONG_PARAM_COUNT;
}
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index cf870173cc..135d78a2e8 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -193,19 +193,9 @@ extern zend_module_entry oci8_module_entry;
#define OCI_PIECE_SIZE (64*1024)-1
#ifdef ZTS
-#define OCILS_D php_oci_globals *oci_globals
-#define OCILS_DC , OCILS_D
-#define OCILS_C oci_globals
-#define OCILS_CC , OCILS_C
-#define OCI(v) (oci_globals->v)
-#define OCILS_FETCH() php_oci_globals *oci_globals = ts_resource(oci_globals_id)
+#define OCI(v) TSRMG(oci_globals_id, php_oci_globals *, v)
#else
-#define OCILS_D
-#define OCILS_DC
-#define OCILS_C
-#define OCILS_CC
#define OCI(v) (oci_globals.v)
-#define OCILS_FETCH()
#endif
#else /* !HAVE_OCI8 */
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index a763cb8776..a2aeb310ff 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -210,7 +210,7 @@ static void _close_odbc_conn(zend_rsrc_list_entry *rsrc)
{
odbc_connection *conn = (odbc_connection *)rsrc->ptr;
- ODBCLS_FETCH();
+ TSRMLS_FETCH();
safe_odbc_disconnect(conn->hdbc);
SQLFreeConnect(conn->hdbc);
@@ -223,7 +223,7 @@ static void _close_odbc_conn(zend_rsrc_list_entry *rsrc)
static void _close_odbc_pconn(zend_rsrc_list_entry *rsrc)
{
odbc_connection *conn = (odbc_connection *)rsrc->ptr;
- ODBCLS_FETCH();
+ TSRMLS_FETCH();
safe_odbc_disconnect(conn->hdbc);
SQLFreeConnect(conn->hdbc);
@@ -348,7 +348,7 @@ PHP_INI_BEGIN()
PHP_INI_END()
#ifdef ZTS
-static void php_odbc_init_globals(php_odbc_globals *odbc_globals TSRMLS_DC)
+static void php_odbc_init_globals(php_odbc_globals *odbc_globals_p TSRMLS_DC)
{
ODBCG(num_persistent) = 0;
}
@@ -356,7 +356,6 @@ static void php_odbc_init_globals(php_odbc_globals *odbc_globals TSRMLS_DC)
PHP_MINIT_FUNCTION(odbc)
{
- ODBCLS_D;
#ifdef SQLANY_BUG
ODBC_SQL_CONN_T foobar;
RETCODE rc;
@@ -364,7 +363,6 @@ PHP_MINIT_FUNCTION(odbc)
#ifdef ZTS
ts_allocate_id(&odbc_globals_id, sizeof(php_odbc_globals), php_odbc_init_globals, NULL);
- odbc_globals = ts_resource(odbc_globals_id);
#else
ODBCG(num_persistent) = 0;
#endif
@@ -455,8 +453,6 @@ PHP_MINIT_FUNCTION(odbc)
PHP_RINIT_FUNCTION(odbc)
{
- ODBCLS_FETCH();
-
ODBCG(defConn) = -1;
ODBCG(num_links) = ODBCG(num_persistent);
memset(ODBCG(laststate), '\0', 6);
@@ -471,7 +467,7 @@ PHP_RSHUTDOWN_FUNCTION(odbc)
PHP_MSHUTDOWN_FUNCTION(odbc)
{
- ODBCLS_FETCH();
+ TSRMLS_FETCH();
UNREGISTER_INI_ENTRIES();
return SUCCESS;
@@ -480,7 +476,7 @@ PHP_MSHUTDOWN_FUNCTION(odbc)
PHP_MINFO_FUNCTION(odbc)
{
char buf[32];
- ODBCLS_FETCH();
+ TSRMLS_FETCH();
php_info_print_table_start();
php_info_print_table_header(2, "ODBC Support", "enabled");
@@ -509,7 +505,7 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS)
RETCODE rc;
ODBC_SQL_ENV_T henv;
ODBC_SQL_CONN_T conn;
- ODBCLS_FETCH();
+ TSRMLS_FETCH();
if (conn_resource) {
henv = conn_resource->henv;
@@ -549,8 +545,6 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
odbc_result *result;
pval **pv_res, **pv_flag;
- ODBCLS_FETCH();
- PLS_FETCH();
if (zend_get_parameters_ex(2, &pv_res, &pv_flag) == FAILURE)
WRONG_PARAM_COUNT;
@@ -579,7 +573,7 @@ int odbc_bindcols(odbc_result *result)
int i;
SWORD colnamelen; /* Not used */
SDWORD displaysize;
- ODBCLS_FETCH();
+ TSRMLS_FETCH();
result->values = (odbc_result_value *)
emalloc(sizeof(odbc_result_value)*result->numcols);
@@ -638,7 +632,6 @@ void odbc_transact(INTERNAL_FUNCTION_PARAMETERS, int type)
odbc_connection *conn;
RETCODE rc;
pval **pv_conn;
- ODBCLS_FETCH();
if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -780,7 +773,6 @@ PHP_FUNCTION(odbc_prepare)
#ifdef HAVE_SQL_EXTENDED_FETCH
UDWORD scrollopts;
#endif
- ODBCLS_FETCH();
if (zend_get_parameters_ex(2, &pv_conn, &pv_query) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -885,7 +877,6 @@ PHP_FUNCTION(odbc_execute)
odbc_result *result;
int numArgs, i, ne;
RETCODE rc;
- ODBCLS_FETCH();
numArgs = ZEND_NUM_ARGS();
switch(numArgs) {
@@ -1054,7 +1045,6 @@ PHP_FUNCTION(odbc_cursor)
char *cursorname;
odbc_result *result;
RETCODE rc;
- ODBCLS_FETCH();
if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1080,7 +1070,6 @@ PHP_FUNCTION(odbc_cursor)
SDWORD error; /* Not used */
char errormsg[255];
SWORD errormsgsize; /* Not used */
- ODBCLS_FETCH();
SQLError( result->conn_ptr->henv, result->conn_ptr->hdbc,
result->stmt, state, &error, errormsg,
@@ -1924,7 +1913,7 @@ PHP_FUNCTION(odbc_pconnect)
}
/* }}} */
-int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int cur_opt, int persistent ODBCLS_DC)
+int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int cur_opt, int persistent TSRMLS_DC)
{
RETCODE rc;
@@ -2023,8 +2012,6 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
odbc_connection *db_conn;
char *hashed_details;
int hashed_len, len, cur_opt;
- ODBCLS_FETCH();
- PLS_FETCH();
/* Now an optional 4th parameter specifying the cursor type
* defaulting to the cursors default
@@ -2107,7 +2094,7 @@ try_and_get_another_connection:
RETURN_FALSE;
}
- if (!odbc_sqlconnect(&db_conn, db, uid, pwd, cur_opt, 1 ODBCLS_CC)) {
+ if (!odbc_sqlconnect(&db_conn, db, uid, pwd, cur_opt, 1 TSRMLS_CC)) {
efree(hashed_details);
RETURN_FALSE;
}
@@ -2181,7 +2168,7 @@ try_and_get_another_connection:
RETURN_FALSE;
}
- if (!odbc_sqlconnect(&db_conn, db, uid, pwd, cur_opt, 0 ODBCLS_CC)) {
+ if (!odbc_sqlconnect(&db_conn, db, uid, pwd, cur_opt, 0 TSRMLS_CC)) {
efree(hashed_details);
RETURN_FALSE;
}
@@ -2212,7 +2199,6 @@ PHP_FUNCTION(odbc_close)
int type;
int is_pconn = 0;
int found_resource_type = le_conn;
- ODBCLS_FETCH();
if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2542,8 +2528,6 @@ static void php_odbc_lasterror(INTERNAL_FUNCTION_PARAMETERS, int mode)
strlcpy(ptr, conn->lasterrormsg, len+1);
}
} else {
- ODBCLS_FETCH();
-
if (mode == 0) {
strlcpy(ptr, ODBCG(laststate), len+1);
} else {
diff --git a/ext/odbc/php_odbc.h b/ext/odbc/php_odbc.h
index 9aa48bcfec..23bbde9b7b 100644
--- a/ext/odbc/php_odbc.h
+++ b/ext/odbc/php_odbc.h
@@ -324,19 +324,9 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS);
#define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY)
#ifdef ZTS
-# define ODBCLS_D php_odbc_globals *odbc_globals
-# define ODBCLS_DC , ODBCLS_D
-# define ODBCLS_C odbc_globals
-# define ODBCLS_CC , ODBCLS_C
-# define ODBCG(v) (odbc_globals->v)
-# define ODBCLS_FETCH() php_odbc_globals *odbc_globals = ts_resource(odbc_globals_id)
+# define ODBCG(v) TSRMG(odbc_globals_id, php_odbc_globals *, v)
#else
-# define ODBCLS_D
-# define ODBCLS_DC
-# define ODBCLS_C
-# define ODBCLS_CC
# define ODBCG(v) (odbc_globals.v)
-# define ODBCLS_FETCH()
extern ZEND_API php_odbc_globals odbc_globals;
#endif
diff --git a/ext/oracle/oracle.c b/ext/oracle/oracle.c
index 37651537f3..e9e640c572 100644
--- a/ext/oracle/oracle.c
+++ b/ext/oracle/oracle.c
@@ -204,7 +204,7 @@ ZEND_GET_MODULE(oracle)
static int _close_oraconn(zend_rsrc_list_entry *rsrc)
{
oraConnection *conn = (oraConnection *)rsrc->ptr;
- ORALS_FETCH();
+ TSRMLS_FETCH();
conn->open = 0;
@@ -240,7 +240,7 @@ pval_ora_param_destructor(oraParam *param)
static int _close_oracur(oraCursor *cur)
{
int i;
- ORALS_FETCH();
+ TSRMLS_FETCH();
if (cur){
if (cur->query){
@@ -286,7 +286,7 @@ static void php_close_ora_cursor(zend_rsrc_list_entry *rsrc)
/* {{{ php_ora_init_globals
*/
-static void php_ora_init_globals(ORALS_D TSRMLS_DC)
+static void php_ora_init_globals(php_ora_globals *ora_globals_p TSRMLS_DC)
{
if (cfg_get_long("oracle.allow_persistent",
&ORA(allow_persistent))
@@ -321,7 +321,7 @@ PHP_MINIT_FUNCTION(oracle)
#ifdef ZTS
ts_allocate_id(&ora_globals_id, sizeof(php_ora_globals), (ts_allocate_ctor) php_ora_init_globals, NULL);
#else
- php_ora_init_globals(ORALS_C TSRMLS_CC);
+ php_ora_init_globals(&ora_globals TSRMLS_CC);
#endif
le_cursor = zend_register_list_destructors_ex(php_close_ora_cursor, NULL, "oracle cursor", module_number);
@@ -347,8 +347,6 @@ PHP_MINIT_FUNCTION(oracle)
*/
PHP_RINIT_FUNCTION(oracle)
{
- ORALS_FETCH();
-
ORA(num_links) =
ORA(num_persistent);
/*
@@ -364,7 +362,7 @@ PHP_RINIT_FUNCTION(oracle)
*/
PHP_MSHUTDOWN_FUNCTION(oracle)
{
- ORALS_FETCH();
+ TSRMLS_FETCH();
zend_hash_destroy(ORA(conns));
free(ORA(conns));
@@ -431,7 +429,6 @@ void ora_do_logon(INTERNAL_FUNCTION_PARAMETERS, int persistent)
char *hashed_details;
int hashed_details_length;
oraConnection *db_conn;
- ORALS_FETCH();
if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1516,7 +1513,6 @@ PHP_FUNCTION(ora_error)
void *res;
int what;
int argc = ZEND_NUM_ARGS();
- ORALS_FETCH();
if (argc < 0 || argc >> 1 || zend_get_parameters_ex(argc, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1549,7 +1545,6 @@ PHP_FUNCTION(ora_errorcode)
void *res;
int what;
int argc = ZEND_NUM_ARGS();
- ORALS_FETCH();
if (argc < 0 || argc >> 1 || zend_get_parameters_ex(argc, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1599,7 +1594,7 @@ ora_get_cursor(HashTable *list, pval **ind)
{
oraCursor *cursor;
oraConnection *db_conn;
- ORALS_FETCH();
+ TSRMLS_FETCH();
cursor = (oraCursor *) zend_fetch_resource(ind, -1, "Oracle-Cursor", NULL, 1, le_cursor);
if (! cursor) {
@@ -1741,7 +1736,6 @@ int ora_set_param_values(oraCursor *cursor, int isout)
oraParam *param;
pval **pdata;
int i, len, plen;
-
TSRMLS_FETCH();
zend_hash_internal_pointer_reset(cursor->params);
diff --git a/ext/oracle/php_oracle.h b/ext/oracle/php_oracle.h
index 6b16e520a9..a761dff53b 100644
--- a/ext/oracle/php_oracle.h
+++ b/ext/oracle/php_oracle.h
@@ -27,19 +27,9 @@ extern zend_module_entry oracle_module_entry;
#define phpext_oracle_ptr &oracle_module_entry
#ifdef ZTS
-#define ORALS_D php_ora_globals *ora_globals
-#define ORALS_DC , ORACLE_D
-#define ORALS_C ora_globals
-#define ORALS_CC , ORALS_C
-#define ORA(v) (ora_globals->v)
-#define ORALS_FETCH() php_ora_globals *ora_globals = ts_resource(ora_globals_id)
+#define ORA(v) TSRMG(ora_globals_id, php_ora_globals *, v)
#else
-#define ORALS_D
-#define ORALS_DC
-#define ORALS_C
-#define ORALS_CC
#define ORA(v) (ora_globals.v)
-#define ORALS_FETCH()
#endif
/* oparse flags */
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 145994611c..3cc25da008 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -70,7 +70,7 @@ static void php_free_pcre_cache(void *data)
#ifdef ZTS
-static void php_pcre_init_globals(php_pcre_globals *pcre_globals)
+static void php_pcre_init_globals(php_pcre_globals *pcre_globals TSRMLS_DC)
{
zend_hash_init(&PCRE_G(pcre_cache), 0, NULL, php_free_pcre_cache, 1);
}
@@ -609,7 +609,6 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
int backref; /* Current backref */
char *compiled_string_description;
smart_str code = {0};
- CLS_FETCH();
TSRMLS_FETCH();
eval_str_end = eval_str + eval_str_len;
@@ -664,7 +663,7 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
compiled_string_description = zend_make_compiled_string_description("regexp code");
/* Run the code */
- if (zend_eval_string(code.c, &retval, compiled_string_description CLS_CC TSRMLS_CC) == FAILURE) {
+ if (zend_eval_string(code.c, &retval, compiled_string_description TSRMLS_CC) == FAILURE) {
efree(compiled_string_description);
zend_error(E_ERROR, "Failed evaluating code:\n%s\n", code);
/* zend_error() does not return in this case */
diff --git a/ext/pdf/php_pdf.h b/ext/pdf/php_pdf.h
index f04431a5e2..d1dfb5a373 100644
--- a/ext/pdf/php_pdf.h
+++ b/ext/pdf/php_pdf.h
@@ -169,10 +169,9 @@ PHP_FUNCTION(pdf_setmatrix);
#ifdef ZTS
#define PDFG(v) (pdf_globals->v)
-#define PDFLS_FETCH() php_pdf_globals *pdf_globals = ts_resource(pdf_globals_id)
+#define PDFG(v) TSRMG(pdf_globals_id, php_pdf_globals *, v)
#else
#define PDFG(v) (pdf_globals.v)
-#define PDFLS_FETCH()
#endif
diff --git a/ext/pfpro/pfpro.c b/ext/pfpro/pfpro.c
index b861af0a17..e477ca92f4 100644
--- a/ext/pfpro/pfpro.c
+++ b/ext/pfpro/pfpro.c
@@ -100,8 +100,6 @@ PHP_MSHUTDOWN_FUNCTION(pfpro)
PHP_RINIT_FUNCTION(pfpro)
{
- PFPROLS_FETCH();
-
PFPROG(initialized) = 0;
return SUCCESS;
@@ -109,7 +107,7 @@ PHP_RINIT_FUNCTION(pfpro)
PHP_RSHUTDOWN_FUNCTION(pfpro)
{
- PFPROLS_FETCH();
+ TSRMLS_FETCH();
if (PFPROG(initialized) == 1) {
pfproCleanup();
@@ -147,8 +145,6 @@ PHP_FUNCTION(pfpro_version)
Initializes the Payflow Pro library */
PHP_FUNCTION(pfpro_init)
{
- PFPROLS_FETCH();
-
if (ZEND_NUM_ARGS() != 0) {
WRONG_PARAM_COUNT;
}
@@ -165,8 +161,6 @@ PHP_FUNCTION(pfpro_init)
Shuts down the Payflow Pro library */
PHP_FUNCTION(pfpro_cleanup)
{
- PFPROLS_FETCH();
-
if (ZEND_NUM_ARGS() != 0) {
WRONG_PARAM_COUNT;
}
@@ -203,8 +197,6 @@ PHP_FUNCTION(pfpro_process_raw)
char *response;
#endif
- PFPROLS_FETCH();
-
if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 8) {
WRONG_PARAM_COUNT;
}
@@ -333,8 +325,6 @@ PHP_FUNCTION(pfpro_process)
*sp1, *sp2,
*pdelim1="&", *pdelim2="=";
- PFPROLS_FETCH();
-
if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 8) {
WRONG_PARAM_COUNT;
}
diff --git a/ext/pfpro/php_pfpro.h b/ext/pfpro/php_pfpro.h
index 1f97100fd0..9fc9a32aeb 100644
--- a/ext/pfpro/php_pfpro.h
+++ b/ext/pfpro/php_pfpro.h
@@ -64,11 +64,9 @@ typedef struct {
} php_pfpro_globals;
#ifdef ZTS
-#define PFPROG(v) (pfpro_globals->v)
-#define PFPROLS_FETCH() php_pfpro_globals *pfpro_globals = ts_resource(gd_pfpro_id)
+#define PFPROG(v) TSRMG(gd_pfpro_id, php_pfpro_globals *, v)
#else
#define PFPROG(v) (pfpro_globals.v)
-#define PFPROLS_FETCH()
#endif
#else
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 46f3708838..97d25bf124 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -128,7 +128,7 @@ PHP_PGSQL_API php_pgsql_globals pgsql_globals;
*/
static void php_pgsql_set_default_link(int id)
{
- PGLS_FETCH();
+ TSRMLS_FETCH();
zend_list_addref(id);
@@ -145,7 +145,7 @@ static void php_pgsql_set_default_link(int id)
static void _close_pgsql_link(zend_rsrc_list_entry *rsrc)
{
PGconn *link = (PGconn *)rsrc->ptr;
- PGLS_FETCH();
+ TSRMLS_FETCH();
PQfinish(link);
PGG(num_links)--;
@@ -157,7 +157,7 @@ static void _close_pgsql_link(zend_rsrc_list_entry *rsrc)
static void _close_pgsql_plink(zend_rsrc_list_entry *rsrc)
{
PGconn *link = (PGconn *)rsrc->ptr;
- PGLS_FETCH();
+ TSRMLS_FETCH();
PQfinish(link);
PGG(num_persistent)--;
@@ -173,7 +173,7 @@ static void _close_pgsql_plink(zend_rsrc_list_entry *rsrc)
static void
_notice_handler(void *arg, const char *message)
{
- PGLS_FETCH();
+ TSRMLS_FETCH();
if (! PGG(ignore_notices)) {
php_log_err((char *) message);
@@ -190,7 +190,7 @@ _notice_handler(void *arg, const char *message)
static int _rollback_transactions(zend_rsrc_list_entry *rsrc)
{
PGconn *link;
- PGLS_FETCH();
+ TSRMLS_FETCH();
if (rsrc->type != le_plink)
return 0;
@@ -235,7 +235,7 @@ PHP_INI_END()
/* {{{ php_pgsql_init_globals
*/
-static void php_pgsql_init_globals(PGLS_D TSRMLS_DC)
+static void php_pgsql_init_globals(php_pgsql_globals *pgsql_globals_p TSRMLS_DC)
{
PGG(num_persistent) = 0;
PGG(ignore_notices) = 0;
@@ -250,7 +250,7 @@ PHP_MINIT_FUNCTION(pgsql)
#ifdef ZTS
ts_allocate_id(&pgsql_globals_id, sizeof(php_pgsql_globals), (ts_allocate_ctor) php_pgsql_init_globals, NULL);
#else
- php_pgsql_init_globals(PGLS_C TSRMLS_CC);
+ php_pgsql_init_globals(&pgsql_globals TSRMLS_CC);
#endif
REGISTER_INI_ENTRIES();
@@ -283,8 +283,6 @@ PHP_MSHUTDOWN_FUNCTION(pgsql)
*/
PHP_RINIT_FUNCTION(pgsql)
{
- PGLS_FETCH();
-
PGG(default_link)=-1;
PGG(num_links) = PGG(num_persistent);
return SUCCESS;
@@ -306,7 +304,7 @@ PHP_RSHUTDOWN_FUNCTION(pgsql)
PHP_MINFO_FUNCTION(pgsql)
{
char buf[32];
- PGLS_FETCH();
+ TSRMLS_FETCH();
php_info_print_table_start();
php_info_print_table_header(2, "PostgreSQL Support", "enabled");
@@ -330,7 +328,6 @@ void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
char *hashed_details;
int hashed_details_length;
PGconn *pgsql;
- PGLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1: { /* new style, using connection string */
@@ -543,8 +540,6 @@ void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
*/
int php_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
{
- PGLS_FETCH();
-
if (PGG(default_link)==-1) { /* no link opened yet, implicitly open one */
ht = 0;
php_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
@@ -576,7 +571,6 @@ PHP_FUNCTION(pg_close)
zval **pgsql_link = NULL;
int id;
PGconn *pgsql;
- PGLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
@@ -625,7 +619,6 @@ void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
zval **pgsql_link = NULL;
int id = -1;
PGconn *pgsql;
- PGLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
@@ -730,7 +723,6 @@ PHP_FUNCTION(pg_exec)
PGresult *pgsql_result;
ExecStatusType status;
pgsql_result_handle *pg_result;
- PGLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
@@ -798,7 +790,6 @@ PHP_FUNCTION(pg_end_copy)
int id = -1;
PGconn *pgsql;
int result = 0;
- PGLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
@@ -835,7 +826,6 @@ PHP_FUNCTION(pg_put_line)
int id = -1;
PGconn *pgsql;
int result = 0;
- PGLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
@@ -937,8 +927,6 @@ PHP_FUNCTION(pg_cmdtuples)
Returns the last notice set by the backend */
PHP_FUNCTION(pg_last_notice)
{
- PGLS_FETCH();
-
if (PGG(last_notice) == NULL) {
RETURN_FALSE;
} else {
@@ -1156,7 +1144,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
int i, num_fields, pgsql_row;
char *element, *field_name;
uint element_len;
- PLS_FETCH();
+ TSRMLS__FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -1419,7 +1407,6 @@ PHP_FUNCTION(pg_trace)
char *mode = "w";
int issock, socketd;
FILE *fp;
- PGLS_FETCH();
id = PGG(default_link);
@@ -1473,7 +1460,6 @@ PHP_FUNCTION(pg_untrace)
zval **pgsql_link = NULL;
int id = -1;
PGconn *pgsql;
- PGLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
@@ -1504,7 +1490,6 @@ PHP_FUNCTION(pg_locreate)
PGconn *pgsql;
Oid pgsql_oid;
int id = -1;
- PGLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
@@ -1549,7 +1534,6 @@ PHP_FUNCTION(pg_lounlink)
PGconn *pgsql;
Oid pgsql_oid;
int id = -1;
- PGLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
@@ -1594,7 +1578,6 @@ PHP_FUNCTION(pg_loopen)
int create=0;
char *mode_string=NULL;
pgLofp *pgsql_lofp;
- PGLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 2:
@@ -1829,8 +1812,7 @@ PHP_FUNCTION(pg_loimport)
int id = -1;
PGconn *pgsql;
Oid oid;
- PLS_FETCH();
- PGLS_FETCH();
+ TSRMLS__FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -1875,7 +1857,6 @@ PHP_FUNCTION(pg_loexport)
int id = -1;
Oid oid;
PGconn *pgsql;
- PGLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 2:
@@ -1920,7 +1901,6 @@ PHP_FUNCTION(pg_set_client_encoding)
zval **encoding, **pgsql_link = NULL;
int id = -1;
PGconn *pgsql;
- PGLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
@@ -1956,7 +1936,6 @@ PHP_FUNCTION(pg_client_encoding)
zval **pgsql_link = NULL;
int id = -1;
PGconn *pgsql;
- PGLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h
index 09d47dfcf6..4dc190f3c9 100644
--- a/ext/pgsql/php_pgsql.h
+++ b/ext/pgsql/php_pgsql.h
@@ -127,21 +127,12 @@ typedef struct {
#ifdef ZTS
-# define PGLS_D php_pgsql_globals *pgsql_globals
-# define PGLS_DC , PGLS_D
-# define PGLS_C pgsql_globals
-# define PGLS_CC , PGLS_C
-# define PGG(v) (pgsql_globals->v)
-# define PGLS_FETCH() php_pgsql_globals *pgsql_globals = ts_resource(pgsql_globals_id)
+# define PGG(v) TSRMG(pgsql_globals_id, php_pgsql_globals *, v)
#else
-# define PGLS_D
-# define PGLS_DC
-# define PGLS_C
-# define PGLS_CC
# define PGG(v) (pgsql_globals.v)
-# define PGLS_FETCH()
extern PHP_PGSQL_API php_pgsql_globals pgsql_globals;
#endif
+
#endif
#else
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 3ecc6eca06..38a8215250 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -657,7 +657,6 @@ PHP_FUNCTION(posix_mkfifo)
pval *path;
pval *mode;
int result;
- PLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters(ht, 2, &path, &mode) == FAILURE) {
WRONG_PARAM_COUNT;
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 3548fe7b9b..2c9e955e4f 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -387,7 +387,7 @@ static char **_readline_completion_cb(char *text, int start, int end)
zval *params[4];
int i;
char **matches = NULL;
- CLS_FETCH();
+ TSRMLS_FETCH();
params[0]=_readline_string_zval(_readline_completion);
params[1]=_readline_string_zval(text);
diff --git a/ext/recode/php_recode.h b/ext/recode/php_recode.h
index 3a6a8d0580..a765d4f821 100644
--- a/ext/recode/php_recode.h
+++ b/ext/recode/php_recode.h
@@ -66,19 +66,9 @@ typedef struct {
} php_recode_globals;
#ifdef ZTS
-# define ReSLS_D php_recode_globals *recode_globals
-# define ReSLS_DC , ReSLS_D
-# define ReSLS_C recode_globals
-# define ReSLS_CC , ReSLS_C
-# define ReSG(v) (recode_globals->v)
-# define ReSLS_FETCH() php_recode_globals *recode_globals = ts_resource(recode_globals_id)
+# define ReSG(v) TSRMG(recode_globals_id, php_recode_globals *, v)
#else
-# define ReSLS_D
-# define ReSLS_DC
-# define ReSLS_C
-# define ReSLS_CC
# define ReSG(v) (recode_globals.v)
-# define ReSLS_FETCH()
extern PHP_MYSQL_API php_recode_globals recode_globals;
#endif
diff --git a/ext/recode/recode.c b/ext/recode/recode.c
index da4bcb1ba3..f1b556ff2f 100644
--- a/ext/recode/recode.c
+++ b/ext/recode/recode.c
@@ -74,7 +74,8 @@ ZEND_GET_MODULE(recode)
PHP_MINIT_FUNCTION(recode)
{
- ReSLS_FETCH();
+ TSRMLS_FETCH();
+
ReSG(outer) = recode_new_outer(true);
if (ReSG(outer) == NULL)
return FAILURE;
@@ -85,7 +86,7 @@ PHP_MINIT_FUNCTION(recode)
PHP_MSHUTDOWN_FUNCTION(recode)
{
- ReSLS_FETCH();
+ TSRMLS_FETCH();
if (ReSG(outer))
recode_delete_outer(ReSG(outer));
@@ -96,7 +97,7 @@ PHP_MSHUTDOWN_FUNCTION(recode)
PHP_MINFO_FUNCTION(recode)
{
- ReSLS_FETCH();
+ TSRMLS_FETCH();
php_info_print_table_start();
php_info_print_table_row(2, "Recode Support", "enabled");
@@ -116,8 +117,7 @@ PHP_FUNCTION(recode_string)
pval **req;
bool success;
int r_len=0, r_alen =0;
-
- ReSLS_FETCH();
+
if (ZEND_NUM_ARGS() != 2
|| zend_get_parameters_ex(2, &req, &str) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -169,7 +169,6 @@ PHP_FUNCTION(recode_file)
FILE *in_fp, *out_fp;
int in_type, out_type;
- ReSLS_FETCH();
if (ZEND_NUM_ARGS() != 3
|| zend_get_parameters_ex(3, &req, &input, &output) == FAILURE) {
WRONG_PARAM_COUNT;
diff --git a/ext/rpc/com/com_wrapper.c b/ext/rpc/com/com_wrapper.c
index 360c689b77..35b0ee3e4d 100644
--- a/ext/rpc/com/com_wrapper.c
+++ b/ext/rpc/com/com_wrapper.c
@@ -352,7 +352,7 @@ static PHP_INI_MH(OnTypelibFileChange)
char *typelib_name_buffer;
char *strtok_buf = NULL;
int interactive;
- CLS_FETCH();
+ TSRMLS_FETCH();
interactive = CG(interactive);
diff --git a/ext/rpc/java/java.c b/ext/rpc/java/java.c
index 7a65baa4bd..955d1882d4 100644
--- a/ext/rpc/java/java.c
+++ b/ext/rpc/java/java.c
@@ -619,7 +619,7 @@ PHP_MINIT_FUNCTION(java) {
if (!classpath) classpath = getenv("CLASSPATH");
if (!libpath) {
- PLS_FETCH();
+ TSRMLS_FETCH();
libpath=PG(extension_dir);
}
diff --git a/ext/sablot/php_sablot.h b/ext/sablot/php_sablot.h
index b6c55962d8..38f3dc0ef7 100644
--- a/ext/sablot/php_sablot.h
+++ b/ext/sablot/php_sablot.h
@@ -119,21 +119,9 @@ typedef struct {
#ifdef ZTS
-#define SABLOTG(v) (sablot_globals->v)
-#define SABLOTLS_FETCH() php_sablot_globals *sablot_globals = ts_resource(sablot_globals_id)
-#define SABLOTG_HANDLE (*sablot_globals)
-#define SABLOTLS_C sablot_globals
-#define SABLOTLS_CC , SABLOTLS_C
-#define SABLOTLS_D php_sablot_globals *sablot_globals
-#define SABLOTLS_DC , SABLOTLS_D
+#define SABLOTG(v) TSRMG(sablot_globals_id, php_sablot_globals *, v)
#else
#define SABLOTG(v) (sablot_globals.v)
-#define SABLOTG_HANDLE sablot_globals
-#define SABLOTLS_FETCH()
-#define SABLOTLS_C
-#define SABLOTLS_CC
-#define SABLOTLS_D
-#define SABLOTLS_DC
#endif
#else
diff --git a/ext/sablot/sablot.c b/ext/sablot/sablot.c
index ee05e0168f..ad5c807fb8 100644
--- a/ext/sablot/sablot.c
+++ b/ext/sablot/sablot.c
@@ -214,7 +214,7 @@ zend_module_entry sablot_module_entry = {
ZEND_GET_MODULE(sablot)
#endif
-static void php_sablot_init_globals(SABLOTLS_D TSRMLS_DC)
+static void php_sablot_init_globals(php_sablot_init_globals *sablot_init_globals_p TSRMLS_DC)
{
SABLOTG(processor) = NULL;
SABLOTG(errors) = NULL;
@@ -229,7 +229,7 @@ PHP_MINIT_FUNCTION(sablot)
#ifdef ZTS
ts_allocate_id(&sablot_globals_id, sizeof(php_sablot_globals), (ts_allocate_ctor)php_sablot_init_globals, NULL);
#else
- php_sablot_init_globals(SABLOTLS_C TSRMLS_CC);
+ php_sablot_init_globals(&sablot_globals TSRMLS_CC);
#endif
le_sablot = zend_register_list_destructors_ex(_php_sablot_free_processor, NULL, "Sablotron XSLT", module_number);
@@ -239,7 +239,8 @@ PHP_MINIT_FUNCTION(sablot)
PHP_MSHUTDOWN_FUNCTION(sablot)
{
- SABLOTLS_FETCH();
+ TSRMLS_FETCH();
+
if (SABLOTG(processor)) {
SablotUnregHandler(SABLOTG(processor), HLR_MESSAGE, NULL, NULL);
SablotDestroyProcessor(SABLOTG(processor));
@@ -250,7 +251,7 @@ PHP_MSHUTDOWN_FUNCTION(sablot)
PHP_RSHUTDOWN_FUNCTION(sablot)
{
- SABLOTLS_FETCH();
+ TSRMLS_FETCH();
SABLOT_FREE_ERROR_HANDLE(SABLOTG_HANDLE);
@@ -271,10 +272,7 @@ PHP_FUNCTION(xslt_output_begintransform)
{
/* The name of the file to pass the output through */
zval **file;
-
- /* needed for the output transformation file name */
- SABLOTLS_FETCH();
-
+
if (ZEND_NUM_ARGS() != 1 ||
zend_get_parameters_ex(1, &file) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -302,10 +300,6 @@ PHP_FUNCTION(xslt_output_endtransform)
*buffer = NULL;
int ret = 0;
- /* Fetch both the output globals and the sablotron globals */
- OLS_FETCH();
- SABLOTLS_FETCH();
-
/**
* Make sure that we don't have more than one output buffer going on
* at the same time.
@@ -393,8 +387,6 @@ PHP_FUNCTION(xslt_transform)
int argc = ZEND_NUM_ARGS(),
ret = 0;
-
- SABLOTLS_FETCH();
if (argc < 3 || argc > 6 ||
zend_get_parameters_ex(argc, &xslt_uri, &transform_uri, &result_uri, &xslt_params, &xslt_args, &result) == FAILURE) {
@@ -506,7 +498,6 @@ PHP_FUNCTION(xslt_process)
char *tRes = NULL;
int ret = 0,
argc = ZEND_NUM_ARGS();
- SABLOTLS_FETCH();
if (argc < 3 || argc > 4 ||
zend_get_parameters_ex(argc, &xslt, &input, &result, &base) == FAILURE) {
@@ -573,7 +564,6 @@ PHP_FUNCTION(xslt_create)
php_sablot *handle;
SablotHandle p;
int ret;
- SABLOTLS_FETCH();
ret = SablotCreateProcessor(&p);
@@ -632,7 +622,6 @@ PHP_FUNCTION(xslt_run)
*result = NULL;
int argc = ZEND_NUM_ARGS(),
ret = 0;
- SABLOTLS_FETCH();
if (argc < 3 || argc > 6 ||
zend_get_parameters_ex(argc, &xh, &xslt_file, &data_file, &xslt_result, &xslt_params, &xslt_args) == FAILURE) {
@@ -712,7 +701,7 @@ PHP_FUNCTION(xslt_openlog)
int ret = 0,
loglevel = 0,
argc = ZEND_NUM_ARGS();
- SABLOTLS_FETCH();
+ TSRMLS_FETCH();
if (argc < 2 || argc > 3 ||
zend_get_parameters_ex(argc, &xh, &logfile, &opt_loglevel) == FAILURE) {
@@ -745,7 +734,6 @@ PHP_FUNCTION(xslt_closelog)
zval **xh;
php_sablot *handle;
int ret;
- SABLOTLS_FETCH();
if (ZEND_NUM_ARGS() != 1 ||
zend_get_parameters_ex(1, &xh) == FAILURE) {
@@ -773,7 +761,6 @@ PHP_FUNCTION(xslt_fetch_result)
*rname = NULL;
int argc = ZEND_NUM_ARGS(),
ret = 0;
- SABLOTLS_FETCH();
if (argc < 1 || argc > 2 ||
zend_get_parameters_ex(argc, &xh, &result_name) == FAILURE) {
@@ -814,7 +801,6 @@ PHP_FUNCTION(xslt_free)
{
zval **xh;
php_sablot *handle;
- SABLOTLS_FETCH();
if (ZEND_NUM_ARGS() != 1 ||
zend_get_parameters_ex(1, &xh) == FAILURE) {
@@ -837,7 +823,6 @@ PHP_FUNCTION(xslt_set_sax_handler)
HashTable *handlers_list;
char *string_key = NULL;
ulong num_key;
- SABLOTLS_FETCH();
if (ZEND_NUM_ARGS() != 2 ||
@@ -904,7 +889,6 @@ PHP_FUNCTION(xslt_set_scheme_handler)
HashTable *handlers_list;
char *string_key = NULL;
ulong num_key;
- SABLOTLS_FETCH();
if (ZEND_NUM_ARGS() != 2 ||
zend_get_parameters_ex(2, &xh, &handlers) == FAILURE) {
@@ -952,7 +936,6 @@ PHP_FUNCTION(xslt_set_encoding)
int ret = 0,
loglevel = 0,
argc = ZEND_NUM_ARGS();
- SABLOTLS_FETCH();
if (argc != 2 ||
zend_get_parameters_ex(argc, &xh, &encoding) == FAILURE) {
@@ -976,7 +959,6 @@ PHP_FUNCTION(xslt_set_base)
php_sablot *handle;
int argc = ZEND_NUM_ARGS(),
ret = 0;
- SABLOTLS_FETCH();
if (argc < 2 || argc > 3 ||
zend_get_parameters_ex(argc, &xh, &scheme, &base) == FAILURE) {
@@ -1025,7 +1007,6 @@ PHP_FUNCTION(xslt_error)
php_sablot *handle;
int serrno = 0,
argc = ZEND_NUM_ARGS();
- SABLOTLS_FETCH();
if (argc < 0 || argc > 1 ||
zend_get_parameters_ex(argc, &xh) == FAILURE) {
@@ -1068,8 +1049,6 @@ PHP_FUNCTION(xslt_errno)
php_sablot *handle;
int argc = ZEND_NUM_ARGS();
- SABLOTLS_FETCH();
-
if (argc < 0 || argc > 1 ||
zend_get_parameters_ex(argc, &xh) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1091,8 +1070,6 @@ PHP_FUNCTION(xslt_set_error_handler)
zval **arg1, **arg2;
php_sablot *handle;
int argc = ZEND_NUM_ARGS();
-
- SABLOTLS_FETCH();
if (argc > 2 || argc < 1 ||
zend_get_parameters_ex(argc, &arg1, &arg2) == FAILURE) {
@@ -1374,7 +1351,7 @@ static MH_ERROR _php_sablot_error(void *userData, SablotHandle p, MH_ERROR code,
idx,
len;
- SABLOTLS_FETCH();
+ TSRMLS_FETCH();
if (userData == NULL) {
SABLOT_FREE_ERROR_HANDLE(SABLOTG_HANDLE);
@@ -1427,7 +1404,6 @@ static MH_ERROR _php_sablot_error(void *userData, SablotHandle p, MH_ERROR code,
if (errorHandler) {
zval *retval;
- TSRMLS_FETCH();
MAKE_STD_ZVAL(retval);
@@ -1488,7 +1464,7 @@ static MH_ERROR _php_sablot_error(void *userData, SablotHandle p, MH_ERROR code,
static void _php_sablot_standard_error(php_sablot_error *errors, php_sablot_error errors_start, int code, int level)
{
char *errstr = NULL;
- SABLOTLS_FETCH();
+ TSRMLS_FETCH();
errors = errors_start.next;
while (errors) {
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index 92aea61cc9..b490221776 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -114,23 +114,13 @@ PHP_FUNCTION(session_get_cookie_params);
PHP_FUNCTION(session_write_close);
#ifdef ZTS
-#define PSLS_D php_ps_globals *ps_globals
-#define PSLS_DC , PSLS_D
-#define PSLS_C ps_globals
-#define PSLS_CC , PSLS_C
-#define PS(v) (ps_globals->v)
-#define PSLS_FETCH() php_ps_globals *ps_globals = ts_resource(ps_globals_id)
+#define PS(v) TSRMG(ps_globals_id, php_ps_globals *, v)
#else
-#define PSLS_D void
-#define PSLS_DC
-#define PSLS_C
-#define PSLS_CC
#define PS(v) (ps_globals.v)
-#define PSLS_FETCH()
#endif
-#define PS_SERIALIZER_ENCODE_ARGS char **newstr, int *newlen PSLS_DC
-#define PS_SERIALIZER_DECODE_ARGS const char *val, int vallen PSLS_DC
+#define PS_SERIALIZER_ENCODE_ARGS char **newstr, int *newlen TSRMLS_DC
+#define PS_SERIALIZER_DECODE_ARGS const char *val, int vallen TSRMLS_DC
typedef struct ps_serializer_struct {
const char *name;
@@ -163,8 +153,8 @@ void session_adapt_flush(int (*)(const char *, uint));
#define session_adapt_flush(a) do { } while(0)
#endif
-void php_set_session_var(char *name, size_t namelen, zval *state_val,HashTable *var_hash PSLS_DC);
-int php_get_session_var(char *name, size_t namelen, zval ***state_var PLS_DC PSLS_DC TSRMLS_DC);
+void php_set_session_var(char *name, size_t namelen, zval *state_val,HashTable *var_hash TSRMLS_DC);
+int php_get_session_var(char *name, size_t namelen, zval ***state_var TSRMLS_DC);
int php_session_register_module(ps_module *);
@@ -186,16 +176,14 @@ int php_session_register_serializer(const char *name,
char *key; \
ulong key_length; \
ulong num_key; \
- zval **struc; \
- TSRMLS_FETCH(); \
- PLS_FETCH()
+ zval **struc;
#define PS_ENCODE_LOOP(code) \
for (zend_hash_internal_pointer_reset(&PS(vars)); \
zend_hash_get_current_key_ex(&PS(vars), &key, &key_length, &num_key, 0, NULL) == HASH_KEY_IS_STRING; \
zend_hash_move_forward(&PS(vars))) { \
key_length--; \
- if (php_get_session_var(key, key_length, &struc PLS_CC PSLS_CC TSRMLS_CC) == SUCCESS) { \
+ if (php_get_session_var(key, key_length, &struc TSRMLS_CC) == SUCCESS) { \
code; \
} \
}
diff --git a/ext/session/session.c b/ext/session/session.c
index 22ffbf3c60..72b66e7283 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -80,14 +80,14 @@ int ps_globals_id;
php_ps_globals ps_globals;
#endif
-static ps_module *_php_find_ps_module(char *name PSLS_DC);
-static const ps_serializer *_php_find_ps_serializer(char *name PSLS_DC);
+static ps_module *_php_find_ps_module(char *name TSRMLS_DC);
+static const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC);
static PHP_INI_MH(OnUpdateSaveHandler)
{
- PSLS_FETCH();
+ TSRMLS_FETCH();
- PS(mod) = _php_find_ps_module(new_value PSLS_CC);
+ PS(mod) = _php_find_ps_module(new_value TSRMLS_CC);
if(!PS(mod)) {
php_error(E_ERROR,"Cannot find save handler %s",new_value);
}
@@ -97,9 +97,9 @@ static PHP_INI_MH(OnUpdateSaveHandler)
static PHP_INI_MH(OnUpdateSerializer)
{
- PSLS_FETCH();
+ TSRMLS_FETCH();
- PS(serializer) = _php_find_ps_serializer(new_value PSLS_CC);
+ PS(serializer) = _php_find_ps_serializer(new_value TSRMLS_CC);
if(!PS(serializer)) {
php_error(E_ERROR,"Cannot find serialization handler %s",new_value);
}
@@ -192,9 +192,9 @@ PHP_MSHUTDOWN_FUNCTION(session);
PHP_RSHUTDOWN_FUNCTION(session);
PHP_MINFO_FUNCTION(session);
-static void php_rinit_session_globals(PSLS_D);
-static void php_rshutdown_session_globals(PSLS_D);
-static zend_bool php_session_destroy(PSLS_D);
+static void php_rinit_session_globals(TSRMLS_D);
+static void php_rshutdown_session_globals(TSRMLS_D);
+static zend_bool php_session_destroy(TSRMLS_D);
zend_module_entry session_module_entry = {
"session",
@@ -211,10 +211,10 @@ ZEND_GET_MODULE(session)
typedef struct {
char *name;
- void (*func)(PSLS_D);
+ void (*func)(TSRMLS_D);
} php_session_cache_limiter_t;
-#define CACHE_LIMITER_FUNC(name) static void _php_cache_limiter_##name(PSLS_D)
+#define CACHE_LIMITER_FUNC(name) static void _php_cache_limiter_##name(TSRMLS_D)
#define CACHE_LIMITER(name) { #name, _php_cache_limiter_##name },
#define ADD_COOKIE(a) sapi_add_header(a, strlen(a), 1);
@@ -231,10 +231,8 @@ typedef struct {
#define MAX_STR 512
-void php_set_session_var(char *name, size_t namelen, zval *state_val,HashTable *var_hash PSLS_DC)
+void php_set_session_var(char *name, size_t namelen, zval *state_val,HashTable *var_hash TSRMLS_DC)
{
- PLS_FETCH();
- TSRMLS_FETCH();
if (PG(register_globals)) {
zval **old_symbol;
@@ -267,7 +265,7 @@ void php_set_session_var(char *name, size_t namelen, zval *state_val,HashTable *
}
}
-int php_get_session_var(char *name, size_t namelen, zval ***state_var PLS_DC PSLS_DC TSRMLS_DC)
+int php_get_session_var(char *name, size_t namelen, zval ***state_var TSRMLS_DC)
{
HashTable *ht = &EG(symbol_table);
@@ -290,6 +288,7 @@ PS_SERIALIZER_ENCODE_FUNC(php_binary)
php_serialize_data_t var_hash;
PS_ENCODE_VARS;
+
buf = ecalloc(sizeof(*buf), 1);
Z_TYPE_P(buf) = IS_STRING;
buf->refcount++;
@@ -342,7 +341,7 @@ PS_SERIALIZER_DECODE_FUNC(php_binary)
if (has_value) {
MAKE_STD_ZVAL(current);
if (php_var_unserialize(&current, &p, endptr, &var_hash)) {
- php_set_session_var(name, namelen, current, &var_hash PSLS_CC);
+ php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC);
}
zval_ptr_dtor(&current);
}
@@ -428,7 +427,7 @@ PS_SERIALIZER_DECODE_FUNC(php)
if (has_value) {
MAKE_STD_ZVAL(current);
if (php_var_unserialize(&current, &q, endptr, &var_hash)) {
- php_set_session_var(name, namelen, current, &var_hash PSLS_CC);
+ php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC);
}
zval_ptr_dtor(&current);
}
@@ -447,7 +446,6 @@ break_outer_loop:
static void php_session_track_init(void)
{
zval **old_vars = NULL;
- PSLS_FETCH();
TSRMLS_FETCH();
if (zend_hash_find(&EG(symbol_table), "HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"), (void **)&old_vars) == SUCCESS && Z_TYPE_PP(old_vars) == IS_ARRAY) {
@@ -463,28 +461,28 @@ static void php_session_track_init(void)
}
}
-static char *php_session_encode(int *newlen PSLS_DC)
+static char *php_session_encode(int *newlen TSRMLS_DC)
{
char *ret = NULL;
- if (PS(serializer)->encode(&ret, newlen PSLS_CC) == FAILURE)
+ if (PS(serializer)->encode(&ret, newlen TSRMLS_CC) == FAILURE)
ret = NULL;
return ret;
}
-static void php_session_decode(const char *val, int vallen PSLS_DC)
+static void php_session_decode(const char *val, int vallen TSRMLS_DC)
{
php_session_track_init();
- if (PS(serializer)->decode(val, vallen PSLS_CC) == FAILURE) {
- php_session_destroy(PSLS_C);
+ if (PS(serializer)->decode(val, vallen TSRMLS_CC) == FAILURE) {
+ php_session_destroy(TSRMLS_C);
php_error(E_WARNING, "Failed to decode session object. Session has been destroyed.");
}
}
static char hexconvtab[] = "0123456789abcdef";
-static char *_php_create_id(int *newlen PSLS_DC)
+static char *_php_create_id(int *newlen TSRMLS_DC)
{
PHP_MD5_CTX context;
unsigned char digest[16];
@@ -533,7 +531,7 @@ static char *_php_create_id(int *newlen PSLS_DC)
return estrdup(buf);
}
-static void php_session_initialize(PSLS_D)
+static void php_session_initialize(TSRMLS_D)
{
char *val;
int vallen;
@@ -543,12 +541,12 @@ static void php_session_initialize(PSLS_D)
return;
}
if (PS(mod)->read(&PS(mod_data), PS(id), &val, &vallen) == SUCCESS) {
- php_session_decode(val, vallen PSLS_CC);
+ php_session_decode(val, vallen TSRMLS_CC);
efree(val);
}
}
-static void php_session_save_current_state(PSLS_D)
+static void php_session_save_current_state(TSRMLS_D)
{
char *val;
int vallen;
@@ -557,7 +555,6 @@ static void php_session_save_current_state(PSLS_D)
ulong variable_len;
ulong num_key;
HashPosition pos;
- PLS_FETCH();
if (!PG(register_globals)) {
if (!PS(http_session_vars)) {
@@ -572,7 +569,7 @@ static void php_session_save_current_state(PSLS_D)
}
if (PS(mod_data)) {
- val = php_session_encode(&vallen PSLS_CC);
+ val = php_session_encode(&vallen TSRMLS_CC);
if (val) {
ret = PS(mod)->write(&PS(mod_data), PS(id), val, vallen);
efree(val);
@@ -621,7 +618,7 @@ static void last_modified(void)
const char *path;
struct stat sb;
char buf[MAX_STR + 1];
- SLS_FETCH();
+ TSRMLS_FETCH();
path = SG(request_info).path_translated;
if (path) {
@@ -681,10 +678,9 @@ static php_session_cache_limiter_t php_session_cache_limiters[] = {
{0}
};
-static int php_session_cache_limiter(PSLS_D)
+static int php_session_cache_limiter(TSRMLS_D)
{
php_session_cache_limiter_t *lim;
- SLS_FETCH();
if (SG(headers_sent)) {
char *output_start_filename = php_get_output_start_filename();
@@ -701,7 +697,7 @@ static int php_session_cache_limiter(PSLS_D)
for (lim = php_session_cache_limiters; lim->name; lim++) {
if (!strcasecmp(lim->name, PS(cache_limiter))) {
- lim->func(PSLS_C);
+ lim->func(TSRMLS_C);
return (0);
}
}
@@ -715,11 +711,10 @@ static int php_session_cache_limiter(PSLS_D)
#define COOKIE_DOMAIN "; domain="
#define COOKIE_SECURE "; secure"
-static void php_session_send_cookie(PSLS_D)
+static void php_session_send_cookie(TSRMLS_D)
{
smart_str ncookie = {0};
char *date_fmt = NULL;
- SLS_FETCH();
if (SG(headers_sent)) {
char *output_start_filename = php_get_output_start_filename();
@@ -766,7 +761,7 @@ static void php_session_send_cookie(PSLS_D)
sapi_add_header(ncookie.c, ncookie.len, 0);
}
-static ps_module *_php_find_ps_module(char *name PSLS_DC)
+static ps_module *_php_find_ps_module(char *name TSRMLS_DC)
{
ps_module *ret = NULL;
ps_module **mod;
@@ -781,7 +776,7 @@ static ps_module *_php_find_ps_module(char *name PSLS_DC)
return ret;
}
-static const ps_serializer *_php_find_ps_serializer(char *name PSLS_DC)
+static const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC)
{
const ps_serializer *ret = NULL;
const ps_serializer *mod;
@@ -799,7 +794,7 @@ static const ps_serializer *_php_find_ps_serializer(char *name PSLS_DC)
convert_to_string((*ppid)); \
PS(id) = estrndup(Z_STRVAL_PP(ppid), Z_STRLEN_PP(ppid))
-static void php_session_start(PSLS_D)
+static void php_session_start(TSRMLS_D)
{
pval **ppid;
pval **data;
@@ -809,7 +804,6 @@ static void php_session_start(PSLS_D)
int module_number = PS(module_number);
int nrand;
int lensess;
- TSRMLS_FETCH();
if (PS(session_status) != php_session_none)
return;
@@ -888,7 +882,7 @@ static void php_session_start(PSLS_D)
}
if (!PS(id))
- PS(id) = _php_create_id(NULL PSLS_CC);
+ PS(id) = _php_create_id(NULL TSRMLS_CC);
if (!PS(use_cookies) && send_cookie) {
define_sid = 1;
@@ -896,7 +890,7 @@ static void php_session_start(PSLS_D)
}
if (send_cookie)
- php_session_send_cookie(PSLS_C);
+ php_session_send_cookie(TSRMLS_C);
if (define_sid) {
@@ -913,8 +907,8 @@ static void php_session_start(PSLS_D)
PS(session_status)= php_session_active;
- php_session_cache_limiter(PSLS_C);
- php_session_initialize(PSLS_C);
+ php_session_cache_limiter(TSRMLS_C);
+ php_session_initialize(TSRMLS_C);
if (PS(mod_data) && PS(gc_probability) > 0) {
int nrdels = -1;
@@ -930,7 +924,7 @@ static void php_session_start(PSLS_D)
}
}
-static zend_bool php_session_destroy(PSLS_D)
+static zend_bool php_session_destroy(TSRMLS_D)
{
zend_bool retval = SUCCESS;
@@ -944,8 +938,8 @@ static zend_bool php_session_destroy(PSLS_D)
php_error(E_WARNING, "Session object destruction failed");
}
- php_rshutdown_session_globals(PSLS_C);
- php_rinit_session_globals(PSLS_C);
+ php_rshutdown_session_globals(TSRMLS_C);
+ php_rinit_session_globals(TSRMLS_C);
return retval;
}
@@ -956,7 +950,6 @@ static zend_bool php_session_destroy(PSLS_D)
PHP_FUNCTION(session_set_cookie_params)
{
zval **lifetime, **path, **domain, **secure;
- PSLS_FETCH();
if (!PS(use_cookies))
return;
@@ -988,8 +981,6 @@ PHP_FUNCTION(session_set_cookie_params)
Return the session cookie parameters */
PHP_FUNCTION(session_get_cookie_params)
{
- PSLS_FETCH();
-
if (ZEND_NUM_ARGS() != 0) {
WRONG_PARAM_COUNT;
}
@@ -1013,7 +1004,6 @@ PHP_FUNCTION(session_name)
pval **p_name;
int ac = ZEND_NUM_ARGS();
char *old;
- PSLS_FETCH();
old = estrdup(PS(session_name));
@@ -1036,7 +1026,6 @@ PHP_FUNCTION(session_module_name)
pval **p_name;
int ac = ZEND_NUM_ARGS();
char *old;
- PSLS_FETCH();
old = estrdup(PS(mod)->name);
@@ -1047,7 +1036,7 @@ PHP_FUNCTION(session_module_name)
ps_module *tempmod;
convert_to_string_ex(p_name);
- tempmod = _php_find_ps_module(Z_STRVAL_PP(p_name) PSLS_CC);
+ tempmod = _php_find_ps_module(Z_STRVAL_PP(p_name) TSRMLS_CC);
if (tempmod) {
if (PS(mod_data))
PS(mod)->close(&PS(mod_data));
@@ -1072,7 +1061,6 @@ PHP_FUNCTION(session_set_save_handler)
zval **args[6];
int i;
ps_user *mdata;
- PSLS_FETCH();
if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_array_ex(6, args) == FAILURE)
WRONG_PARAM_COUNT;
@@ -1102,7 +1090,6 @@ PHP_FUNCTION(session_save_path)
pval **p_name;
int ac = ZEND_NUM_ARGS();
char *old;
- PSLS_FETCH();
old = estrdup(PS(save_path));
@@ -1125,7 +1112,6 @@ PHP_FUNCTION(session_id)
pval **p_name;
int ac = ZEND_NUM_ARGS();
char *old = empty_string;
- PSLS_FETCH();
if (PS(id))
old = estrdup(PS(id));
@@ -1150,7 +1136,6 @@ PHP_FUNCTION(session_cache_limiter)
pval **p_cache_limiter;
int ac = ZEND_NUM_ARGS();
char *old;
- PSLS_FETCH();
old = estrdup(PS(cache_limiter));
@@ -1166,8 +1151,8 @@ PHP_FUNCTION(session_cache_limiter)
}
/* }}} */
-/* {{{ static void php_register_var(zval** entry PSLS_DC PLS_DC) */
-static void php_register_var(zval** entry PSLS_DC PLS_DC)
+/* {{{ static void php_register_var(zval** entry TSRMLS_DC) */
+static void php_register_var(zval** entry TSRMLS_DC)
{
zval **value;
@@ -1175,7 +1160,7 @@ static void php_register_var(zval** entry PSLS_DC PLS_DC)
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(entry));
while (zend_hash_get_current_data(Z_ARRVAL_PP(entry), (void**)&value) == SUCCESS) {
- php_register_var(value PSLS_CC PLS_CC);
+ php_register_var(value TSRMLS_CC);
zend_hash_move_forward(Z_ARRVAL_PP(entry));
}
} else {
@@ -1194,8 +1179,6 @@ PHP_FUNCTION(session_register)
zval ***args;
int argc = ZEND_NUM_ARGS();
int i;
- PSLS_FETCH();
- PLS_FETCH();
if (argc <= 0)
RETURN_FALSE
@@ -1208,12 +1191,12 @@ PHP_FUNCTION(session_register)
}
if (PS(session_status) == php_session_none)
- php_session_start(PSLS_C);
+ php_session_start(TSRMLS_C);
for (i = 0; i < argc; i++) {
if (Z_TYPE_PP(args[i]) == IS_ARRAY)
SEPARATE_ZVAL(args[i]);
- php_register_var(args[i] PSLS_CC PLS_CC);
+ php_register_var(args[i] TSRMLS_CC);
}
efree(args);
@@ -1228,7 +1211,6 @@ PHP_FUNCTION(session_unregister)
{
pval **p_name;
int ac = ZEND_NUM_ARGS();
- PSLS_FETCH();
if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
WRONG_PARAM_COUNT;
@@ -1248,7 +1230,6 @@ PHP_FUNCTION(session_is_registered)
pval **p_name;
pval *p_var;
int ac = ZEND_NUM_ARGS();
- PSLS_FETCH();
if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
WRONG_PARAM_COUNT;
@@ -1269,9 +1250,8 @@ PHP_FUNCTION(session_encode)
{
int len;
char *enc;
- PSLS_FETCH();
- enc = php_session_encode(&len PSLS_CC);
+ enc = php_session_encode(&len TSRMLS_CC);
RETVAL_STRINGL(enc, len, 0);
}
/* }}} */
@@ -1281,14 +1261,13 @@ PHP_FUNCTION(session_encode)
PHP_FUNCTION(session_decode)
{
pval **str;
- PSLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE)
WRONG_PARAM_COUNT;
convert_to_string_ex(str);
- php_session_decode(Z_STRVAL_PP(str), Z_STRLEN_PP(str) PSLS_CC);
+ php_session_decode(Z_STRVAL_PP(str), Z_STRLEN_PP(str) TSRMLS_CC);
}
/* }}} */
@@ -1296,10 +1275,7 @@ PHP_FUNCTION(session_decode)
Begin session - reinitializes freezed variables, registers browsers etc */
PHP_FUNCTION(session_start)
{
- PSLS_FETCH();
-
- php_session_start(PSLS_C);
-
+ php_session_start(TSRMLS_C);
RETURN_TRUE;
}
/* }}} */
@@ -1308,9 +1284,7 @@ PHP_FUNCTION(session_start)
Destroy the current session and all data associated with it */
PHP_FUNCTION(session_destroy)
{
- PSLS_FETCH();
-
- if (php_session_destroy(PSLS_C) == SUCCESS) {
+ if (php_session_destroy(TSRMLS_C) == SUCCESS) {
RETURN_TRUE;
} else {
RETURN_FALSE;
@@ -1321,7 +1295,7 @@ PHP_FUNCTION(session_destroy)
#ifdef TRANS_SID
void session_adapt_uris(const char *src, size_t srclen, char **new, size_t *newlen)
{
- PSLS_FETCH();
+ TSRMLS_FETCH();
if (PS(define_sid) && (PS(session_status) == php_session_active))
*new = url_adapt_ext_ex(src, srclen, PS(session_name), PS(id), newlen);
@@ -1329,7 +1303,7 @@ void session_adapt_uris(const char *src, size_t srclen, char **new, size_t *newl
void session_adapt_url(const char *url, size_t urllen, char **new, size_t *newlen)
{
- PSLS_FETCH();
+ TSRMLS_FETCH();
if (PS(define_sid) && (PS(session_status) == php_session_active))
*new = url_adapt_single_url(url, urllen, PS(session_name), PS(id), newlen);
@@ -1353,7 +1327,6 @@ PHP_FUNCTION(session_unset)
zval **tmp;
char *variable;
ulong num_key;
- PSLS_FETCH();
if (PS(session_status) == php_session_none)
RETURN_FALSE;
@@ -1371,7 +1344,7 @@ PHP_FUNCTION(session_unset)
}
/* }}} */
-static void php_rinit_session_globals(PSLS_D)
+static void php_rinit_session_globals(TSRMLS_D)
{
zend_hash_init(&PS(vars), 0, NULL, NULL, 0);
PS(define_sid) = 0;
@@ -1380,7 +1353,7 @@ static void php_rinit_session_globals(PSLS_D)
PS(mod_data) = NULL;
}
-static void php_rshutdown_session_globals(PSLS_D)
+static void php_rshutdown_session_globals(TSRMLS_D)
{
if (PS(mod_data))
PS(mod)->close(&PS(mod_data));
@@ -1392,16 +1365,14 @@ static void php_rshutdown_session_globals(PSLS_D)
PHP_RINIT_FUNCTION(session)
{
- PSLS_FETCH();
-
- php_rinit_session_globals(PSLS_C);
+ php_rinit_session_globals(TSRMLS_C);
if (PS(mod) == NULL) {
char *value;
value = zend_ini_string("session.save_handler", sizeof("session.save_handler"), 0);
if (value) {
- PS(mod) = _php_find_ps_module(value PSLS_CC);
+ PS(mod) = _php_find_ps_module(value TSRMLS_CC);
}
if (!PS(mod)) {
@@ -1412,32 +1383,31 @@ PHP_RINIT_FUNCTION(session)
}
if (PS(auto_start)) {
- php_session_start(PSLS_C);
+ php_session_start(TSRMLS_C);
}
return SUCCESS;
}
-static void php_session_flush(PSLS_D)
+static void php_session_flush(TSRMLS_D)
{
if(PS(session_status)==php_session_active) {
- php_session_save_current_state(PSLS_C);
+ php_session_save_current_state(TSRMLS_C);
PS(session_status)=php_session_none;
}
}
PHP_FUNCTION(session_write_close)
{
- PSLS_FETCH();
- php_session_flush(PSLS_C);
+ php_session_flush(TSRMLS_C);
}
PHP_RSHUTDOWN_FUNCTION(session)
{
- PSLS_FETCH();
+ TSRMLS_FETCH();
- php_session_flush(PSLS_C);
- php_rshutdown_session_globals(PSLS_C);
+ php_session_flush(TSRMLS_C);
+ php_rshutdown_session_globals(TSRMLS_C);
return SUCCESS;
}
diff --git a/ext/shmop/php_shmop.h b/ext/shmop/php_shmop.h
index 2045afdebd..65ed03c27b 100644
--- a/ext/shmop/php_shmop.h
+++ b/ext/shmop/php_shmop.h
@@ -57,11 +57,9 @@ typedef struct {
} php_shmop_globals;
#ifdef ZTS
-#define SHMOPG(v) (shmop_globals->v)
-#define SHMOPLS_FETCH() php_shmop_globals *shmop_globals = ts_resource(gd_shmop_id)
+#define SHMOPG(v) TSRMG(gd_shmop_id, php_shmop_globals *, v)
#else
#define SHMOPG(v) (shmop_globals.v)
-#define SHMOPLS_FETCH()
#endif
#else
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 199075b70e..318f4e08ba 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -98,7 +98,7 @@ PHP_MSHUTDOWN_FUNCTION(array)
static void set_compare_func(int sort_type)
{
- ARRAYLS_FETCH();
+ TSRMLS_FETCH();
switch (sort_type) {
case SORT_NUMERIC:
@@ -123,7 +123,7 @@ static int array_key_compare(const void *a, const void *b)
pval result;
pval first;
pval second;
- ARRAYLS_FETCH();
+ TSRMLS_FETCH();
f = *((Bucket **) a);
s = *((Bucket **) b);
@@ -270,7 +270,7 @@ static int array_data_compare(const void *a, const void *b)
pval result;
pval *first;
pval *second;
- ARRAYLS_FETCH();
+ TSRMLS_FETCH();
f = *((Bucket **) a);
s = *((Bucket **) b);
@@ -523,7 +523,6 @@ static int array_user_compare(const void *a, const void *b)
pval **args[2];
pval *retval_ptr;
TSRMLS_FETCH();
- BLS_FETCH();
f = *((Bucket **) a);
s = *((Bucket **) b);
@@ -551,7 +550,6 @@ PHP_FUNCTION(usort)
pval **array;
pval **old_compare_func;
HashTable *target_hash;
- BLS_FETCH();
old_compare_func = BG(user_compare_func_name);
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) {
@@ -580,7 +578,6 @@ PHP_FUNCTION(uasort)
pval **array;
pval **old_compare_func;
HashTable *target_hash;
- BLS_FETCH();
old_compare_func = BG(user_compare_func_name);
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) {
@@ -611,7 +608,6 @@ static int array_user_key_compare(const void *a, const void *b)
pval retval;
int status;
TSRMLS_FETCH();
- BLS_FETCH();
args[0] = &key1;
args[1] = &key2;
@@ -658,7 +654,6 @@ PHP_FUNCTION(uksort)
pval **array;
pval **old_compare_func;
HashTable *target_hash;
- BLS_FETCH();
old_compare_func = BG(user_compare_func_name);
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) {
@@ -958,7 +953,6 @@ static int php_array_walk(HashTable *target_hash, zval **userdata)
ulong string_key_len;
ulong num_key;
HashPosition pos;
- BLS_FETCH();
TSRMLS_FETCH();
/* Allocate space for key */
@@ -1000,13 +994,13 @@ static int php_array_walk(HashTable *target_hash, zval **userdata)
/* {{{ proto int array_walk(array input, string funcname [, mixed userdata])
Apply a user function to every member of an array */
-PHP_FUNCTION(array_walk) {
+PHP_FUNCTION(array_walk)
+{
int argc;
zval **array,
**userdata = NULL,
**old_walk_func_name;
HashTable *target_hash;
- BLS_FETCH();
argc = ZEND_NUM_ARGS();
old_walk_func_name = BG(array_walk_func_name);
@@ -2513,7 +2507,7 @@ int multisort_compare(const void *a, const void *b)
int r;
int result = 0;
zval temp;
- ARRAYLS_FETCH();
+ TSRMLS_FETCH();
r = 0;
do {
@@ -2552,7 +2546,6 @@ PHP_FUNCTION(array_multisort)
int sort_order = SORT_ASC;
int sort_type = SORT_REGULAR;
int i, k;
- ARRAYLS_FETCH();
/* Get the argument count and check it */
argc = ZEND_NUM_ARGS();
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 1fc1684011..e7c2b3fd61 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -33,20 +33,10 @@ typedef struct {
} php_assert_globals;
#ifdef ZTS
-#define ASSERTLS_D php_assert_globals *assert_globals
-#define ASSERTLS_DC , ASSERTLS_D
-#define ASSERTLS_C assert_globals
-#define ASSERTLS_CC , ASSERTLS_CC
-#define ASSERT(v) (assert_globals->v)
-#define ASSERTLS_FETCH() php_assert_globals *assert_globals = ts_resource(assert_globals_id)
+#define ASSERTG(v) TSRMG(assert_globals_id, php_assert_globals *, v)
int assert_globals_id;
#else
-#define ASSERTLS_D
-#define ASSERTLS_DC
-#define ASSERTLS_C
-#define ASSERTLS_CC
-#define ASSERT(v) (assert_globals.v)
-#define ASSERTLS_FETCH()
+#define ASSERTG(v) (assert_globals.v)
php_assert_globals assert_globals;
#endif
@@ -62,18 +52,18 @@ enum {
static PHP_INI_MH(OnChangeCallback)
{
- ASSERTLS_FETCH();
+ TSRMLS_FETCH();
- if (ASSERT(callback)) {
- zval_ptr_dtor(&ASSERT(callback));
+ if (ASSERTG(callback)) {
+ zval_ptr_dtor(&ASSERTG(callback));
} else {
- MAKE_STD_ZVAL(ASSERT(callback));
+ MAKE_STD_ZVAL(ASSERTG(callback));
}
if (new_value)
- ZVAL_STRINGL(ASSERT(callback),new_value,new_value_length,1)
+ ZVAL_STRINGL(ASSERTG(callback),new_value,new_value_length,1)
else
- ZVAL_EMPTY_STRING(ASSERT(callback))
+ ZVAL_EMPTY_STRING(ASSERTG(callback))
return SUCCESS;
}
@@ -86,9 +76,9 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateInt, quiet_eval, php_assert_globals, assert_globals)
PHP_INI_END()
-static void php_assert_init_globals(ASSERTLS_D TSRMLS_DC)
+static void php_assert_init_globals(php_assert_globals *assert_globals_p TSRMLS_DC)
{
- ASSERT(callback) = NULL;
+ ASSERTG(callback) = NULL;
}
PHP_MINIT_FUNCTION(assert)
@@ -97,7 +87,7 @@ PHP_MINIT_FUNCTION(assert)
#ifdef ZTS
ts_allocate_id(&assert_globals_id, sizeof(php_assert_globals), (ts_allocate_ctor) php_assert_init_globals, NULL);
#else
- php_assert_init_globals(ASSERTLS_C TSRMLS_CC);
+ php_assert_init_globals(&assert_globals TSRMLS_CC);
#endif
REGISTER_INI_ENTRIES();
@@ -113,21 +103,21 @@ PHP_MINIT_FUNCTION(assert)
PHP_MSHUTDOWN_FUNCTION(assert)
{
- ASSERTLS_FETCH();
+ TSRMLS_FETCH();
- if (ASSERT(callback)) {
- zval_ptr_dtor(&ASSERT(callback));
+ if (ASSERTG(callback)) {
+ zval_ptr_dtor(&ASSERTG(callback));
}
return SUCCESS;
}
PHP_RSHUTDOWN_FUNCTION(assert)
{
- ASSERTLS_FETCH();
+ TSRMLS_FETCH();
- if (ASSERT(callback)) {
- zval_ptr_dtor(&ASSERT(callback));
- ASSERT(callback) = NULL;
+ if (ASSERTG(callback)) {
+ zval_ptr_dtor(&ASSERTG(callback));
+ ASSERTG(callback) = NULL;
}
return SUCCESS;
@@ -150,10 +140,8 @@ PHP_FUNCTION(assert)
int val;
char *myeval = NULL;
char *compiled_string_description;
- CLS_FETCH();
- ASSERTLS_FETCH();
- if (! ASSERT(active)) {
+ if (! ASSERTG(active)) {
RETURN_TRUE;
}
@@ -167,20 +155,20 @@ PHP_FUNCTION(assert)
myeval = Z_STRVAL_PP(assertion);
- if (ASSERT(quiet_eval)) {
+ if (ASSERTG(quiet_eval)) {
old_error_reporting = EG(error_reporting);
EG(error_reporting) = 0;
}
compiled_string_description = zend_make_compiled_string_description("assert code");
- if (zend_eval_string(myeval, &retval, compiled_string_description CLS_CC TSRMLS_CC) == FAILURE) {
+ if (zend_eval_string(myeval, &retval, compiled_string_description TSRMLS_CC) == FAILURE) {
efree(compiled_string_description);
zend_error(E_ERROR, "Failure evaluating code:\n%s\n", myeval);
/* zend_error() does not return in this case. */
}
efree(compiled_string_description);
- if (ASSERT(quiet_eval)) {
+ if (ASSERTG(quiet_eval)) {
EG(error_reporting) = old_error_reporting;
}
@@ -195,7 +183,7 @@ PHP_FUNCTION(assert)
RETURN_TRUE;
}
- if (ASSERT(callback)) {
+ if (ASSERTG(callback)) {
zval *args[4];
zval *retval;
int i;
@@ -214,7 +202,7 @@ PHP_FUNCTION(assert)
ZVAL_FALSE(retval);
/* XXX do we want to check for error here? */
- call_user_function(CG(function_table), NULL, ASSERT(callback), retval, 3, args);
+ call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args);
for (i = 0; i <= 2; i++) {
zval_ptr_dtor(&(args[i]));
@@ -222,7 +210,7 @@ PHP_FUNCTION(assert)
zval_ptr_dtor(&retval);
}
- if (ASSERT(warning)) {
+ if (ASSERTG(warning)) {
if (myeval) {
php_error(E_WARNING,"Assertion \"%s\" failed",myeval);
} else {
@@ -230,7 +218,7 @@ PHP_FUNCTION(assert)
}
}
- if (ASSERT(bail)) {
+ if (ASSERTG(bail)) {
zend_bailout();
}
}
@@ -244,7 +232,6 @@ PHP_FUNCTION(assert_options)
pval **what,**value;
int oldint;
int ac = ZEND_NUM_ARGS();
- ASSERTLS_FETCH();
if (ac < 1 || ac > 2 || zend_get_parameters_ex(ac, &what, &value) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -254,47 +241,47 @@ PHP_FUNCTION(assert_options)
switch ((*what)->value.lval) {
case ASSERT_ACTIVE:
- oldint = ASSERT(active);
+ oldint = ASSERTG(active);
if (ac == 2) {
convert_to_long_ex(value);
- ASSERT(active) = Z_LVAL_PP(value);
+ ASSERTG(active) = Z_LVAL_PP(value);
}
RETURN_LONG(oldint);
break;
case ASSERT_BAIL:
- oldint = ASSERT(bail);
+ oldint = ASSERTG(bail);
if (ac == 2) {
convert_to_long_ex(value);
- ASSERT(bail) = Z_LVAL_PP(value);
+ ASSERTG(bail) = Z_LVAL_PP(value);
}
RETURN_LONG(oldint);
break;
case ASSERT_QUIET_EVAL:
- oldint = ASSERT(quiet_eval);
+ oldint = ASSERTG(quiet_eval);
if (ac == 2) {
convert_to_long_ex(value);
- ASSERT(quiet_eval) = Z_LVAL_PP(value);
+ ASSERTG(quiet_eval) = Z_LVAL_PP(value);
}
RETURN_LONG(oldint);
break;
case ASSERT_WARNING:
- oldint = ASSERT(warning);
+ oldint = ASSERTG(warning);
if (ac == 2) {
convert_to_long_ex(value);
- ASSERT(warning) = Z_LVAL_PP(value);
+ ASSERTG(warning) = Z_LVAL_PP(value);
}
RETURN_LONG(oldint);
break;
case ASSERT_CALLBACK:
if (ac == 2) {
- if (ASSERT(callback)) {
- zval_ptr_dtor(&ASSERT(callback));
+ if (ASSERTG(callback)) {
+ zval_ptr_dtor(&ASSERTG(callback));
}
- ASSERT(callback) = *value;
+ ASSERTG(callback) = *value;
zval_add_ref(value);
}
RETURN_TRUE;
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index da7588ecdb..60c7b61ee7 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -619,7 +619,7 @@ static PHP_INI_MH(OnUpdateSafeModeProtectedEnvVars)
char *protected_vars, *protected_var;
char *token_buf;
int dummy=1;
- BLS_FETCH();
+ TSRMLS_FETCH();
protected_vars = estrndup(new_value, new_value_length);
zend_hash_clean(&BG(sm_protected_env_vars));
@@ -636,7 +636,7 @@ static PHP_INI_MH(OnUpdateSafeModeProtectedEnvVars)
static PHP_INI_MH(OnUpdateSafeModeAllowedEnvVars)
{
- BLS_FETCH();
+ TSRMLS_FETCH();
if (BG(sm_allowed_env_vars)) {
free(BG(sm_allowed_env_vars));
@@ -691,7 +691,7 @@ static void php_putenv_destructor(putenv_entry *pe)
void test_class_startup(void);
-static void basic_globals_ctor(BLS_D TSRMLS_DC)
+static void basic_globals_ctor(php_basic_globals *basic_globals_p TSRMLS_DC)
{
BG(next) = NULL;
BG(left) = -1;
@@ -709,7 +709,7 @@ static void basic_globals_ctor(BLS_D TSRMLS_DC)
#endif
}
-static void basic_globals_dtor(BLS_D TSRMLS_DC)
+static void basic_globals_dtor(php_basic_globals *basic_globals_p TSRMLS_DC)
{
zend_hash_destroy(&BG(sm_protected_env_vars));
if (BG(sm_allowed_env_vars)) {
@@ -723,12 +723,10 @@ static void basic_globals_dtor(BLS_D TSRMLS_DC)
PHP_MINIT_FUNCTION(basic)
{
- PLS_FETCH();
-
#ifdef ZTS
ts_allocate_id(&basic_globals_id, sizeof(php_basic_globals), (ts_allocate_ctor) basic_globals_ctor, (ts_allocate_dtor) basic_globals_dtor);
#else
- basic_globals_ctor(BLS_C TSRMLS_CC);
+ basic_globals_ctor(&basic_globals TSRMLS_CC);
#endif
REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT);
@@ -802,14 +800,13 @@ PHP_MINIT_FUNCTION(basic)
PHP_MSHUTDOWN_FUNCTION(basic)
{
- PLS_FETCH();
- BLS_FETCH();
TSRMLS_FETCH();
- basic_globals_dtor(BLS_C TSRMLS_CC);
#ifdef ZTS
ts_free_id(basic_globals_id);
+#else
+ basic_globals_dtor(&basic_globals TSRMLS_CC);
#endif
if(PG(allow_url_fopen)) {
@@ -838,8 +835,6 @@ PHP_MSHUTDOWN_FUNCTION(basic)
PHP_RINIT_FUNCTION(basic)
{
- BLS_FETCH();
-
BG(strtok_string) = NULL;
BG(locale_string) = NULL;
BG(user_compare_func_name) = NULL;
@@ -884,7 +879,7 @@ PHP_RINIT_FUNCTION(basic)
PHP_RSHUTDOWN_FUNCTION(basic)
{
- BLS_FETCH();
+ TSRMLS_FETCH();
STR_FREE(BG(strtok_string));
BG(strtok_string) = NULL;
@@ -1030,7 +1025,6 @@ PHP_FUNCTION(getenv)
PHP_FUNCTION(putenv)
{
pval **str;
- BLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1041,7 +1035,6 @@ PHP_FUNCTION(putenv)
int ret;
char *p,**env;
putenv_entry pe;
- PLS_FETCH();
pe.putenv_string = estrndup(Z_STRVAL_PP(str),Z_STRLEN_PP(str));
pe.key = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
@@ -1333,7 +1326,6 @@ PHP_FUNCTION(get_cfg_var)
PHP_FUNCTION(set_magic_quotes_runtime)
{
pval **new_setting;
- PLS_FETCH();
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &new_setting)==FAILURE) {
RETURN_FALSE;
@@ -1349,8 +1341,6 @@ PHP_FUNCTION(set_magic_quotes_runtime)
Get the current active configuration setting of magic_quotes_runtime */
PHP_FUNCTION(get_magic_quotes_runtime)
{
- PLS_FETCH();
-
RETURN_LONG(PG(magic_quotes_runtime));
}
/* }}} */
@@ -1359,8 +1349,6 @@ PHP_FUNCTION(get_magic_quotes_runtime)
Get the current active configuration setting of magic_quotes_gpc */
PHP_FUNCTION(get_magic_quotes_gpc)
{
- PLS_FETCH();
-
RETURN_LONG(PG(magic_quotes_gpc));
}
/* }}} */
@@ -1865,7 +1853,7 @@ static void user_tick_function_call(user_tick_function_entry *tick_fe)
static void run_user_tick_functions(int tick_count)
{
- BLS_FETCH();
+ TSRMLS_FETCH();
zend_llist_apply(BG(user_tick_functions), (llist_apply_func_t)user_tick_function_call);
}
@@ -1888,7 +1876,6 @@ static int user_tick_function_compare(user_tick_function_entry *tick_fe1,
void php_call_shutdown_functions(void)
{
- BLS_FETCH();
TSRMLS_FETCH();
if (BG(user_shutdown_function_names)) zend_try {
@@ -1905,7 +1892,6 @@ PHP_FUNCTION(register_shutdown_function)
{
php_shutdown_function_entry shutdown_function_entry;
int i;
- BLS_FETCH();
shutdown_function_entry.arg_count = ZEND_NUM_ARGS();
@@ -2203,8 +2189,6 @@ PHP_FUNCTION(print_r)
Returns true if client disconnected */
PHP_FUNCTION(connection_aborted)
{
- PLS_FETCH();
-
RETURN_LONG(PG(connection_status)&PHP_CONNECTION_ABORTED);
}
/* }}} */
@@ -2213,8 +2197,6 @@ PHP_FUNCTION(connection_aborted)
Returns the connection status bitfield */
PHP_FUNCTION(connection_status)
{
- PLS_FETCH();
-
RETURN_LONG(PG(connection_status));
}
/* }}} */
@@ -2225,7 +2207,6 @@ PHP_FUNCTION(ignore_user_abort)
{
pval **arg;
int old_setting;
- PLS_FETCH();
old_setting = PG(ignore_user_abort);
switch (ZEND_NUM_ARGS()) {
@@ -2355,7 +2336,6 @@ PHP_FUNCTION(register_tick_function)
{
user_tick_function_entry tick_fe;
int i;
- BLS_FETCH();
tick_fe.arg_count = ZEND_NUM_ARGS();
if (tick_fe.arg_count < 1) {
@@ -2394,7 +2374,6 @@ PHP_FUNCTION(unregister_tick_function)
{
zval **function;
user_tick_function_entry tick_fe;
- BLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &function)) {
WRONG_PARAM_COUNT;
@@ -2426,7 +2405,6 @@ PHPAPI PHP_FUNCTION(warn_not_available)
PHP_FUNCTION(is_uploaded_file)
{
zval **path;
- SLS_FETCH();
if (!SG(rfc1867_uploaded_files)) {
RETURN_FALSE;
@@ -2452,8 +2430,6 @@ PHP_FUNCTION(move_uploaded_file)
{
zval **path, **new_path;
zend_bool successful=0;
- SLS_FETCH();
- PLS_FETCH();
if (!SG(rfc1867_uploaded_files)) {
RETURN_FALSE;
@@ -2513,7 +2489,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type,
static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, int callback_type, zval *arr)
{
zval *element;
- BLS_FETCH();
+ TSRMLS_FETCH();
switch (callback_type) {
case ZEND_INI_PARSER_ENTRY: {
@@ -2561,7 +2537,7 @@ PHP_FUNCTION(parse_ini_file)
}
convert_to_boolean_ex(process_sections);
if (Z_BVAL_PP(process_sections)) {
- BLS_FETCH();
+ TSRMLS_FETCH();
BG(active_ini_file_section) = NULL;
ini_parser_cb = (zend_ini_parser_cb_t) php_ini_parser_cb_with_sections;
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index f72c8f77b7..8fac9cb70e 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -194,20 +194,10 @@ typedef struct {
} php_basic_globals;
#ifdef ZTS
-#define BLS_D php_basic_globals *basic_globals
-#define BLS_DC , BLS_D
-#define BLS_C basic_globals
-#define BLS_CC , BLS_C
-#define BG(v) (basic_globals->v)
-#define BLS_FETCH() php_basic_globals *basic_globals = ts_resource(basic_globals_id)
+#define BG(v) TSRMG(basic_globals_id, php_basic_globals *, v)
extern int basic_globals_id;
#else
-#define BLS_D
-#define BLS_DC
-#define BLS_C
-#define BLS_CC
#define BG(v) (basic_globals.v)
-#define BLS_FETCH()
extern php_basic_globals basic_globals;
#endif
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index 91183591b7..a6ae0eaf51 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -206,7 +206,6 @@ PHP_FUNCTION(get_browser)
zval **agent_name,**agent;
zval *found_browser_entry,*tmp_copy;
char *lookup_browser_name;
- PLS_FETCH();
if (!INI_STR("browscap")) {
RETURN_FALSE;
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index e94f1a3bc6..e48c20e1f8 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -652,7 +652,7 @@ char *php_std_date(time_t t)
{
struct tm *tm1, tmbuf;
char *str;
- PLS_FETCH();
+ TSRMLS_FETCH();
tm1 = php_gmtime_r(&t, &tmbuf);
str = emalloc(81);
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index b64893b8d1..0d5a935498 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -45,20 +45,10 @@ typedef struct {
} php_dir_globals;
#ifdef ZTS
-#define DIRG(v) (dir_globals->v)
-#define DIRLS_FETCH() php_dir_globals *dir_globals = ts_resource(dir_globals_id)
-#define DIRLS_D php_dir_globals *dir_globals
-#define DIRLS_DC , DIRLS_D
-#define DIRLS_C dir_globals
-#define DIRLS_CC , DIRLS_C
+#define DIRG(v) TSRMG(dir_globals_id, php_dir_globals *, v)
int dir_globals_id;
#else
#define DIRG(v) (dir_globals.v)
-#define DIRLS_FETCH()
-#define DIRLS_D
-#define DIRLS_DC
-#define DIRLS_C
-#define DIRLS_CC
php_dir_globals dir_globals;
#endif
@@ -97,7 +87,7 @@ static zend_function_entry php_dir_class_functions[] = {
};
-static void php_set_default_dir(int id DIRLS_DC)
+static void php_set_default_dir(int id TSRMLS_DC)
{
if (DIRG(default_dir)!=-1) {
zend_list_delete(DIRG(default_dir));
@@ -120,8 +110,6 @@ static void _dir_dtor(zend_rsrc_list_entry *rsrc)
PHP_RINIT_FUNCTION(dir)
{
- DIRLS_FETCH();
-
DIRG(default_dir) = -1;
return SUCCESS;
}
@@ -153,7 +141,6 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
{
pval **arg;
php_dir *dirp;
- DIRLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -183,7 +170,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
dirp->id = zend_list_insert(dirp,le_dirp);
- php_set_default_dir(dirp->id DIRLS_CC);
+ php_set_default_dir(dirp->id TSRMLS_CC);
if (createobject) {
object_init_ex(return_value, dir_class_entry_ptr);
@@ -221,14 +208,13 @@ PHP_FUNCTION(closedir)
{
pval **id, **tmp, *myself;
php_dir *dirp;
- DIRLS_FETCH();
FETCH_DIRP();
zend_list_delete(dirp->id);
if (dirp->id == DIRG(default_dir)) {
- php_set_default_dir(-1 DIRLS_CC);
+ php_set_default_dir(-1 TSRMLS_CC);
}
}
@@ -275,7 +261,6 @@ PHP_FUNCTION(chdir)
{
pval **arg;
int ret;
- PLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -334,7 +319,6 @@ PHP_FUNCTION(rewinddir)
{
pval **id, **tmp, *myself;
php_dir *dirp;
- DIRLS_FETCH();
FETCH_DIRP();
@@ -350,7 +334,6 @@ PHP_NAMED_FUNCTION(php_if_readdir)
php_dir *dirp;
char entry[sizeof(struct dirent)+MAXPATHLEN];
struct dirent *result = (struct dirent *)&entry; /* patch for libc5 readdir problems */
- DIRLS_FETCH();
FETCH_DIRP();
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index e911f74a80..498eddc799 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -56,7 +56,6 @@
PHP_FUNCTION(dl)
{
pval **file;
- PLS_FETCH();
#ifdef ZTS
if (strcmp(sapi_module.name, "cgi")!=0) {
@@ -101,10 +100,8 @@ void php_dl(pval *file, int type, pval *return_value)
zend_module_entry *(*get_module)(void);
int error_type;
char *extension_dir;
- PLS_FETCH();
TSRMLS_FETCH();
-
if (type==MODULE_PERSISTENT) {
/* Use the configuration hash directly, the INI mechanism is not yet initialized */
if (cfg_get_string("extension_dir", &extension_dir)==FAILURE) {
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 3dd541d212..7d538a4335 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -54,8 +54,7 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value)
#if PHP_SIGCHILD
void (*sig_handler)();
#endif
- PLS_FETCH();
- FLS_FETCH();
+ TSRMLS_FETCH();
buf = (char*) emalloc(EXEC_INPUT_BUF);
if (!buf) {
@@ -458,7 +457,6 @@ PHP_FUNCTION(shell_exec)
int readbytes,total_readbytes=0,allocated_space;
pval **cmd;
char *ret;
- PLS_FETCH();
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1,&cmd)==FAILURE) {
WRONG_PARAM_COUNT;
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 4fa6eccf92..0af13d8388 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -115,7 +115,7 @@ static int le_stream = FAILURE;
static void _file_popen_dtor(zend_rsrc_list_entry *rsrc)
{
FILE *pipe = (FILE *)rsrc->ptr;
- FLS_FETCH();
+ TSRMLS_FETCH();
FG(pclose_ret) = pclose(pipe);
}
@@ -168,7 +168,7 @@ PHPAPI int php_file_le_socket(void) /* XXX doe we really want this???? */
}
-static void file_globals_ctor(FLS_D TSRMLS_DC)
+static void file_globals_ctor(php_file_globals *file_globals_p TSRMLS_DC)
{
zend_hash_init(&FG(ht_fsock_keys), 0, NULL, NULL, 1);
zend_hash_init(&FG(ht_fsock_socks), 0, NULL, (void (*)(void *))php_msock_destroy, 1);
@@ -179,11 +179,11 @@ static void file_globals_ctor(FLS_D TSRMLS_DC)
}
-static void file_globals_dtor(FLS_D TSRMLS_DC)
+static void file_globals_dtor(php_file_globals *file_globals_p TSRMLS_DC)
{
zend_hash_destroy(&FG(ht_fsock_socks));
zend_hash_destroy(&FG(ht_fsock_keys));
- php_cleanup_sockbuf(1 FLS_CC);
+ php_cleanup_sockbuf(1 TSRMLS_CC);
}
@@ -200,7 +200,7 @@ PHP_MINIT_FUNCTION(file)
#ifdef ZTS
ts_allocate_id(&file_globals_id, sizeof(php_file_globals), (ts_allocate_ctor) file_globals_ctor, (ts_allocate_dtor) file_globals_dtor);
#else
- file_globals_ctor(FLS_C TSRMLS_CC);
+ file_globals_ctor(&file_globals TSRMLS_CC);
#endif
REGISTER_LONG_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT);
@@ -219,10 +219,9 @@ PHP_MINIT_FUNCTION(file)
PHP_MSHUTDOWN_FUNCTION(file)
{
#ifndef ZTS
- FLS_FETCH();
TSRMLS_FETCH();
- file_globals_dtor(FLS_C TSRMLS_CC);
+ file_globals_dtor(&file_globals TSRMLS_CC);
#endif
return SUCCESS;
}
@@ -298,7 +297,6 @@ PHP_FUNCTION(get_meta_tags)
char *name=NULL, *value=NULL, *temp=NULL;
php_meta_tags_token tok, tok_last;
php_meta_tags_data md;
- PLS_FETCH();
/* check args */
switch (ARG_COUNT(ht)) {
@@ -479,7 +477,6 @@ PHP_FUNCTION(file)
int issock=0, socketd=0;
int target_len, len;
zend_bool reached_eof=0;
- PLS_FETCH();
/* check args */
switch (ARG_COUNT(ht)) {
@@ -645,7 +642,6 @@ PHP_NAMED_FUNCTION(php_if_fopen)
int *sock;
int use_include_path = 0;
int issock=0, socketd=0;
- FLS_FETCH();
switch(ARG_COUNT(ht)) {
case 2:
@@ -726,7 +722,6 @@ PHP_FUNCTION(popen)
FILE *fp;
char *p,*tmp = NULL;
char *b, buf[1024];
- PLS_FETCH();
if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -783,7 +778,6 @@ PHP_FUNCTION(pclose)
{
pval **arg1;
void *what;
- FLS_FETCH();
if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -995,7 +989,6 @@ PHP_FUNCTION(fgets)
int issock=0;
int socketd=0;
void *what;
- PLS_FETCH();
if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1128,7 +1121,6 @@ PHP_FUNCTION(fgetss)
void *what;
char *allowed_tags=NULL;
int allowed_tags_len=0;
- FLS_FETCH();
switch(ARG_COUNT(ht)) {
case 2:
@@ -1279,7 +1271,6 @@ PHP_FUNCTION(fwrite)
int issock=0;
int socketd=0;
void *what;
- PLS_FETCH();
switch (ARG_COUNT(ht)) {
case 2:
@@ -1508,7 +1499,6 @@ PHP_FUNCTION(mkdir)
pval **arg1, **arg2;
int ret;
mode_t mode;
- PLS_FETCH();
if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1535,7 +1525,6 @@ PHP_FUNCTION(rmdir)
{
pval **arg1;
int ret;
- PLS_FETCH();
if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1578,7 +1567,8 @@ static size_t php_passthru_fd(int socketd, FILE *fp, int issock)
len = sbuf.st_size - off;
p = mmap(0, len, PROT_READ, MAP_SHARED, fd, off);
if (p != (void *) MAP_FAILED) {
- BLS_FETCH();
+ TSRMLS_FETCH();
+
BG(mmap_file) = p;
BG(mmap_len) = len;
PHPWRITE(p, len);
@@ -1732,7 +1722,6 @@ PHP_FUNCTION(rename)
pval **old_arg, **new_arg;
char *old_name, *new_name;
int ret;
- PLS_FETCH();
if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &old_arg, &new_arg) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1764,7 +1753,6 @@ PHP_FUNCTION(unlink)
{
pval **filename;
int ret;
- PLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1907,7 +1895,6 @@ PHP_NAMED_FUNCTION(php_if_fstat)
PHP_FUNCTION(copy)
{
pval **source, **target;
- PLS_FETCH();
if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &source, &target) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2010,7 +1997,6 @@ PHP_FUNCTION(fread)
int issock=0;
int socketd=0;
void *what;
- PLS_FETCH();
if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
diff --git a/ext/standard/file.h b/ext/standard/file.h
index 3f4ad17066..298c3dc8fb 100644
--- a/ext/standard/file.h
+++ b/ext/standard/file.h
@@ -114,20 +114,10 @@ typedef struct {
} php_file_globals;
#ifdef ZTS
-#define FLS_D php_file_globals *file_globals
-#define FLS_DC , FLS_D
-#define FLS_C file_globals
-#define FLS_CC , FLS_C
-#define FG(v) (file_globals->v)
-#define FLS_FETCH() php_file_globals *file_globals = ts_resource(file_globals_id)
+#define FG(v) TSRMG(file_globals_id, php_file_globals *, v)
extern int file_globals_id;
#else
-#define FLS_D void
-#define FLS_DC
-#define FLS_C
-#define FLS_CC
#define FG(v) (file_globals.v)
-#define FLS_FETCH()
extern php_file_globals file_globals;
#endif
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index 3141d871f0..227846328b 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -88,8 +88,6 @@
PHP_RINIT_FUNCTION(filestat)
{
- BLS_FETCH();
-
BG(CurrentStatFile)=NULL;
BG(CurrentStatLength)=0;
return SUCCESS;
@@ -98,7 +96,7 @@ PHP_RINIT_FUNCTION(filestat)
PHP_RSHUTDOWN_FUNCTION(filestat)
{
- BLS_FETCH();
+ TSRMLS_FETCH();
if (BG(CurrentStatFile)) {
efree (BG(CurrentStatFile));
@@ -316,7 +314,6 @@ PHP_FUNCTION(chgrp)
gid_t gid;
struct group *gr=NULL;
int ret;
- PLS_FETCH();
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2,&filename,&group)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -364,7 +361,6 @@ PHP_FUNCTION(chown)
int ret;
uid_t uid;
struct passwd *pw = NULL;
- PLS_FETCH();
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2,&filename,&user)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -408,7 +404,6 @@ PHP_FUNCTION(chmod)
pval **filename, **mode;
int ret;
mode_t imode;
- PLS_FETCH();
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2,&filename,&mode)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -452,7 +447,6 @@ PHP_FUNCTION(touch)
FILE *file;
struct utimbuf *newtime = NULL;
int ac = ZEND_NUM_ARGS();
- PLS_FETCH();
if (ac == 1 && zend_get_parameters_ex(1,&filename) != FAILURE) {
#ifndef HAVE_UTIME_NULL
@@ -517,8 +511,6 @@ PHP_FUNCTION(touch)
Clear file stat cache */
PHP_FUNCTION(clearstatcache)
{
- BLS_FETCH();
-
if (BG(CurrentStatFile)) {
efree(BG(CurrentStatFile));
BG(CurrentStatFile) = NULL;
@@ -538,7 +530,7 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ
int rmask=S_IROTH,wmask=S_IWOTH,xmask=S_IXOTH; /* access rights defaults to other */
char *stat_sb_names[13]={"dev","ino","mode","nlink","uid","gid","rdev",
"size","atime","mtime","ctime","blksize","blocks"};
- BLS_FETCH();
+ TSRMLS_FETCH();
stat_sb = &BG(sb);
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
index 0cf92a2ad6..d42e984de1 100644
--- a/ext/standard/fsock.c
+++ b/ext/standard/fsock.c
@@ -126,7 +126,7 @@ PHPAPI int php_lookup_hostname(const char *addr, struct in_addr *in)
PHPAPI int php_is_persistent_sock(int sock)
{
char *key;
- FLS_FETCH();
+ TSRMLS_FETCH();
if (zend_hash_find(&FG(ht_fsock_socks), (char *) &sock, sizeof(sock),
(void **) &key) == SUCCESS) {
@@ -153,7 +153,6 @@ static void php_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) {
unsigned short portno;
unsigned long conv;
char *key = NULL;
- FLS_FETCH();
if (arg_count > 5 || arg_count < 2 || zend_get_parameters_array_ex(arg_count,args)==FAILURE) {
CLOSE_SOCK(1);
@@ -304,7 +303,7 @@ PHP_FUNCTION(pfsockopen)
FG(phpsockbuf) = sock->next; \
pefree(sock, sock->persistent)
-PHPAPI void php_cleanup_sockbuf(int persistent FLS_DC)
+PHPAPI void php_cleanup_sockbuf(int persistent TSRMLS_DC)
{
php_sockbuf *now, *next;
@@ -321,11 +320,11 @@ PHPAPI void php_cleanup_sockbuf(int persistent FLS_DC)
#define WRITEPTR(sock) ((sock)->readbuf + (sock)->writepos)
#define SOCK_FIND(sock,socket) \
php_sockbuf *sock; \
- FLS_FETCH(); \
- sock = php_sockfind(socket FLS_CC); \
- if(!sock) sock = php_sockcreate(socket FLS_CC)
+ TSRMLS_FETCH(); \
+ sock = php_sockfind(socket TSRMLS_CC); \
+ if(!sock) sock = php_sockcreate(socket TSRMLS_CC)
-static php_sockbuf *php_sockfind(int socket FLS_DC)
+static php_sockbuf *php_sockfind(int socket TSRMLS_DC)
{
php_sockbuf *buf = NULL, *tmp;
@@ -338,7 +337,7 @@ static php_sockbuf *php_sockfind(int socket FLS_DC)
return buf;
}
-static php_sockbuf *php_sockcreate(int socket FLS_DC)
+static php_sockbuf *php_sockcreate(int socket TSRMLS_DC)
{
php_sockbuf *sock;
int persistent = php_is_persistent_sock(socket);
@@ -365,7 +364,7 @@ PHPAPI php_sockbuf *php_get_socket(int socket)
PHPAPI size_t php_sock_set_def_chunk_size(size_t size)
{
size_t old;
- FLS_FETCH();
+ TSRMLS_FETCH();
old = FG(def_chunk_size);
@@ -379,9 +378,9 @@ PHPAPI int php_sockdestroy(int socket)
{
int ret = 0;
php_sockbuf *sock;
- FLS_FETCH();
+ TSRMLS_FETCH();
- sock = php_sockfind(socket FLS_CC);
+ sock = php_sockfind(socket TSRMLS_CC);
if(sock) {
ret = 1;
SOCK_DESTROY(sock);
@@ -406,9 +405,9 @@ PHPAPI int php_sock_close(int socket)
{
int ret = 0;
php_sockbuf *sock;
- FLS_FETCH();
+ TSRMLS_FETCH();
- sock = php_sockfind(socket FLS_CC);
+ sock = php_sockfind(socket TSRMLS_CC);
if(sock) {
if(!sock->persistent) {
SOCK_CLOSE(sock->socket);
@@ -753,9 +752,9 @@ PHPAPI void php_msock_destroy(int *data)
PHP_RSHUTDOWN_FUNCTION(fsock)
{
- FLS_FETCH();
+ TSRMLS_FETCH();
- php_cleanup_sockbuf(0 FLS_CC);
+ php_cleanup_sockbuf(0 TSRMLS_CC);
return SUCCESS;
}
/* }}} */
diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h
index 9f369a8b27..814e442412 100644
--- a/ext/standard/fsock.h
+++ b/ext/standard/fsock.h
@@ -72,7 +72,7 @@ PHPAPI int php_sockdestroy(int socket);
PHPAPI int php_sock_close(int socket);
PHPAPI size_t php_sock_set_def_chunk_size(size_t size);
PHPAPI void php_msock_destroy(int *data);
-PHPAPI void php_cleanup_sockbuf(int persistent FLS_DC);
+PHPAPI void php_cleanup_sockbuf(int persistent TSRMLS_DC);
PHPAPI struct php_sockbuf *php_get_socket(int socket);
diff --git a/ext/standard/head.c b/ext/standard/head.c
index c84fee46df..b4df2645ff 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -59,7 +59,7 @@ PHP_FUNCTION(header)
PHPAPI int php_header()
{
- SLS_FETCH();
+ TSRMLS_FETCH();
if (sapi_send_headers()==FAILURE || SG(request_info).headers_only) {
return 0; /* don't allow output */
@@ -84,7 +84,6 @@ PHP_FUNCTION(setcookie)
pval **arg[6];
int arg_count;
zval **z_name=NULL, **z_value=NULL, **z_path=NULL, **z_domain=NULL;
- SLS_FETCH();
arg_count = ZEND_NUM_ARGS();
if (arg_count < 1 || arg_count > 6 || zend_get_parameters_array_ex(arg_count, arg) == FAILURE) {
@@ -181,8 +180,6 @@ PHP_FUNCTION(setcookie)
Return true if headers have already been sent, false otherwise */
PHP_FUNCTION(headers_sent)
{
- SLS_FETCH();
-
if (SG(headers_sent)) {
RETURN_TRUE;
} else {
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 9c09c78dcd..f83fb7b3ae 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -85,6 +85,7 @@ FILE *php_fopen_url_wrap_http(char *path, char *mode, int options, int *issock,
zval *response_header;
char *http_header_line;
int http_header_line_length, http_header_line_size;
+ TSRMLS_FETCH();
resource = php_url_parse((char *) path);
if (resource == NULL) {
@@ -274,7 +275,6 @@ FILE *php_fopen_url_wrap_http(char *path, char *mode, int options, int *issock,
php_url_free(resource);
if (location[0] != '\0') {
zval **response_header_new, *entry, **entryp;
- TSRMLS_FETCH();
fp = php_fopen_url_wrap_http(location, mode, options, issock, socketd, opened_path);
if (zend_hash_find(EG(active_symbol_table), "http_response_header", sizeof("http_response_header"), (void **) &response_header_new) == SUCCESS) {
@@ -299,7 +299,6 @@ FILE *php_fopen_url_wrap_http(char *path, char *mode, int options, int *issock,
*issock = 1;
out:
{
- TSRMLS_FETCH();
ZEND_SET_SYMBOL(EG(active_symbol_table), "http_response_header", response_header);
}
return (fp);
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
index c0019282e8..3f8094596b 100644
--- a/ext/standard/incomplete_class.c
+++ b/ext/standard/incomplete_class.c
@@ -88,7 +88,7 @@ static zval incomplete_class_get_property(zend_property_reference *property_refe
/* {{{ php_create_incomplete_class
*/
-zend_class_entry *php_create_incomplete_class(BLS_D)
+zend_class_entry *php_create_incomplete_class(TSRMLS_D)
{
zend_class_entry incomplete_class;
diff --git a/ext/standard/info.c b/ext/standard/info.c
index dec141f331..fa1fef823e 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -153,7 +153,6 @@ PHPAPI void php_print_info(int flag)
time_t the_time;
struct tm *ta, tmbuf;
TSRMLS_FETCH();
- SLS_FETCH();
the_time = time(NULL);
ta = php_localtime_r(&the_time, &tmbuf);
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c
index 6f97a0397a..f0ba907d45 100644
--- a/ext/standard/lcg.c
+++ b/ext/standard/lcg.c
@@ -50,7 +50,7 @@ double php_combined_lcg(void)
{
php_int32 q;
php_int32 z;
- LCGLS_FETCH();
+ TSRMLS_FETCH();
MODMULT(53668,40014,12211,2147483563L, LCG(s1));
MODMULT(52774,40692,3791, 2147483399L, LCG(s2));
@@ -63,7 +63,7 @@ double php_combined_lcg(void)
return z * 4.656613e-10;
}
-static void lcg_init_globals(LCGLS_D TSRMLS_DC)
+static void lcg_init_globals(php_lcg_globals *lcg_globals_p TSRMLS_DC)
{
LCG(s1) = 1;
#ifdef ZTS
@@ -83,7 +83,7 @@ PHP_MINIT_FUNCTION(lcg)
PHP_RINIT_FUNCTION(lcg)
{
if (!php_lcg_initialized) {
- lcg_init_globals();
+ lcg_init_globals(&lcg_globals TSRMLS_CC);
php_lcg_initialized = 1;
}
return SUCCESS;
diff --git a/ext/standard/link.c b/ext/standard/link.c
index c600be1fc3..e002018fc8 100644
--- a/ext/standard/link.c
+++ b/ext/standard/link.c
@@ -102,7 +102,6 @@ PHP_FUNCTION(symlink)
{
pval **topath, **frompath;
int ret;
- PLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &topath, &frompath) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -133,7 +132,6 @@ PHP_FUNCTION(link)
{
pval **topath, **frompath;
int ret;
- PLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &topath, &frompath) == FAILURE) {
WRONG_PARAM_COUNT;
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index a46d80a39c..406a219b66 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -81,7 +81,6 @@ PHP_FUNCTION(mail)
pval **argv[5];
char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL, *extra_cmd=NULL;
int argc;
- PLS_FETCH();
argc = ZEND_NUM_ARGS();
if (argc < 3 || argc > 5 || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c
index fb8b74f0ce..5c52d97762 100644
--- a/ext/standard/pageinfo.c
+++ b/ext/standard/pageinfo.c
@@ -43,7 +43,7 @@
/* {{{ php_statpage
*/
-static void php_statpage(BLS_D)
+static void php_statpage(TSRMLS_D)
{
struct stat *pstat;
@@ -64,18 +64,18 @@ static void php_statpage(BLS_D)
*/
long php_getuid(void)
{
- BLS_FETCH();
+ TSRMLS_FETCH();
- php_statpage(BLS_C);
+ php_statpage(TSRMLS_C);
return (BG(page_uid));
}
/* }}} */
long php_getgid(void)
{
- BLS_FETCH();
+ TSRMLS_FETCH();
- php_statpage(BLS_C);
+ php_statpage(TSRMLS_C);
return (BG(page_gid));
}
@@ -128,9 +128,7 @@ PHP_FUNCTION(getmypid)
Get the inode of the current script being parsed */
PHP_FUNCTION(getmyinode)
{
- BLS_FETCH();
-
- php_statpage(BLS_C);
+ php_statpage(TSRMLS_C);
if (BG(page_inode) < 0) {
RETURN_FALSE;
} else {
@@ -143,9 +141,7 @@ PHP_FUNCTION(getmyinode)
Get time of last page modification */
PHP_FUNCTION(getlastmod)
{
- BLS_FETCH();
-
- php_statpage(BLS_C);
+ php_statpage(TSRMLS_C);
if (BG(page_mtime) < 0) {
RETURN_FALSE;
} else {
diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h
index 04ebb02167..d1aeefa24c 100644
--- a/ext/standard/php_array.h
+++ b/ext/standard/php_array.h
@@ -89,20 +89,10 @@ typedef struct {
} php_array_globals;
#ifdef ZTS
-#define ARRAYLS_D php_array_globals *array_globals
-#define ARRAYLS_DC , ARRAYLS_D
-#define ARRAYLS_C array_globals
-#define ARRAYLS_CC , ARRAYLS_C
-#define ARRAYG(v) (array_globals->v)
-#define ARRAYLS_FETCH() php_array_globals *array_globals = ts_resource(array_globals_id)
+#define ARRAYG(v) TSRMG(array_globals_id, php_array_globals *, v)
extern int array_globals_id;
#else
-#define ARRAYLS_D
-#define ARRAYLS_DC
-#define ARRAYLS_C
-#define ARRAYLS_CC
#define ARRAYG(v) (array_globals.v)
-#define ARRAYLS_FETCH()
extern php_array_globals array_globals;
#endif
diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h
index bfa876044e..29f9642e4f 100644
--- a/ext/standard/php_incomplete_class.h
+++ b/ext/standard/php_incomplete_class.h
@@ -27,7 +27,7 @@
BG(incomplete_class)
#define PHP_IC_ENTRY_READ \
- (PHP_IC_ENTRY ? PHP_IC_ENTRY : php_create_incomplete_class(BLS_C))
+ (PHP_IC_ENTRY ? PHP_IC_ENTRY : php_create_incomplete_class(TSRMLS_C))
#define PHP_SET_CLASS_ATTRIBUTES(struc) \
@@ -53,7 +53,7 @@
extern "C" {
#endif
-zend_class_entry *php_create_incomplete_class(BLS_D);
+zend_class_entry *php_create_incomplete_class(TSRMLS_D);
char *php_lookup_class_name(zval *object, size_t *nlen, zend_bool del);
void php_store_class_name(zval *object, const char *name, size_t len);
diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h
index 4abe6a13ce..e33600fe12 100644
--- a/ext/standard/php_lcg.h
+++ b/ext/standard/php_lcg.h
@@ -33,14 +33,10 @@ PHP_FUNCTION(lcg_value);
#ifdef ZTS
PHP_MINIT_FUNCTION(lcg);
-#define LCGLS_D php_lcg_globals *lcg_globals
-#define LCG(v) (lcg_globals->v)
-#define LCGLS_FETCH() php_lcg_globals *lcg_globals = ts_resource(lcg_globals_id)
+#define LCG(v) TSRMG(lcg_globals_id, php_lcg_globals *, v)
#else
PHP_RINIT_FUNCTION(lcg);
-#define LCGLS_D void
#define LCG(v) (lcg_globals.v)
-#define LCGLS_FETCH()
#endif
#endif
diff --git a/ext/standard/rand.c b/ext/standard/rand.c
index 72227af0fd..c863419fa1 100644
--- a/ext/standard/rand.c
+++ b/ext/standard/rand.c
@@ -96,7 +96,7 @@
/* {{{ seedMT
*/
-static void seedMT(php_uint32 seed BLS_DC)
+static void seedMT(php_uint32 seed TSRMLS_DC)
{
/*
We initialize state[0..(N-1)] via the generator
@@ -152,13 +152,13 @@ static void seedMT(php_uint32 seed BLS_DC)
}
/* }}} */
-static php_uint32 reloadMT(BLS_D)
+static php_uint32 reloadMT(TSRMLS_D)
{
register php_uint32 *p0=BG(state), *p2=BG(state)+2, *pM=BG(state)+M, s0, s1;
register int j;
if(BG(left) < -1)
- seedMT(4357U BLS_CC);
+ seedMT(4357U TSRMLS_CC);
BG(left)=N-1, BG(next)=BG(state)+1;
@@ -179,10 +179,10 @@ static php_uint32 reloadMT(BLS_D)
static inline php_uint32 randomMT(void)
{
php_uint32 y;
- BLS_FETCH();
+ TSRMLS_FETCH();
if(--BG(left) < 0)
- return(reloadMT(BLS_C));
+ return(reloadMT(TSRMLS_C));
y = *BG(next)++;
y ^= (y >> 11);
@@ -210,13 +210,12 @@ PHP_FUNCTION(srand)
PHP_FUNCTION(mt_srand)
{
pval **arg;
- BLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(arg);
- seedMT((*arg)->value.lval BLS_CC);
+ seedMT((*arg)->value.lval TSRMLS_CC);
}
/* }}} */
diff --git a/ext/standard/reg.c b/ext/standard/reg.c
index c962f2b8c4..7116dad68a 100644
--- a/ext/standard/reg.c
+++ b/ext/standard/reg.c
@@ -53,7 +53,7 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
int r = 0;
int patlen = strlen(pattern);
reg_cache *rc = NULL;
- REGLS_FETCH();
+ TSRMLS_FETCH();
if(zend_hash_find(&REG(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == FAILURE ||
rc->cflags != cflags) {
@@ -102,7 +102,7 @@ PHP_MINIT_FUNCTION(regex)
PHP_MSHUTDOWN_FUNCTION(regex)
{
- REGLS_FETCH();
+ TSRMLS_FETCH();
zend_hash_destroy(&REG(ht_rc));
return SUCCESS;
diff --git a/ext/standard/reg.h b/ext/standard/reg.h
index cb34b15e7c..c8adf74956 100644
--- a/ext/standard/reg.h
+++ b/ext/standard/reg.h
@@ -42,19 +42,9 @@ PHP_MINFO_FUNCTION(regex);
#ifdef ZTS
-#define REGLS_D php_reg_globals *reg_globals
-#define REGLS_DC , REGLS_D
-#define REGLS_C reg_globals
-#define REGLS_CC , REGLS_C
-#define REG(v) (reg_globals->v)
-#define REGLS_FETCH() php_reg_globals *reg_globals = ts_resource(reg_globals_id)
+#define REG(v) TSRMG(reg_globals_id, php_reg_globals *, v)
#else
-#define REGLS_D
-#define REGLS_DC
-#define REGLS_C
-#define REGLS_CC
#define REG(v) (reg_globals.v)
-#define REGLS_FETCH()
#endif
#endif /* REG_H */
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 3f82017d63..c336da544a 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -814,7 +814,6 @@ PHP_FUNCTION(strtok)
char *token = NULL, *tokp=NULL;
char *first = NULL;
int argc;
- BLS_FETCH();
argc = ZEND_NUM_ARGS();
@@ -2026,7 +2025,7 @@ PHPAPI void php_stripslashes(char *str, int *len)
char *s, *t;
int l;
char escape_char='\\';
- PLS_FETCH();
+ TSRMLS_FETCH();
if (PG(magic_quotes_sybase)) {
escape_char='\'';
@@ -2156,7 +2155,7 @@ char *php_strerror(int errnum)
{
extern int sys_nerr;
extern char *sys_errlist[];
- BLS_FETCH();
+ TSRMLS_FETCH();
if ((unsigned int)errnum < sys_nerr) return(sys_errlist[errnum]);
(void)sprintf(BG(str_ebuf), "Unknown error: %d", errnum);
@@ -2298,7 +2297,7 @@ PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_f
char *source,*target;
char *end;
char c;
- PLS_FETCH();
+ TSRMLS_FETCH();
if (!str) {
*new_length = 0;
@@ -2907,7 +2906,6 @@ PHP_FUNCTION(setlocale)
zval *category, *locale;
int cat;
char *loc, *retval;
- BLS_FETCH();
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &pcategory, &plocale)==FAILURE)
WRONG_PARAM_COUNT;
@@ -2976,9 +2974,6 @@ PHP_FUNCTION(parse_str)
char *res = NULL;
int argCount;
int old_rg;
-
- PLS_FETCH();
- SLS_FETCH();
argCount = ARG_COUNT(ht);
if(argCount < 1 || argCount > 2 || zend_get_parameters_ex(argCount, &arg, &arrayArg) == FAILURE) {
@@ -2994,14 +2989,14 @@ PHP_FUNCTION(parse_str)
old_rg = PG(register_globals);
if(argCount == 1) {
PG(register_globals) = 1;
- php_treat_data(PARSE_STRING, res, NULL TSRMLS_CC PLS_CC SLS_CC);
+ php_treat_data(PARSE_STRING, res, NULL TSRMLS_CC);
} else {
PG(register_globals) = 0;
/* Clear out the array that was passed in. */
zval_dtor(*arrayArg);
array_init(*arrayArg);
- php_treat_data(PARSE_STRING, res, *arrayArg TSRMLS_CC PLS_CC SLS_CC);
+ php_treat_data(PARSE_STRING, res, *arrayArg TSRMLS_CC);
}
PG(register_globals) = old_rg;
}
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
index f6330facd3..0defb80b37 100644
--- a/ext/standard/syslog.c
+++ b/ext/standard/syslog.c
@@ -36,7 +36,7 @@
#include "basic_functions.h"
#include "php_ext_syslog.h"
-static void start_syslog(BLS_D);
+static void start_syslog(TSRMLS_D);
/* {{{ PHP_MINIT_FUNCTION
*/
@@ -104,10 +104,8 @@ PHP_MINIT_FUNCTION(syslog)
PHP_RINIT_FUNCTION(syslog)
{
- BLS_FETCH();
-
if (INI_INT("define_syslog_variables")) {
- start_syslog(BLS_C);
+ start_syslog(TSRMLS_C);
} else {
BG(syslog_started)=0;
}
@@ -118,7 +116,7 @@ PHP_RINIT_FUNCTION(syslog)
PHP_RSHUTDOWN_FUNCTION(syslog)
{
- BLS_FETCH();
+ TSRMLS_FETCH();
if (BG(syslog_device)) {
efree(BG(syslog_device));
@@ -128,10 +126,8 @@ PHP_RSHUTDOWN_FUNCTION(syslog)
/* {{{ start_syslog
*/
-static void start_syslog(BLS_D)
+static void start_syslog(TSRMLS_D)
{
- TSRMLS_FETCH();
-
/* error levels */
SET_VAR_LONG("LOG_EMERG", LOG_EMERG); /* system unusable */
SET_VAR_LONG("LOG_ALERT", LOG_ALERT); /* immediate action required */
@@ -197,10 +193,8 @@ static void start_syslog(BLS_D)
Initializes all syslog-related variables */
PHP_FUNCTION(define_syslog_variables)
{
- BLS_FETCH();
-
if (!BG(syslog_started)) {
- start_syslog(BLS_C);
+ start_syslog(TSRMLS_C);
}
}
/* }}} */
@@ -215,7 +209,6 @@ PHP_FUNCTION(define_syslog_variables)
PHP_FUNCTION(openlog)
{
pval **ident, **option, **facility;
- BLS_FETCH();
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &ident, &option, &facility) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -236,8 +229,6 @@ PHP_FUNCTION(openlog)
Close connection to system logger */
PHP_FUNCTION(closelog)
{
- BLS_FETCH();
-
closelog();
if (BG(syslog_device)) {
efree(BG(syslog_device));
diff --git a/ext/standard/url_scanner.c b/ext/standard/url_scanner.c
index 57cdb60a4a..07b46f7fa2 100644
--- a/ext/standard/url_scanner.c
+++ b/ext/standard/url_scanner.c
@@ -52,7 +52,7 @@ PHP_RSHUTDOWN_FUNCTION(url_scanner)
static char *url_attr_addon(const char *tag,const char *attr,const char *val,const char *buf)
{
int flag = 0;
- PLS_FETCH();
+ TSRMLS_FETCH();
if(!strcasecmp(tag,"a") && !strcasecmp(attr,"href")) {
flag = 1;
@@ -106,7 +106,7 @@ char *url_adapt(const char *src, size_t srclen, const char *data, size_t *newlen
{
char *out,*outp;
int maxl,n;
- BLS_FETCH();
+ TSRMLS_FETCH();
if(src==NULL) {
US.state=STATE_NORMAL;
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index d8e49e74f8..b4c9dafecc 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -47,7 +47,7 @@ static PHP_INI_MH(OnUpdateTags)
char *key;
char *lasts;
char *tmp;
- BLS_FETCH();
+ TSRMLS_FETCH();
ctx = &BG(url_adapt_state_ex);
@@ -202,7 +202,7 @@ done:
#undef YYLIMIT
#undef YYMARKER
-static inline void tag_arg(url_adapt_state_ex_t *ctx, char quote PLS_DC)
+static inline void tag_arg(url_adapt_state_ex_t *ctx, char quote TSRMLS_DC)
{
char f = 0;
@@ -234,8 +234,8 @@ enum {
#define YYMARKER q
#define STATE ctx->state
-#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR PLS_DC
-#define STD_ARGS ctx, start, xp PLS_CC
+#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR TSRMLS_DC
+#define STD_ARGS ctx, start, xp TSRMLS_CC
static inline void passthru(STD_PARA)
{
@@ -283,7 +283,7 @@ static inline void handle_arg(STD_PARA)
static inline void handle_val(STD_PARA, char quotes, char type)
{
smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
- tag_arg(ctx, type PLS_CC);
+ tag_arg(ctx, type TSRMLS_CC);
}
#ifdef SCANNER_DEBUG
@@ -298,7 +298,7 @@ static inline void mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size
char *xp;
char *start;
int rest;
- PLS_FETCH();
+ TSRMLS_FETCH();
smart_str_appendl(&ctx->buf, newdata, newlen);
@@ -806,7 +806,7 @@ char *url_adapt_flush(size_t *newlen)
{
char *ret = NULL;
url_adapt_state_ex_t *ctx;
- BLS_FETCH();
+ TSRMLS_FETCH();
ctx = &BG(url_adapt_state_ex);
@@ -826,7 +826,7 @@ char *url_adapt_single_url(const char *url, size_t urllen, const char *name, con
smart_str buf = {0};
smart_str sname = {0};
smart_str sval = {0};
- PLS_FETCH();
+ TSRMLS_FETCH();
smart_str_setl(&surl, url, urllen);
smart_str_sets(&sname, name);
@@ -844,7 +844,7 @@ char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char
{
char *ret;
url_adapt_state_ex_t *ctx;
- BLS_FETCH();
+ TSRMLS_FETCH();
ctx = &BG(url_adapt_state_ex);
@@ -863,7 +863,6 @@ char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char
PHP_RINIT_FUNCTION(url_scanner)
{
url_adapt_state_ex_t *ctx;
- BLS_FETCH();
ctx = &BG(url_adapt_state_ex);
@@ -875,7 +874,7 @@ PHP_RINIT_FUNCTION(url_scanner)
PHP_RSHUTDOWN_FUNCTION(url_scanner)
{
url_adapt_state_ex_t *ctx;
- BLS_FETCH();
+ TSRMLS_FETCH();
ctx = &BG(url_adapt_state_ex);
@@ -890,7 +889,7 @@ PHP_RSHUTDOWN_FUNCTION(url_scanner)
PHP_MINIT_FUNCTION(url_scanner)
{
url_adapt_state_ex_t *ctx;
- BLS_FETCH();
+ //TSRMLS_FETCH();
ctx = &BG(url_adapt_state_ex);
@@ -902,7 +901,7 @@ PHP_MINIT_FUNCTION(url_scanner)
PHP_MSHUTDOWN_FUNCTION(url_scanner)
{
- BLS_FETCH();
+ TSRMLS_FETCH();
UNREGISTER_INI_ENTRIES();
zend_hash_destroy(BG(url_adapt_state_ex).tags);
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index 0d95d68ae5..009c6859fd 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -45,7 +45,7 @@ static PHP_INI_MH(OnUpdateTags)
char *key;
char *lasts;
char *tmp;
- BLS_FETCH();
+ TSRMLS_FETCH();
ctx = &BG(url_adapt_state_ex);
@@ -142,7 +142,7 @@ done:
#undef YYLIMIT
#undef YYMARKER
-static inline void tag_arg(url_adapt_state_ex_t *ctx, char quote PLS_DC)
+static inline void tag_arg(url_adapt_state_ex_t *ctx, char quote TSRMLS_DC)
{
char f = 0;
@@ -174,8 +174,8 @@ enum {
#define YYMARKER q
#define STATE ctx->state
-#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR PLS_DC
-#define STD_ARGS ctx, start, xp PLS_CC
+#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR TSRMLS_DC
+#define STD_ARGS ctx, start, xp TSRMLS_CC
static inline void passthru(STD_PARA)
{
@@ -223,7 +223,7 @@ static inline void handle_arg(STD_PARA)
static inline void handle_val(STD_PARA, char quotes, char type)
{
smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
- tag_arg(ctx, type PLS_CC);
+ tag_arg(ctx, type TSRMLS_CC);
}
#ifdef SCANNER_DEBUG
@@ -238,7 +238,7 @@ static inline void mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size
char *xp;
char *start;
int rest;
- PLS_FETCH();
+ TSRMLS_FETCH();
smart_str_appendl(&ctx->buf, newdata, newlen);
@@ -322,7 +322,7 @@ char *url_adapt_flush(size_t *newlen)
{
char *ret = NULL;
url_adapt_state_ex_t *ctx;
- BLS_FETCH();
+ TSRMLS_FETCH();
ctx = &BG(url_adapt_state_ex);
@@ -342,7 +342,7 @@ char *url_adapt_single_url(const char *url, size_t urllen, const char *name, con
smart_str buf = {0};
smart_str sname = {0};
smart_str sval = {0};
- PLS_FETCH();
+ TSRMLS_FETCH();
smart_str_setl(&surl, url, urllen);
smart_str_sets(&sname, name);
@@ -360,7 +360,7 @@ char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char
{
char *ret;
url_adapt_state_ex_t *ctx;
- BLS_FETCH();
+ TSRMLS_FETCH();
ctx = &BG(url_adapt_state_ex);
@@ -379,7 +379,7 @@ char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char
PHP_RINIT_FUNCTION(url_scanner)
{
url_adapt_state_ex_t *ctx;
- BLS_FETCH();
+ TSRMLS_FETCH();
ctx = &BG(url_adapt_state_ex);
@@ -391,7 +391,7 @@ PHP_RINIT_FUNCTION(url_scanner)
PHP_RSHUTDOWN_FUNCTION(url_scanner)
{
url_adapt_state_ex_t *ctx;
- BLS_FETCH();
+ TSRMLS_FETCH();
ctx = &BG(url_adapt_state_ex);
@@ -406,7 +406,7 @@ PHP_RSHUTDOWN_FUNCTION(url_scanner)
PHP_MINIT_FUNCTION(url_scanner)
{
url_adapt_state_ex_t *ctx;
- BLS_FETCH();
+ TSRMLS_FETCH();
ctx = &BG(url_adapt_state_ex);
@@ -418,7 +418,7 @@ PHP_MINIT_FUNCTION(url_scanner)
PHP_MSHUTDOWN_FUNCTION(url_scanner)
{
- BLS_FETCH();
+ TSRMLS_FETCH();
UNREGISTER_INI_ENTRIES();
zend_hash_destroy(BG(url_adapt_state_ex).tags);
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 48ddba407b..90db80e8a6 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -184,7 +184,7 @@ PHPAPI void php_var_serialize(zval *buf, zval **struc, HashTable *var_hash)
int i;
ulong *var_already;
HashTable *myht;
- BLS_FETCH();
+ TSRMLS_FETCH();
if(var_hash != NULL && php_add_var_hash(var_hash,*struc,(void *)&var_already) == FAILURE && (*struc)->is_ref) {
slen = sprintf(s,"R:%ld;",*var_already);
@@ -208,7 +208,6 @@ PHPAPI void php_var_serialize(zval *buf, zval **struc, HashTable *var_hash)
return;
case IS_DOUBLE: {
- TSRMLS_FETCH();
slen = sprintf(s, "d:%.*G;",(int) EG(precision), Z_DVAL_PP(struc));
STR_CAT(buf, s, slen);
}
@@ -236,7 +235,6 @@ PHPAPI void php_var_serialize(zval *buf, zval **struc, HashTable *var_hash)
zval *fname;
int res;
PHP_CLASS_ATTRIBUTES;
- CLS_FETCH();
MAKE_STD_ZVAL(fname);
ZVAL_STRING(fname,"__sleep",1);
@@ -365,9 +363,7 @@ PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, Has
ulong id;
HashTable *myht;
zval **rval_ref;
-
TSRMLS_FETCH();
- BLS_FETCH();
if (var_hash && **p != 'R') { /* references aren't counted by serializer! */
zend_hash_next_index_insert(var_hash, rval, sizeof(*rval), NULL);
@@ -583,7 +579,6 @@ PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, Has
if ((*rval)->type == IS_OBJECT) {
zval *retval_ptr = NULL;
zval *fname;
- CLS_FETCH();
MAKE_STD_ZVAL(fname);
ZVAL_STRING(fname,"__wakeup",1);
diff --git a/ext/swf/php_swf.h b/ext/swf/php_swf.h
index e4bd699761..361f6950d8 100644
--- a/ext/swf/php_swf.h
+++ b/ext/swf/php_swf.h
@@ -107,13 +107,9 @@ ZEND_BEGIN_MODULE_GLOBALS(swf)
ZEND_END_MODULE_GLOBALS(swf)
#ifdef ZTS
-#define SWFLS_D zend_swf_globals *swf_globals
-#define SWFG(v) (swf_globals->v)
-#define SWFLS_FETCH() zend_swf_globals *swf_globals = ts_resource(swf_globals_id)
+#define SWFG(v) TSRMG(swf_globals_id, zend_swf_globals *, v)
#else
-#define SWFLS_D
#define SWFG(v) (swf_globals.v)
-#define SWFLS_FETCH()
#endif
#else
diff --git a/ext/swf/swf.c b/ext/swf/swf.c
index ac7e6f3bcb..a33f613773 100644
--- a/ext/swf/swf.c
+++ b/ext/swf/swf.c
@@ -168,9 +168,7 @@ PHP_MINIT_FUNCTION(swf)
*/
PHP_RINIT_FUNCTION(swf)
{
- SWFLS_FETCH();
SWFG(use_file) = 0;
-
return SUCCESS;
}
/* }}} */
@@ -182,7 +180,6 @@ PHP_FUNCTION(swf_openfile)
zval **name, **sizeX, **sizeY, **frameRate, **r, **g, **b;
char *na, *tmpna;
zend_bool free_na;
- SWFLS_FETCH();
if (ZEND_NUM_ARGS() != 7 ||
zend_get_parameters_ex(7, &name, &sizeX, &sizeY, &frameRate, &r, &g, &b) == FAILURE) {
@@ -245,8 +242,6 @@ PHP_FUNCTION(swf_openfile)
Close a Shockwave flash file that was opened with swf_openfile */
PHP_FUNCTION(swf_closefile)
{
- SWFLS_FETCH();
-
swf_closefile();
if (!SWFG(use_file)) {
diff --git a/ext/sybase/php_sybase_db.c b/ext/sybase/php_sybase_db.c
index c90ea4d01a..57f15cda08 100644
--- a/ext/sybase/php_sybase_db.c
+++ b/ext/sybase/php_sybase_db.c
@@ -707,7 +707,6 @@ PHP_FUNCTION(sybase_query)
int blocks_initialized=1;
int i,j;
int *column_types;
- PLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c
index 31972985f4..2cde34d177 100644
--- a/ext/sybase_ct/php_sybase_ct.c
+++ b/ext/sybase_ct/php_sybase_ct.c
@@ -97,7 +97,7 @@ ZEND_DECLARE_MODULE_GLOBALS(sybase)
static int _clean_invalid_results(list_entry *le)
{
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
if (le->type == le_result) {
sybase_link *sybase_ptr = ((sybase_result *) le->ptr)->sybase_ptr;
@@ -146,7 +146,6 @@ static void _close_sybase_link(zend_rsrc_list_entry *rsrc)
sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr;
CS_INT con_status;
TSRMLS_FETCH();
- SybCtLS_FETCH();
sybase_ptr->valid = 0;
@@ -178,7 +177,7 @@ static void _close_sybase_plink(zend_rsrc_list_entry *rsrc)
{
sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr;
CS_INT con_status;
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
/* Persistent connections may have been closed before a failed
* reopen attempt.
@@ -204,7 +203,7 @@ static void _close_sybase_plink(zend_rsrc_list_entry *rsrc)
static CS_RETCODE CS_PUBLIC _client_message_handler(CS_CONTEXT *context, CS_CONNECTION *connection, CS_CLIENTMSG *errmsg)
{
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
if (CS_SEVERITY(errmsg->msgnumber) >= SybCtG(min_client_severity)) {
php_error(E_WARNING, "Sybase: Client message: %s (severity %d)", errmsg->msgstring, CS_SEVERITY(errmsg->msgnumber));
@@ -230,7 +229,7 @@ static CS_RETCODE CS_PUBLIC _client_message_handler(CS_CONTEXT *context, CS_CONN
static CS_RETCODE CS_PUBLIC _server_message_handler(CS_CONTEXT *context, CS_CONNECTION *connection, CS_SERVERMSG *srvmsg)
{
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
if (srvmsg->severity >= SybCtG(min_server_severity)) {
php_error(E_WARNING, "Sybase: Server message: %s (severity %d, procedure %s)",
@@ -346,8 +345,6 @@ PHP_MINIT_FUNCTION(sybase)
PHP_RINIT_FUNCTION(sybase)
{
- SybCtLS_FETCH();
-
SybCtG(default_link)=-1;
SybCtG(num_links) = SybCtG(num_persistent);
SybCtG(appname) = estrndup("PHP 4.0", 7);
@@ -370,7 +367,7 @@ PHP_MSHUTDOWN_FUNCTION(sybase)
PHP_RSHUTDOWN_FUNCTION(sybase)
{
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
efree(SybCtG(appname));
STR_FREE(SybCtG(server_message));
@@ -381,8 +378,7 @@ PHP_RSHUTDOWN_FUNCTION(sybase)
static int php_sybase_do_connect_internal(sybase_link *sybase, char *host, char *user, char *passwd, char *charset)
{
CS_LOCALE *tmp_locale;
-
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
/* set a CS_CONNECTION record */
if (ct_con_alloc(SybCtG(context), &sybase->connection)!=CS_SUCCEED) {
@@ -454,7 +450,6 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
char *hashed_details;
int hashed_details_length;
sybase_link *sybase_ptr;
- SybCtLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0: /* defaults */
@@ -685,8 +680,6 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
static int php_sybase_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
{
- SybCtLS_FETCH();
-
if (SybCtG(default_link)==-1) { /* no link opened yet, implicitly open one */
ht = 0;
php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
@@ -721,7 +714,6 @@ PHP_FUNCTION(sybase_close)
pval *sybase_link_index = 0;
int id;
sybase_link *sybase_ptr;
- SybCtLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 0:
@@ -761,7 +753,7 @@ static int exec_cmd(sybase_link *sybase_ptr, char *cmdbuf)
CS_RETCODE retcode;
CS_INT restype;
int failure=0;
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
/* Fail if we already marked this connection dead. */
@@ -840,7 +832,6 @@ PHP_FUNCTION(sybase_select_db)
int id;
char *cmdbuf;
sybase_link *sybase_ptr;
- SybCtLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
@@ -891,7 +882,7 @@ static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr)
CS_DATAFMT *datafmt;
int i, j, retcode;
int blocks_initialized=1;
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
/* The following is more or less the equivalent of mysql_store_result().
* fetch all rows from the server into the row buffer, thus:
@@ -1058,7 +1049,6 @@ PHP_FUNCTION(sybase_query)
Q_SUCCESS, /* Success but no results. */
Q_FAILURE, /* Failure, no results. */
} status;
- SybCtLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 1:
@@ -1261,7 +1251,6 @@ PHP_FUNCTION(sybase_free_result)
{
pval *sybase_result_index;
sybase_result *result;
- SybCtLS_FETCH();
if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1283,9 +1272,7 @@ PHP_FUNCTION(sybase_free_result)
/* {{{ proto string sybase_get_last_message(void)
Returns the last message from server (over min_message_severity) */
PHP_FUNCTION(sybase_get_last_message)
-{
- SybCtLS_FETCH();
-
+{
RETURN_STRING(SybCtG(server_message),1);
}
/* }}} */
@@ -1296,7 +1283,6 @@ PHP_FUNCTION(sybase_num_rows)
{
pval *sybase_result_index;
sybase_result *result;
- SybCtLS_FETCH();
if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1316,7 +1302,7 @@ PHP_FUNCTION(sybase_num_fields)
{
pval *sybase_result_index;
sybase_result *result;
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1338,7 +1324,7 @@ PHP_FUNCTION(sybase_fetch_row)
int i;
sybase_result *result;
pval *field_content;
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1369,8 +1355,8 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS)
sybase_result *result;
int i;
pval *tmp;
- PLS_FETCH();
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
+ TSRMLS_FETCH();
if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1430,7 +1416,7 @@ PHP_FUNCTION(sybase_data_seek)
{
pval *sybase_result_index,*offset;
sybase_result *result;
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &sybase_result_index, &offset)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1501,7 +1487,7 @@ PHP_FUNCTION(sybase_fetch_field)
pval *sybase_result_index,*offset;
int field_offset;
sybase_result *result;
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -1555,7 +1541,7 @@ PHP_FUNCTION(sybase_field_seek)
pval *sybase_result_index,*offset;
int field_offset;
sybase_result *result;
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &sybase_result_index, &offset)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1584,7 +1570,7 @@ PHP_FUNCTION(sybase_result)
pval *row, *field, *sybase_result_index;
int field_offset=0;
sybase_result *result;
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
if (ZEND_NUM_ARGS()!=3 || getParameters(ht, 3, &sybase_result_index, &row, &field)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1638,7 +1624,7 @@ PHP_FUNCTION(sybase_affected_rows)
pval *sybase_link_index;
sybase_link *sybase_ptr;
int id;
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 0:
@@ -1666,7 +1652,7 @@ PHP_FUNCTION(sybase_affected_rows)
PHP_MINFO_FUNCTION(sybase)
{
char buf[32];
- SybCtLS_FETCH();
+ TSRMLS_FETCH();
php_info_print_table_start();
php_info_print_table_header(2, "Sybase_CT Support", "enabled" );
@@ -1686,7 +1672,6 @@ PHP_MINFO_FUNCTION(sybase)
PHP_FUNCTION(sybase_min_client_severity)
{
pval *severity;
- SybCtLS_FETCH();
if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &severity)==FAILURE) {
WRONG_PARAM_COUNT;
@@ -1702,7 +1687,6 @@ PHP_FUNCTION(sybase_min_client_severity)
PHP_FUNCTION(sybase_min_server_severity)
{
pval *severity;
- SybCtLS_FETCH();
if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &severity)==FAILURE) {
WRONG_PARAM_COUNT;
diff --git a/ext/sybase_ct/php_sybase_ct.h b/ext/sybase_ct/php_sybase_ct.h
index 8d7a56c15f..168baad83e 100644
--- a/ext/sybase_ct/php_sybase_ct.h
+++ b/ext/sybase_ct/php_sybase_ct.h
@@ -96,19 +96,9 @@ typedef struct {
#ifdef ZTS
-# define SybCtLS_D zend_sybase_globals *sybase_globals
-# define SybCtLS_DC , SybCtLS_D
-# define SybCtLS_C sybase_globals
-# define SybCtLS_CC , SybCtLS_C
-# define SybCtG(v) (sybase_globals->v)
-# define SybCtLS_FETCH() zend_sybase_globals *sybase_globals = ts_resource(sybase_globals_id)
+# define SybCtG(v) TSRMG(sybase_globals_id, zend_sybase_globals *, v)
#else
-# define SybCtLS_D
-# define SybCtLS_DC
-# define SybCtLS_C
-# define SybCtLS_CC
# define SybCtG(v) (sybase_globals.v)
-# define SybCtLS_FETCH()
#endif
#else
diff --git a/ext/vpopmail/php_vpopmail.c b/ext/vpopmail/php_vpopmail.c
index 965413ce83..4336ff84c6 100644
--- a/ext/vpopmail/php_vpopmail.c
+++ b/ext/vpopmail/php_vpopmail.c
@@ -125,8 +125,6 @@ PHP_MSHUTDOWN_FUNCTION(vpopmail)
PHP_RINIT_FUNCTION(vpopmail)
{
- VPOPMAILLS_FETCH();
-
VPOPMAILG(vpopmail_open) = 0;
VPOPMAILG(vpopmail_errno) = 0;
@@ -139,7 +137,7 @@ void vclose();
PHP_RSHUTDOWN_FUNCTION(vpopmail)
{
- VPOPMAILLS_FETCH();
+ TSRMLS_FETCH();
if (VPOPMAILG(vpopmail_open) != 0) {
vclose();
@@ -195,7 +193,6 @@ PHP_FUNCTION(vpopmail_add_domain)
convert_to_long_ex(uid);
convert_to_long_ex(gid);
- VPOPMAILLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
retval = vadddomain(Z_STRVAL_PP(domain),
@@ -230,7 +227,6 @@ PHP_FUNCTION(vpopmail_del_domain)
convert_to_string_ex(domain);
- VPOPMAILLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
retval = vdeldomain(Z_STRVAL_PP(domain));
@@ -267,7 +263,7 @@ PHP_FUNCTION(vpopmail_add_alias_domain)
php_strtolower(Z_STRVAL_PP(domain), Z_STRLEN_PP(domain));
php_strtolower(Z_STRVAL_PP(aliasdomain), Z_STRLEN_PP(aliasdomain));
- VPOPMAILLS_FETCH();
+ TSRMLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
tmpstr = vget_assign(Z_STRVAL_PP(domain), Dir, 156, &uid, &gid);
@@ -309,7 +305,8 @@ PHP_FUNCTION(vpopmail_add_alias_domain)
/* {{{ proto bool vpopmail_add_domain_ex(string domain, string passwd [, string quota [, string bounce [, bool apop]]])
Add a new virtual domain */
-PHP_FUNCTION(vpopmail_add_domain_ex) {
+PHP_FUNCTION(vpopmail_add_domain_ex)
+{
zval **domain, **passwd, **quota, **bounce, **apop;
int retval,len=0,argc=ZEND_NUM_ARGS(),is_bounce_email;
int fr_bounce=0,fr_quota=0;
@@ -319,8 +316,6 @@ PHP_FUNCTION(vpopmail_add_domain_ex) {
WRONG_PARAM_COUNT;
}
- VPOPMAILLS_FETCH();
-
switch (argc) {
case 5:
convert_to_long_ex(apop);
@@ -444,8 +439,6 @@ PHP_FUNCTION(vpopmail_del_domain_ex) {
WRONG_PARAM_COUNT;
}
- VPOPMAILLS_FETCH();
-
convert_to_string_ex(domain);
escdomain=php_escape_shell_cmd(Z_STRVAL_PP(domain));
@@ -488,8 +481,6 @@ PHP_FUNCTION(vpopmail_add_alias_domain_ex) {
WRONG_PARAM_COUNT;
}
- VPOPMAILLS_FETCH();
-
convert_to_string_ex(olddomain);
convert_to_string_ex(newdomain);
escnewdomain=php_escape_shell_cmd(Z_STRVAL_PP(newdomain));
@@ -569,7 +560,6 @@ PHP_FUNCTION(vpopmail_add_user)
convert_to_string_ex(password);
}
- VPOPMAILLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
retval = vadduser(Z_STRVAL_PP(user),
@@ -604,7 +594,6 @@ PHP_FUNCTION(vpopmail_del_user)
convert_to_string_ex(user);
convert_to_string_ex(domain);
- VPOPMAILLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
retval = vdeluser(Z_STRVAL_PP(user),
@@ -645,7 +634,6 @@ PHP_FUNCTION(vpopmail_passwd)
convert_to_string_ex(domain);
convert_to_string_ex(password);
- VPOPMAILLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
retval = vpasswd(Z_STRVAL_PP(user),
@@ -681,7 +669,6 @@ PHP_FUNCTION(vpopmail_set_user_quota)
convert_to_string_ex(domain);
convert_to_string_ex(quota);
- VPOPMAILLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
retval = vsetuserquota(Z_STRVAL_PP(user),
@@ -722,7 +709,6 @@ PHP_FUNCTION(vpopmail_auth_user)
convert_to_string_ex(domain);
convert_to_string_ex(password);
- VPOPMAILLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
VPOPMAILG(vpopmail_errno) = 0;
@@ -769,7 +755,6 @@ PHP_FUNCTION(vpopmail_alias_add)
convert_to_string_ex(domain);
convert_to_string_ex(alias);
- VPOPMAILLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
retval = valias_insert(Z_STRVAL_PP(user),
@@ -802,7 +787,6 @@ PHP_FUNCTION(vpopmail_alias_del)
convert_to_string_ex(user);
convert_to_string_ex(domain);
- VPOPMAILLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
retval = valias_delete(Z_STRVAL_PP(user), Z_STRVAL_PP(domain));
@@ -832,7 +816,6 @@ PHP_FUNCTION(vpopmail_alias_del_domain)
convert_to_string_ex(domain);
- VPOPMAILLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
retval = valias_delete_domain(Z_STRVAL_PP(domain));
@@ -865,7 +848,6 @@ PHP_FUNCTION(vpopmail_alias_get)
convert_to_string_ex(alias);
convert_to_string_ex(domain);
- VPOPMAILLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
if (array_init(return_value)!=SUCCESS) {
@@ -898,7 +880,6 @@ PHP_FUNCTION(vpopmail_alias_get_all)
convert_to_string_ex(domain);
- VPOPMAILLS_FETCH();
VPOPMAILG(vpopmail_open) = 1;
if (array_init(return_value)!=SUCCESS) {
@@ -936,8 +917,6 @@ PHP_FUNCTION(vpopmail_error)
if (ZEND_NUM_ARGS() != 0)
WRONG_PARAM_COUNT;
- VPOPMAILLS_FETCH();
-
RETURN_STRING(verror(VPOPMAILG(vpopmail_errno)),1);
}
/* }}} */
diff --git a/ext/vpopmail/php_vpopmail.h b/ext/vpopmail/php_vpopmail.h
index 10c1b7c8cf..cb96bd3f8d 100644
--- a/ext/vpopmail/php_vpopmail.h
+++ b/ext/vpopmail/php_vpopmail.h
@@ -75,11 +75,9 @@ ZEND_BEGIN_MODULE_GLOBALS(vpopmail)
ZEND_END_MODULE_GLOBALS(vpopmail)
#ifdef ZTS
-#define VPOPMAILG(v) (vpopmail_globals->v)
-#define VPOPMAILLS_FETCH() php_vpopmail_globals *vpopmail_globals = ts_resource(gd_vpopmail_id)
+#define VPOPMAILG(v) TSRMG(gd_vpopmail_id, php_vpopmail_globals *, v)
#else
#define VPOPMAILG(v) (vpopmail_globals.v)
-#define VPOPMAILLS_FETCH()
#endif
#else
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index 2149708fa8..a932965136 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -271,7 +271,7 @@ PS_SERIALIZER_DECODE_FUNC(wddx)
key = tmp;
/* fallthru */
case HASH_KEY_IS_STRING:
- php_set_session_var(key, key_length-1, *ent, NULL PSLS_CC);
+ php_set_session_var(key, key_length-1, *ent, NULL TSRMLS_CC);
PS_ADD_VAR(key);
}
}
@@ -436,8 +436,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj)
char *key;
ulong idx;
char tmp_buf[WDDX_BUF_LEN];
- CLS_FETCH();
- BLS_FETCH();
+ TSRMLS_FETCH();
MAKE_STD_ZVAL(fname);
ZVAL_STRING(fname, "__sleep", 1);
@@ -833,8 +832,6 @@ static void php_wddx_pop_element(void *user_data, const char *name)
zend_str_tolower(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));
if (zend_hash_find(EG(class_table), Z_STRVAL_P(ent1->data),
Z_STRLEN_P(ent1->data)+1, (void **) &ce)==FAILURE) {
- BLS_FETCH();
-
incomplete_class = 1;
ce = PHP_IC_ENTRY_READ;
}
diff --git a/ext/xml/php_xml.h b/ext/xml/php_xml.h
index ed2f709793..809c86a61f 100644
--- a/ext/xml/php_xml.h
+++ b/ext/xml/php_xml.h
@@ -139,19 +139,9 @@ PHPAPI char *xml_utf8_decode(const XML_Char *, int, int *, const XML_Char *);
#define phpext_xml_ptr xml_module_ptr
#ifdef ZTS
-#define XMLLS_D php_xml_globals *xml_globals
-#define XMLLS_DC , PSLS_D
-#define XMLLS_C xml_globals
-#define XMLLS_CC , XMLLS_C
-#define XML(v) (xml_globals->v)
-#define XMLLS_FETCH() php_xml_globals *xml_globals = ts_resource(xml_globals_id)
+#define XML(v) TSRMG(xml_globals_id, php_xml_globals *, v)
#else
-#define XMLLS_D
-#define XMLLS_DC
-#define XMLLS_C
-#define XMLLS_CC
#define XML(v) (xml_globals.v)
-#define XMLLS_FETCH()
#endif
#endif /* PHP_XML_H */
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index 365ada931a..addebc2f61 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -160,7 +160,7 @@ static int le_xml_parser;
#ifdef ZTS
-static void php_xml_init_globals(php_xml_globals *xml_globals TSRMLS_DC)
+static void php_xml_init_globals(php_xml_globals *xml_globals_p TSRMLS_DC)
{
XML(default_encoding) = "ISO-8859-1";
}
@@ -1045,7 +1045,6 @@ PHP_FUNCTION(xml_parser_create)
zval **encodingArg;
XML_Char *encoding;
char thisfunc[] = "xml_parser_create";
- XMLLS_FETCH();
argc = ZEND_NUM_ARGS();
@@ -1097,7 +1096,6 @@ PHP_FUNCTION(xml_parser_create_ns)
zval **encodingArg, **sepArg;
XML_Char *encoding, *sep;
char thisfunc[] = "xml_parser_create";
- XMLLS_FETCH();
argc = ZEND_NUM_ARGS();
diff --git a/ext/yp/php_yp.h b/ext/yp/php_yp.h
index 0b6d7bbad1..7dd2b46cf1 100644
--- a/ext/yp/php_yp.h
+++ b/ext/yp/php_yp.h
@@ -53,19 +53,9 @@ typedef struct {
} php_yp_globals;
#ifdef ZTS
-#define YPLS_D php_yp_globals *yp_globals
-#define YPLS_DC , YPLS_D
-#define YPLS_C yp_globals
-#define YPLS_CC , YPLS_C
-#define YP(v) (yp_globals->v)
-#define YPLS_FETCH() php_yp_globals *yp_globals = ts_resource(yp_globals_id)
+#define YG(v) TSRMG(yp_globals_id, php_yp_globals *, v)
#else
-#define YPLS_D
-#define YPLS_DC
-#define YPLS_C
-#define YPLS_CC
#define YP(v) (yp_globals.v)
-#define YPLS_FETCH()
#endif
#else
diff --git a/ext/yp/yp.c b/ext/yp/yp.c
index 264f382544..1dd3d3d162 100644
--- a/ext/yp/yp.c
+++ b/ext/yp/yp.c
@@ -72,9 +72,9 @@ ZEND_GET_MODULE(yp)
/* {{{ proto string yp_get_default_domain(void)
Returns the domain or false */
-PHP_FUNCTION(yp_get_default_domain) {
+PHP_FUNCTION(yp_get_default_domain)
+{
char *outdomain;
- YPLS_FETCH();
if(YP(error) = yp_get_default_domain(&outdomain)) {
php_error(E_WARNING, yperr_string (YP(error)));
@@ -86,7 +86,8 @@ PHP_FUNCTION(yp_get_default_domain) {
/* {{{ proto int yp_order(string domain, string map)
Returns the order number or false */
-PHP_FUNCTION(yp_order) {
+PHP_FUNCTION(yp_order)
+{
pval **domain, **map;
#if SOLARIS_YP
@@ -95,8 +96,6 @@ PHP_FUNCTION(yp_order) {
int outval;
#endif
- YPLS_FETCH();
-
if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&domain,&map) == FAILURE) {
WRONG_PARAM_COUNT;
}
@@ -115,10 +114,10 @@ PHP_FUNCTION(yp_order) {
/* {{{ proto string yp_master(string domain, string map)
Returns the machine name of the master */
-PHP_FUNCTION(yp_master) {
+PHP_FUNCTION(yp_master)
+{
pval **domain, **map;
char *outname;
- YPLS_FETCH();
if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&domain,&map) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -138,11 +137,11 @@ PHP_FUNCTION(yp_master) {
/* {{{ proto string yp_match(string domain, string map, string key)
Returns the matched line or false */
-PHP_FUNCTION(yp_match) {
+PHP_FUNCTION(yp_match)
+{
pval **domain, **map, **key;
char *outval;
int outvallen;
- YPLS_FETCH();
if((ZEND_NUM_ARGS() != 3) || zend_get_parameters_ex(3,&domain,&map,&key) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -163,11 +162,11 @@ PHP_FUNCTION(yp_match) {
/* {{{ proto array yp_first(string domain, string map)
Returns the first key as array with $var[$key] and the the line as the value */
-PHP_FUNCTION(yp_first) {
+PHP_FUNCTION(yp_first)
+{
pval **domain, **map;
char *outval, *outkey;
int outvallen, outkeylen;
- YPLS_FETCH();
if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&domain,&map) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -191,11 +190,11 @@ PHP_FUNCTION(yp_first) {
/* {{{ proto array yp_next(string domain, string map, string key)
Returns an array with $var[$key] and the the line as the value */
-PHP_FUNCTION(yp_next) {
+PHP_FUNCTION(yp_next)
+{
pval **domain, **map, **key;
char *outval, *outkey;
int outvallen, outkeylen;
- YPLS_FETCH();
if((ZEND_NUM_ARGS() != 3) || zend_get_parameters_ex(3,&domain,&map,&key) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -223,7 +222,7 @@ static int php_foreach_all (int instatus, char *inkey, int inkeylen, char *inval
zval *status, *key, *value;
zval **args [3];
zval *retval;
- CLS_FETCH();
+ TSRMLS_FETCH();
args[0] = &status;
args[1] = &key;
@@ -259,7 +258,8 @@ static int php_foreach_all (int instatus, char *inkey, int inkeylen, char *inval
/* {{{ proto void yp_all(string domain, string map, string callback)
Traverse the map and call a function on each entry */
-PHP_FUNCTION(yp_all) {
+PHP_FUNCTION(yp_all)
+{
pval **domain, **map, **php_callback;
struct ypall_callback callback;
@@ -297,7 +297,8 @@ static int php_foreach_cat (int instatus, char *inkey, int inkeylen, char *inval
if (err != YPERR_NOMORE)
{
- YPLS_FETCH();
+ TSRMLS_FETCH();
+
YP(error) = err;
php_error(E_WARNING, yperr_string (err));
}
@@ -330,9 +331,8 @@ PHP_FUNCTION(yp_cat) {
/* {{{ proto int yp_errno()
Returns the error code from the last call or 0 if no error occured */
-PHP_FUNCTION(yp_errno) {
- YPLS_FETCH();
-
+PHP_FUNCTION(yp_errno)
+{
if((ZEND_NUM_ARGS() != 0)) {
WRONG_PARAM_COUNT;
}
@@ -391,7 +391,6 @@ PHP_MINIT_FUNCTION(yp)
PHP_RINIT_FUNCTION(yp)
{
- YPLS_FETCH();
YP(error) = 0;
}
diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h
index 11884c7883..eccbc552e2 100644
--- a/ext/zlib/php_zlib.h
+++ b/ext/zlib/php_zlib.h
@@ -70,19 +70,10 @@ int php_enable_output_compression(int buffer_size);
#ifdef ZTS
-#define ZLIBLS_D php_zlib_globals *zlib_globals
-#define ZLIBLS_DC , ZLIBLS_D
-#define ZLIBLS_C zlib_globals
-#define ZLIBLS_CC , ZLIBLS_C
#define ZLIBG(v) (zlib_globals->v)
-#define ZLIBLS_FETCH() php_zlib_globals *zlib_globals = ts_resource(zlib_globals_id)
+#define ZLIBG(v) TSRMG(zlib_globals_id, zend_zlib_globals *, v)
#else
-#define ZLIBLS_D
-#define ZLIBLS_DC
-#define ZLIBLS_C
-#define ZLIBLS_CC
#define ZLIBG(v) (zlib_globals.v)
-#define ZLIBLS_FETCH()
#endif
#define phpext_zlib_ptr zlib_module_ptr
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index f31d2eb91b..120ffc4a5f 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -147,9 +147,9 @@ static void phpi_destructor_gzclose(zend_rsrc_list_entry *rsrc)
#ifdef ZTS
/* {{{ php_zlib_init_globals
*/
-static void php_zlib_init_globals(ZLIBLS_D TSRMLS_DC)
+static void php_zlib_init_globals(php_zlib_globals *zlib_globals_p TSRMLS_DC)
{
- ZLIBG(gzgetss_state) = 0;
+ ZLIBG(gzgetss_state) = 0;
}
/* }}} */
#endif
@@ -158,7 +158,7 @@ static void php_zlib_init_globals(ZLIBLS_D TSRMLS_DC)
*/
PHP_MINIT_FUNCTION(zlib)
{
- PLS_FETCH();
+ TSRMLS_FETCH();
#ifdef ZTS
ts_allocate_id(&zlib_globals_id, sizeof(php_zlib_globals), (ts_allocate_ctor) php_zlib_init_globals, NULL);
@@ -187,8 +187,6 @@ PHP_MINIT_FUNCTION(zlib)
*/
PHP_RINIT_FUNCTION(zlib)
{
- ZLIBLS_FETCH();
-
ZLIBG(ob_gzhandler_status) = 0;
switch (ZLIBG(output_compression)) {
case 0:
@@ -208,7 +206,7 @@ PHP_RINIT_FUNCTION(zlib)
PHP_MSHUTDOWN_FUNCTION(zlib)
{
#if HAVE_FOPENCOOKIE
- PLS_FETCH();
+ TSRMLS_FETCH();
if(PG(allow_url_fopen)) {
php_unregister_url_wrapper("zlib");
@@ -261,7 +259,6 @@ PHP_FUNCTION(gzfile)
char *slashed, buf[8192];
register int i=0;
int use_include_path = 0;
- PLS_FETCH();
/* check args */
switch (ZEND_NUM_ARGS()) {
@@ -317,7 +314,6 @@ PHP_FUNCTION(gzopen)
gzFile *zp;
char *p;
int use_include_path = 0;
- ZLIBLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 2:
@@ -400,7 +396,6 @@ PHP_FUNCTION(gzgets)
gzFile *zp;
int len;
char *buf;
- PLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -470,7 +465,6 @@ PHP_FUNCTION(gzgetss)
char *buf;
char *allowed_tags=NULL;
int allowed_tags_len=0;
- ZLIBLS_FETCH();
switch(ZEND_NUM_ARGS()) {
case 2:
@@ -521,7 +515,6 @@ PHP_FUNCTION(gzwrite)
gzFile *zp;
int ret;
int num_bytes;
- PLS_FETCH();
switch (ZEND_NUM_ARGS()) {
case 2:
@@ -705,7 +698,6 @@ PHP_FUNCTION(gzread)
pval **arg1, **arg2;
gzFile *zp;
int len;
- PLS_FETCH();
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -993,7 +985,7 @@ PHP_FUNCTION(gzinflate)
/* {{{ php_do_deflate
*/
-static int php_do_deflate(uint str_length, Bytef **p_buffer, uint *p_buffer_len, zend_bool do_start, zend_bool do_end ZLIBLS_DC)
+static int php_do_deflate(uint str_length, Bytef **p_buffer, uint *p_buffer_len, zend_bool do_start, zend_bool do_end TSRMLS_DC)
{
Bytef *buffer;
uInt prev_outlen, outlen;
@@ -1043,7 +1035,7 @@ static int php_do_deflate(uint str_length, Bytef **p_buffer, uint *p_buffer_len,
int php_deflate_string(const char *str, uint str_length, char **newstr, uint *new_length, int coding, zend_bool do_start, zend_bool do_end)
{
int err;
- ZLIBLS_FETCH();
+ TSRMLS_FETCH();
ZLIBG(compression_coding) = coding;
@@ -1080,7 +1072,7 @@ int php_deflate_string(const char *str, uint str_length, char **newstr, uint *ne
ZLIBG(crc) = crc32(ZLIBG(crc), (const Bytef *) str, str_length);
}
- err = php_do_deflate(str_length, (Bytef **) newstr, new_length, do_start, do_end ZLIBLS_CC);
+ err = php_do_deflate(str_length, (Bytef **) newstr, new_length, do_start, do_end TSRMLS_CC);
/* TODO: error handling (err may be Z_STREAM_ERROR, Z_BUF_ERROR, ?) */
if (do_start) {
@@ -1159,7 +1151,6 @@ PHP_FUNCTION(ob_gzhandler)
zval **data, **a_encoding;
zend_bool return_original=0;
zend_bool do_start, do_end;
- ZLIBLS_FETCH();
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &zv_string, &zv_mode)==FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -1242,7 +1233,7 @@ PHP_FUNCTION(ob_gzhandler)
static void php_gzip_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode)
{
zend_bool do_start, do_end;
- ZLIBLS_FETCH();
+ TSRMLS_FETCH();
do_start = (mode & PHP_OUTPUT_HANDLER_START ? 1 : 0);
do_end = (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0);
@@ -1258,7 +1249,6 @@ int php_enable_output_compression(int buffer_size)
{
zval **a_encoding, **data;
TSRMLS_FETCH();
- ZLIBLS_FETCH();
if (zend_hash_find(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), (void **) &data)==FAILURE
|| Z_TYPE_PP(data)!=IS_ARRAY