diff options
159 files changed, 1277 insertions, 2245 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(®(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(®(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(¤t, &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(¤t); } @@ -428,7 +427,7 @@ PS_SERIALIZER_DECODE_FUNC(php) if (has_value) { MAKE_STD_ZVAL(current); if (php_var_unserialize(¤t, &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(¤t); } @@ -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(®(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(®(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 diff --git a/main/SAPI.c b/main/SAPI.c index 466e673de3..618f16f140 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -50,7 +50,7 @@ sapi_globals_struct sapi_globals; static void sapi_globals_ctor(sapi_globals_struct *sapi_globals TSRMLS_DC) { - memset(sapi_globals,0,sizeof(*sapi_globals)); + memset(sapi_globals, 0, sizeof(*sapi_globals)); } /* True globals (no need for thread safety) */ @@ -101,10 +101,10 @@ SAPI_API void sapi_free_header(sapi_header_struct *sapi_header) } -SAPI_API void sapi_handle_post(void *arg SLS_DC) +SAPI_API void sapi_handle_post(void *arg TSRMLS_DC) { if (SG(request_info).post_entry && SG(request_info).content_type_dup) { - SG(request_info).post_entry->post_handler(SG(request_info).content_type_dup, arg SLS_CC); + SG(request_info).post_entry->post_handler(SG(request_info).content_type_dup, arg TSRMLS_CC); if (SG(request_info).post_data) { efree(SG(request_info).post_data); SG(request_info).post_data = NULL; @@ -114,15 +114,14 @@ SAPI_API void sapi_handle_post(void *arg SLS_DC) } } -static void sapi_read_post_data(SLS_D) +static void sapi_read_post_data(TSRMLS_D) { sapi_post_entry *post_entry; uint content_type_length = strlen(SG(request_info).content_type); char *content_type = estrndup(SG(request_info).content_type, content_type_length); char *p; char oldchar=0; - void (*post_reader_func)(SLS_D); - PLS_FETCH(); + void (*post_reader_func)(TSRMLS_D); /* dedicated implementation for increased performance: @@ -158,10 +157,10 @@ static void sapi_read_post_data(SLS_D) if (oldchar) { *(p-1) = oldchar; } - post_reader_func(SLS_C); + post_reader_func(TSRMLS_C); SG(request_info).content_type_dup = content_type; if(PG(always_populate_raw_post_data) && sapi_module.default_post_reader) { - sapi_module.default_post_reader(SLS_C); + sapi_module.default_post_reader(TSRMLS_C); } } @@ -179,7 +178,7 @@ SAPI_POST_READER_FUNC(sapi_read_standard_form_data) SG(request_info).post_data = emalloc(allocated_bytes); for (;;) { - read_bytes = sapi_module.read_post(SG(request_info).post_data+SG(read_post_bytes), SAPI_POST_BLOCK_SIZE SLS_CC); + read_bytes = sapi_module.read_post(SG(request_info).post_data+SG(read_post_bytes), SAPI_POST_BLOCK_SIZE TSRMLS_CC); if (read_bytes<=0) { break; } @@ -201,7 +200,7 @@ SAPI_POST_READER_FUNC(sapi_read_standard_form_data) } -SAPI_API char *sapi_get_default_content_type(SLS_D) +SAPI_API char *sapi_get_default_content_type(TSRMLS_D) { char *mimetype, *charset, *content_type; @@ -219,9 +218,9 @@ SAPI_API char *sapi_get_default_content_type(SLS_D) } -SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header SLS_DC) +SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header TSRMLS_DC) { - char *default_content_type = sapi_get_default_content_type(SLS_C); + char *default_content_type = sapi_get_default_content_type(TSRMLS_C); int default_content_type_len = strlen(default_content_type); default_header->header_len = (sizeof("Content-type: ")-1) + default_content_type_len; @@ -243,7 +242,7 @@ SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_h * unchanged, 0 is returned. * */ -SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len SLS_DC) +SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len TSRMLS_DC) { char *charset, *newtype; size_t newlen; @@ -267,7 +266,7 @@ SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len SLS_DC) /* * Called from php_request_startup() for every request. */ -SAPI_API void sapi_activate(SLS_D) +SAPI_API void sapi_activate(TSRMLS_D) { zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *)) sapi_free_header, 0); SG(sapi_headers).send_default_content_type = 1; @@ -300,20 +299,20 @@ SAPI_API void sapi_activate(SLS_D) sapi_module.sapi_error(E_WARNING, "No content-type in POST request"); SG(request_info).content_type_dup = NULL; } else { - sapi_read_post_data(SLS_C); + sapi_read_post_data(TSRMLS_C); } } else { SG(request_info).content_type_dup = NULL; } - SG(request_info).cookie_data = sapi_module.read_cookies(SLS_C); + SG(request_info).cookie_data = sapi_module.read_cookies(TSRMLS_C); if (sapi_module.activate) { - sapi_module.activate(SLS_C); + sapi_module.activate(TSRMLS_C); } } } -SAPI_API void sapi_deactivate(SLS_D) +SAPI_API void sapi_deactivate(TSRMLS_D) { zend_llist_destroy(&SG(sapi_headers).headers); if (SG(request_info).post_data) { @@ -332,15 +331,15 @@ SAPI_API void sapi_deactivate(SLS_D) efree(SG(request_info).current_user); } if (sapi_module.deactivate) { - sapi_module.deactivate(SLS_C); + sapi_module.deactivate(TSRMLS_C); } if (SG(rfc1867_uploaded_files)) { - destroy_uploaded_files_hash(SLS_C); + destroy_uploaded_files_hash(TSRMLS_C); } } -SAPI_API void sapi_initialize_empty_request(SLS_D) +SAPI_API void sapi_initialize_empty_request(TSRMLS_D) { SG(server_context) = NULL; SG(request_info).request_method = NULL; @@ -372,7 +371,7 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo int retval, free_header = 0; sapi_header_struct sapi_header; char *colon_offset; - SLS_FETCH(); + TSRMLS_FETCH(); if (SG(headers_sent) && !SG(request_info).no_headers) { char *output_start_filename = php_get_output_start_filename(); @@ -421,7 +420,7 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo ptr++; } mimetype = estrdup(ptr); - newlen = sapi_apply_default_charset(&mimetype, len SLS_CC); + newlen = sapi_apply_default_charset(&mimetype, len TSRMLS_CC); if (newlen != 0) { newlen += sizeof("Content-type: "); newheader = emalloc(newlen); @@ -449,7 +448,7 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo } if (sapi_module.header_handler) { - retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers) SLS_CC); + retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers) TSRMLS_CC); } else { retval = SAPI_HEADER_ADD; } @@ -470,7 +469,7 @@ SAPI_API int sapi_send_headers() { int retval; int ret = FAILURE; - SLS_FETCH(); + TSRMLS_FETCH(); if (SG(headers_sent) || SG(request_info).no_headers) { return SUCCESS; @@ -482,7 +481,7 @@ SAPI_API int sapi_send_headers() SG(headers_sent) = 1; if (sapi_module.send_headers) { - retval = sapi_module.send_headers(&SG(sapi_headers) SLS_CC); + retval = sapi_module.send_headers(&SG(sapi_headers) TSRMLS_CC); } else { retval = SAPI_HEADER_DO_SEND; } @@ -503,7 +502,7 @@ SAPI_API int sapi_send_headers() if(SG(sapi_headers).send_default_content_type) { sapi_header_struct default_header; - sapi_get_default_content_type_header(&default_header SLS_CC); + sapi_get_default_content_type_header(&default_header TSRMLS_CC); sapi_module.send_header(&default_header, SG(server_context)); sapi_free_header(&default_header); } @@ -549,7 +548,7 @@ SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry) } -SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(SLS_D)) +SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D)) { sapi_module.default_post_reader = default_post_reader; return SUCCESS; @@ -559,7 +558,7 @@ SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(SLS_D SAPI_API int sapi_flush() { if (sapi_module.flush) { - SLS_FETCH(); + TSRMLS_FETCH(); sapi_module.flush(SG(server_context)); return SUCCESS; @@ -570,10 +569,10 @@ SAPI_API int sapi_flush() SAPI_API struct stat *sapi_get_stat() { - SLS_FETCH(); + TSRMLS_FETCH(); if (sapi_module.get_stat) { - return sapi_module.get_stat(SLS_C); + return sapi_module.get_stat(TSRMLS_C); } else { if (!SG(request_info).path_translated || (VCWD_STAT(SG(request_info).path_translated, &SG(global_stat))==-1)) { return NULL; @@ -586,9 +585,9 @@ SAPI_API struct stat *sapi_get_stat() SAPI_API char *sapi_getenv(char *name, size_t name_len) { if (sapi_module.getenv) { - SLS_FETCH(); + TSRMLS_FETCH(); - return sapi_module.getenv(name, name_len SLS_CC); + return sapi_module.getenv(name, name_len TSRMLS_CC); } else { return NULL; } diff --git a/main/SAPI.h b/main/SAPI.h index 00103225fc..85dd8a2079 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -116,49 +116,39 @@ typedef struct { #ifdef ZTS -# define SLS_D sapi_globals_struct *sapi_globals -# define SLS_DC , SLS_D -# define SLS_C sapi_globals -# define SLS_CC , SLS_C -# define SG(v) (sapi_globals->v) -# define SLS_FETCH() sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id) +# define SG(v) TSRMG(sapi_globals_id, sapi_globals_struct *, v) SAPI_API extern int sapi_globals_id; #else -# define SLS_D void -# define SLS_DC -# define SLS_C -# define SLS_CC # define SG(v) (sapi_globals.v) -# define SLS_FETCH() extern SAPI_API sapi_globals_struct sapi_globals; #endif SAPI_API void sapi_startup(sapi_module_struct *sf); SAPI_API void sapi_shutdown(void); -SAPI_API void sapi_activate(SLS_D); -SAPI_API void sapi_deactivate(SLS_D); -SAPI_API void sapi_initialize_empty_request(SLS_D); +SAPI_API void sapi_activate(TSRMLS_D); +SAPI_API void sapi_deactivate(TSRMLS_D); +SAPI_API void sapi_initialize_empty_request(TSRMLS_D); SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace); #define sapi_add_header(header_line, header_line_len, duplicate) \ sapi_add_header_ex((header_line), (header_line_len), (duplicate), 1) SAPI_API int sapi_send_headers(void); SAPI_API void sapi_free_header(sapi_header_struct *sapi_header); -SAPI_API void sapi_handle_post(void *arg SLS_DC); +SAPI_API void sapi_handle_post(void *arg TSRMLS_DC); SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entry); SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry); SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry); -SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(SLS_D)); +SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D)); SAPI_API int sapi_flush(void); SAPI_API struct stat *sapi_get_stat(void); SAPI_API char *sapi_getenv(char *name, size_t name_len); -SAPI_API char *sapi_get_default_content_type(SLS_D); -SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header SLS_DC); -SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len SLS_DC); +SAPI_API char *sapi_get_default_content_type(TSRMLS_D); +SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header TSRMLS_DC); +SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len TSRMLS_DC); struct _sapi_module_struct { char *name; @@ -167,24 +157,24 @@ struct _sapi_module_struct { int (*startup)(struct _sapi_module_struct *sapi_module); int (*shutdown)(struct _sapi_module_struct *sapi_module); - int (*activate)(SLS_D); - int (*deactivate)(SLS_D); + int (*activate)(TSRMLS_D); + int (*deactivate)(TSRMLS_D); int (*ub_write)(const char *str, unsigned int str_length); void (*flush)(void *server_context); - struct stat *(*get_stat)(SLS_D); - char *(*getenv)(char *name, size_t name_len SLS_DC); + struct stat *(*get_stat)(TSRMLS_D); + char *(*getenv)(char *name, size_t name_len TSRMLS_DC); void (*sapi_error)(int type, const char *error_msg, ...); - int (*header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC); - int (*send_headers)(sapi_headers_struct *sapi_headers SLS_DC); + int (*header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC); + int (*send_headers)(sapi_headers_struct *sapi_headers TSRMLS_DC); void (*send_header)(sapi_header_struct *sapi_header, void *server_context); - int (*read_post)(char *buffer, uint count_bytes SLS_DC); - char *(*read_cookies)(SLS_D); + int (*read_post)(char *buffer, uint count_bytes TSRMLS_DC); + char *(*read_cookies)(TSRMLS_D); - void (*register_server_variables)(zval *track_vars_array TSRMLS_DC SLS_DC PLS_DC); + void (*register_server_variables)(zval *track_vars_array TSRMLS_DC); void (*log_message)(char *message); char *php_ini_path_override; @@ -192,15 +182,15 @@ struct _sapi_module_struct { void (*block_interruptions)(void); void (*unblock_interruptions)(void); - void (*default_post_reader)(SLS_D); + void (*default_post_reader)(TSRMLS_D); }; struct _sapi_post_entry { char *content_type; uint content_type_len; - void (*post_reader)(SLS_D); - void (*post_handler)(char *content_type_dup, void *arg SLS_DC); + void (*post_reader)(TSRMLS_D); + void (*post_handler)(char *content_type_dup, void *arg TSRMLS_DC); }; /* header_handler() constants */ @@ -217,8 +207,8 @@ struct _sapi_post_entry { #define SAPI_DEFAULT_CHARSET "" #define SAPI_PHP_VERSION_HEADER "X-Powered-By: PHP/" PHP_VERSION -#define SAPI_POST_READER_FUNC(post_reader) SAPI_API void post_reader(SLS_D) -#define SAPI_POST_HANDLER_FUNC(post_handler) SAPI_API void post_handler(char *content_type_dup, void *arg SLS_DC) +#define SAPI_POST_READER_FUNC(post_reader) SAPI_API void post_reader(TSRMLS_D) +#define SAPI_POST_HANDLER_FUNC(post_handler) SAPI_API void post_handler(char *content_type_dup, void *arg TSRMLS_DC) SAPI_POST_READER_FUNC(sapi_read_standard_form_data); SAPI_POST_READER_FUNC(php_default_post_reader); diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index ea1bc7a8dd..f1271ad0a4 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -92,7 +92,7 @@ HashTable fopen_url_wrappers_hash; */ PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)) { - PLS_FETCH(); + TSRMLS_FETCH(); if(PG(allow_url_fopen)) { return zend_hash_add(&fopen_url_wrappers_hash, protocol, strlen(protocol), &wrapper, sizeof(wrapper), NULL); @@ -106,7 +106,7 @@ PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path */ PHPAPI int php_unregister_url_wrapper(char *protocol) { - PLS_FETCH(); + TSRMLS_FETCH(); if(PG(allow_url_fopen)) { return zend_hash_del(&fopen_url_wrappers_hash, protocol, strlen(protocol)); @@ -120,7 +120,7 @@ PHPAPI int php_unregister_url_wrapper(char *protocol) */ int php_init_fopen_wrappers(void) { - PLS_FETCH(); + TSRMLS_FETCH(); if(PG(allow_url_fopen)) return zend_hash_init(&fopen_url_wrappers_hash, 0, NULL, NULL, 1); @@ -133,7 +133,7 @@ int php_init_fopen_wrappers(void) */ int php_shutdown_fopen_wrappers(void) { - PLS_FETCH(); + TSRMLS_FETCH(); if(PG(allow_url_fopen)) { zend_hash_destroy(&fopen_url_wrappers_hash); @@ -149,13 +149,12 @@ int php_shutdown_fopen_wrappers(void) When open_basedir is NULL, always return 0 */ -PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC) +PHPAPI int php_check_specific_open_basedir(char *basedir, char *path TSRMLS_DC) { char resolved_name[MAXPATHLEN]; char resolved_basedir[MAXPATHLEN]; char local_open_basedir[MAXPATHLEN]; int local_open_basedir_pos; - SLS_FETCH(); /* Special case basedir==".": Use script-directory */ if ((strcmp(basedir, ".") == 0) && @@ -199,7 +198,7 @@ PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC) */ PHPAPI int php_check_open_basedir(char *path) { - PLS_FETCH(); + TSRMLS_FETCH(); /* Only check when open_basedir is available */ if (PG(open_basedir) && *PG(open_basedir)) { @@ -218,7 +217,7 @@ PHPAPI int php_check_open_basedir(char *path) end++; } - if (php_check_specific_open_basedir(ptr, path PLS_CC) == 0) { + if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) { efree(pathbuf); return 0; } @@ -257,7 +256,7 @@ static FILE *php_fopen_and_set_opened_path(const char *path, char *mode, char ** */ PHPAPI FILE *php_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path) { - PLS_FETCH(); + TSRMLS_FETCH(); if(!path) return NULL; if(!*path) return NULL; @@ -291,8 +290,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle) struct stat st; char *path_info, *filename; int length; - PLS_FETCH(); - SLS_FETCH(); + TSRMLS_FETCH(); filename = SG(request_info).path_translated; path_info = SG(request_info).request_uri; @@ -400,7 +398,6 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char ** int filename_length; int safe_mode_include_dir_length; int exec_fname_length; - PLS_FETCH(); TSRMLS_FETCH(); if (opened_path) { @@ -560,7 +557,7 @@ static FILE *php_fopen_url_wrapper(const char *path, char *mode, int options, in } if (!protocol || !strncasecmp(protocol, "file",n)){ - PLS_FETCH(); + TSRMLS_FETCH(); *issock = 0; diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h index ee0040e338..18a8610c03 100644 --- a/main/fopen_wrappers.h +++ b/main/fopen_wrappers.h @@ -70,7 +70,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle); PHPAPI char *expand_filepath(const char *filepath, char *real_path); PHPAPI int php_check_open_basedir(char *path); -PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC); +PHPAPI int php_check_specific_open_basedir(char *basedir, char *path TSRMLS_DC); PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path); diff --git a/main/main.c b/main/main.c index 40a22ff498..41ea7053d8 100644 --- a/main/main.c +++ b/main/main.c @@ -83,7 +83,7 @@ php_core_globals core_globals; PHPAPI int core_globals_id; #endif -static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC PLS_DC); +static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC); #define SAFE_FILENAME(f) ((f)?(f):"-") @@ -275,7 +275,7 @@ PHPAPI void php_log_err(char *log_message) char error_time_str[128]; struct tm tmbuf; time_t error_time; - PLS_FETCH(); + TSRMLS_FETCH(); /* Try to use the specified logging location. */ if (PG(error_log) != NULL) { @@ -344,7 +344,6 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ char buffer[1024]; int buffer_len; TSRMLS_FETCH(); - PLS_FETCH(); buffer_len = vsnprintf(buffer, sizeof(buffer)-1, format, args); buffer[sizeof(buffer)-1]=0; @@ -480,7 +479,6 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ PHP_FUNCTION(set_time_limit) { zval **new_timeout; - PLS_FETCH(); if (PG(safe_mode)) { php_error(E_WARNING, "Cannot set time limit in safe mode"); @@ -537,13 +535,13 @@ static void php_message_handler_for_zend(long message, void *data) { switch (message) { case ZMSG_FAILED_INCLUDE_FOPEN: { - PLS_FETCH(); + TSRMLS_FETCH(); php_error(E_WARNING, "Failed opening '%s' for inclusion (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); } break; case ZMSG_FAILED_REQUIRE_FOPEN: { - PLS_FETCH(); + TSRMLS_FETCH(); php_error(E_COMPILE_ERROR, "Failed opening required '%s' (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); } @@ -558,7 +556,7 @@ static void php_message_handler_for_zend(long message, void *data) if (EG(error_reporting)&E_WARNING) { #if ZEND_DEBUG char memory_leak_buf[512]; - SLS_FETCH(); + TSRMLS_FETCH(); if (message==ZMSG_MEMORY_LEAK_DETECTED) { zend_mem_header *t = (zend_mem_header *) data; @@ -589,7 +587,7 @@ static void php_message_handler_for_zend(long message, void *data) struct tm *ta, tmbuf; time_t curtime; char *datetime_str, asctimebuf[52]; - SLS_FETCH(); + TSRMLS_FETCH(); time(&curtime); ta = php_localtime_r(&curtime, &tmbuf); @@ -614,11 +612,11 @@ static void sigchld_handler(int apar) /* }}} */ #endif -static int php_hash_environment(TSRMLS_D SLS_DC PLS_DC); +static int php_hash_environment(TSRMLS_D); /* {{{ php_request_startup */ -int php_request_startup(CLS_D TSRMLS_DC PLS_DC SLS_DC) +int php_request_startup(TSRMLS_D) { int retval = SUCCESS; @@ -636,8 +634,8 @@ int php_request_startup(CLS_D TSRMLS_DC PLS_DC SLS_DC) PG(header_is_being_sent) = 0; PG(connection_status) = PHP_CONNECTION_NORMAL; - zend_activate(CLS_C TSRMLS_CC); - sapi_activate(SLS_C); + zend_activate(TSRMLS_C); + sapi_activate(TSRMLS_C); zend_set_timeout(EG(timeout_seconds)); @@ -662,7 +660,7 @@ int php_request_startup(CLS_D TSRMLS_DC PLS_DC SLS_DC) /* We turn this off in php_execute_script() */ /* PG(during_request_startup) = 0; */ - php_hash_environment(TSRMLS_C SLS_CC PLS_CC); + php_hash_environment(TSRMLS_C); zend_activate_modules(); PG(modules_activated)=1; } zend_catch { @@ -687,10 +685,7 @@ void php_request_shutdown_for_exec(void *dummy) */ void php_request_shutdown(void *dummy) { - CLS_FETCH(); TSRMLS_FETCH(); - SLS_FETCH(); - PLS_FETCH(); zend_try { php_end_ob_buffers((zend_bool)(SG(request_info).headers_only?0:1)); @@ -708,10 +703,10 @@ void php_request_shutdown(void *dummy) zend_deactivate_modules(); } - zend_deactivate(CLS_C TSRMLS_CC); + zend_deactivate(TSRMLS_C); zend_try { - sapi_deactivate(SLS_C); + sapi_deactivate(TSRMLS_C); } zend_end_try(); zend_try { @@ -780,6 +775,7 @@ int php_module_startup(sapi_module_struct *sf) #ifdef ZTS zend_executor_globals *executor_globals; void ***tsrm_ls; + php_core_globals *core_globals; sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id); #endif @@ -802,8 +798,12 @@ int php_module_startup(sapi_module_struct *sf) php_os=PHP_OS; #endif - sapi_initialize_empty_request(SLS_C); - sapi_activate(SLS_C); +#ifdef ZTS + tsrm_ls = ts_resource(0); +#endif + + sapi_initialize_empty_request(TSRMLS_C); + sapi_activate(TSRMLS_C); if (module_initialized) { return SUCCESS; @@ -827,7 +827,6 @@ int php_module_startup(sapi_module_struct *sf) #ifdef ZTS executor_globals = ts_resource(executor_globals_id); - tsrm_ls = ts_resource(0); ts_allocate_id(&core_globals_id, sizeof(php_core_globals), (ts_allocate_ctor) core_globals_ctor, NULL); core_globals = ts_resource(core_globals_id); #endif @@ -898,7 +897,7 @@ int php_module_startup(sapi_module_struct *sf) REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_PATH", PHP_CONFIG_FILE_PATH, sizeof(PHP_CONFIG_FILE_PATH)-1, CONST_PERSISTENT | CONST_CS); php_output_register_constants(); - if (php_startup_ticks(PLS_C) == FAILURE) { + if (php_startup_ticks(TSRMLS_C) == FAILURE) { php_printf("Unable to start PHP ticks\n"); return FAILURE; } @@ -925,7 +924,7 @@ int php_module_startup(sapi_module_struct *sf) /* */ module_initialized = 1; - sapi_deactivate(SLS_C); + sapi_deactivate(TSRMLS_C); /* we're done */ return SUCCESS; @@ -951,7 +950,7 @@ int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals) void php_module_shutdown() { int module_number=0; /* for UNREGISTER_INI_ENTRIES() */ - PLS_FETCH(); + TSRMLS_FETCH(); if (!module_initialized) { return; @@ -965,7 +964,7 @@ void php_module_shutdown() WSACleanup(); #endif - php_shutdown_ticks(PLS_C); + php_shutdown_ticks(TSRMLS_C); sapi_flush(); zend_shutdown(); @@ -982,7 +981,7 @@ void php_module_shutdown() /* {{{ php_register_server_variables */ -static inline void php_register_server_variables(TSRMLS_D SLS_DC PLS_DC) +static inline void php_register_server_variables(TSRMLS_D) { zval *array_ptr=NULL; @@ -993,27 +992,27 @@ static inline void php_register_server_variables(TSRMLS_D SLS_DC PLS_DC) /* Server variables */ if (sapi_module.register_server_variables) { - sapi_module.register_server_variables(array_ptr TSRMLS_CC SLS_CC PLS_CC); + sapi_module.register_server_variables(array_ptr TSRMLS_CC); } /* argv/argc support */ if (PG(register_argc_argv)) { - php_build_argv(SG(request_info).query_string, array_ptr TSRMLS_CC PLS_CC); + php_build_argv(SG(request_info).query_string, array_ptr TSRMLS_CC); } /* PHP Authentication support */ if (SG(request_info).auth_user) { - php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, array_ptr TSRMLS_CC PLS_CC); + php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, array_ptr TSRMLS_CC); } if (SG(request_info).auth_password) { - php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, array_ptr TSRMLS_CC PLS_CC); + php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, array_ptr TSRMLS_CC); } } /* }}} */ /* {{{ php_hash_environment */ -static int php_hash_environment(TSRMLS_D SLS_DC PLS_DC) +static int php_hash_environment(TSRMLS_D) { char *p; unsigned char _gpc_flags[3] = {0,0,0}; @@ -1053,7 +1052,7 @@ static int php_hash_environment(TSRMLS_D SLS_DC PLS_DC) ALLOC_ZVAL(PG(http_globals)[TRACK_VARS_ENV]); array_init(PG(http_globals)[TRACK_VARS_ENV]); INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]); - php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC PLS_CC); + php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC); } while(p && *p) { @@ -1061,21 +1060,21 @@ static int php_hash_environment(TSRMLS_D SLS_DC PLS_DC) case 'p': case 'P': if (!_gpc_flags[0] && !SG(headers_sent) && SG(request_info).request_method && !strcasecmp(SG(request_info).request_method, "POST")) { - php_treat_data(PARSE_POST, NULL, NULL TSRMLS_CC PLS_CC SLS_CC); /* POST Data */ + php_treat_data(PARSE_POST, NULL, NULL TSRMLS_CC); /* POST Data */ _gpc_flags[0]=1; } break; case 'c': case 'C': if (!_gpc_flags[1]) { - php_treat_data(PARSE_COOKIE, NULL, NULL TSRMLS_CC PLS_CC SLS_CC); /* Cookie Data */ + php_treat_data(PARSE_COOKIE, NULL, NULL TSRMLS_CC); /* Cookie Data */ _gpc_flags[1]=1; } break; case 'g': case 'G': if (!_gpc_flags[2]) { - php_treat_data(PARSE_GET, NULL, NULL TSRMLS_CC PLS_CC SLS_CC); /* GET Data */ + php_treat_data(PARSE_GET, NULL, NULL TSRMLS_CC); /* GET Data */ _gpc_flags[2]=1; } break; @@ -1085,20 +1084,20 @@ static int php_hash_environment(TSRMLS_D SLS_DC PLS_DC) ALLOC_ZVAL(PG(http_globals)[TRACK_VARS_ENV]); array_init(PG(http_globals)[TRACK_VARS_ENV]); INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]); - php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC PLS_CC); + php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC); } else { php_error(E_WARNING, "Unsupported 'e' element (environment) used in gpc_order - use variables_order instead"); } break; case 's': case 'S': - php_register_server_variables(TSRMLS_C SLS_CC PLS_CC); + php_register_server_variables(TSRMLS_C); break; } } if (!have_variables_order) { - php_register_server_variables(TSRMLS_C SLS_CC PLS_CC); + php_register_server_variables(TSRMLS_C); } for (i=0; i<6; i++) { @@ -1121,7 +1120,7 @@ static int php_hash_environment(TSRMLS_D SLS_DC PLS_DC) /* {{{ php_build_argv */ -static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC PLS_DC) +static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) { pval *arr, *argc, *tmp; int count = 0; @@ -1180,7 +1179,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC PLS_DC) /* {{{ php_handle_special_queries */ -PHPAPI int php_handle_special_queries(SLS_D PLS_DC) +PHPAPI int php_handle_special_queries(TSRMLS_D) { if (SG(request_info).query_string && SG(request_info).query_string[0]=='=' && PG(expose_php)) { @@ -1197,15 +1196,14 @@ PHPAPI int php_handle_special_queries(SLS_D PLS_DC) /* {{{ php_execute_script */ -PHPAPI int php_execute_script(zend_file_handle *primary_file CLS_DC TSRMLS_DC PLS_DC) +PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) { zend_file_handle *prepend_file_p, *append_file_p; zend_file_handle prepend_file, append_file; char *old_cwd; - SLS_FETCH(); EG(exit_status) = 0; - if (php_handle_special_queries(SLS_C PLS_CC)) { + if (php_handle_special_queries(TSRMLS_C)) { return 0; } #define OLD_CWD_SIZE 4096 @@ -1243,7 +1241,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file CLS_DC TSRMLS_DC PL } else { append_file_p = NULL; } - zend_execute_scripts(ZEND_REQUIRE CLS_CC TSRMLS_CC, 3, prepend_file_p, primary_file, append_file_p); + zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, 3, prepend_file_p, primary_file, append_file_p); } zend_end_try(); if (old_cwd[0] != '\0') { @@ -1258,7 +1256,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file CLS_DC TSRMLS_DC PL */ PHPAPI void php_handle_aborted_connection(void) { - PLS_FETCH(); + TSRMLS_FETCH(); PG(connection_status) = PHP_CONNECTION_ABORTED; php_output_set_status(0); @@ -1271,7 +1269,7 @@ PHPAPI void php_handle_aborted_connection(void) /* {{{ php_handle_auth_data */ -PHPAPI int php_handle_auth_data(const char *auth SLS_DC) +PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC) { int ret = -1; @@ -1303,13 +1301,13 @@ PHPAPI int php_handle_auth_data(const char *auth SLS_DC) /* {{{ php_lint_script */ -PHPAPI int php_lint_script(zend_file_handle *file CLS_DC TSRMLS_DC PLS_DC) +PHPAPI int php_lint_script(zend_file_handle *file TSRMLS_DC) { zend_op_array *op_array; zend_try { - op_array = zend_compile_file(file, ZEND_INCLUDE CLS_CC); - zend_destroy_file_handle(file CLS_CC); + op_array = zend_compile_file(file, ZEND_INCLUDE TSRMLS_CC); + zend_destroy_file_handle(file TSRMLS_CC); if (op_array) { destroy_op_array(op_array); diff --git a/main/output.c b/main/output.c index 9ded7e65e4..562c28702c 100644 --- a/main/output.c +++ b/main/output.c @@ -50,7 +50,7 @@ static int php_default_output_func(const char *str, uint str_len) } -static void php_output_init_globals(OLS_D TSRMLS_DC) +static void php_output_init_globals(php_output_globals *output_globals_p TSRMLS_DC) { OG(php_body_write) = php_default_output_func; OG(php_header_write) = php_default_output_func; @@ -66,14 +66,14 @@ PHPAPI void php_output_startup(void) #ifdef ZTS ts_allocate_id(&output_globals_id, sizeof(php_output_globals), (ts_allocate_ctor) php_output_init_globals, NULL); #else - php_output_init_globals(OLS_C TSRMLS_CC); + php_output_init_globals(&output_globals TSRMLS_CC); #endif } PHPAPI void php_output_activate(void) { - OLS_FETCH(); + TSRMLS_FETCH(); OG(php_body_write) = php_ub_body_write; OG(php_header_write) = sapi_module.ub_write; @@ -85,7 +85,7 @@ PHPAPI void php_output_activate(void) PHPAPI void php_output_set_status(zend_bool status) { - OLS_FETCH(); + TSRMLS_FETCH(); OG(disable_output) = !status; } @@ -103,13 +103,13 @@ void php_output_register_constants() PHPAPI int php_body_write(const char *str, uint str_length) { - OLS_FETCH(); + TSRMLS_FETCH(); return OG(php_body_write)(str, str_length); } PHPAPI int php_header_write(const char *str, uint str_length) { - OLS_FETCH(); + TSRMLS_FETCH(); if (OG(disable_output)) { return 0; } else { @@ -121,7 +121,7 @@ PHPAPI int php_header_write(const char *str, uint str_length) * Start output buffering */ PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size) { - OLS_FETCH(); + TSRMLS_FETCH(); if (OG(ob_lock)) { return FAILURE; @@ -146,8 +146,7 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush) char *to_be_destroyed_buffer; char *to_be_destroyed_handled_output[2] = { 0, 0 }; int status; - SLS_FETCH(); - OLS_FETCH(); + TSRMLS_FETCH(); if (OG(ob_nesting_level)==0) { return; @@ -171,7 +170,7 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush) zval **params[2]; zval *orig_buffer; zval *z_status; - CLS_FETCH(); + TSRMLS_FETCH(); ALLOC_INIT_ZVAL(orig_buffer); ZVAL_STRINGL(orig_buffer,OG(active_ob_buffer).buffer,OG(active_ob_buffer).text_length,0); @@ -263,8 +262,7 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush) * End output buffering (all buffers) */ PHPAPI void php_end_ob_buffers(zend_bool send_buffer) { - OLS_FETCH(); - BLS_FETCH(); + TSRMLS_FETCH(); while (OG(ob_nesting_level)!=0) { php_end_ob_buffer(send_buffer, 0); @@ -280,7 +278,7 @@ PHPAPI void php_end_ob_buffers(zend_bool send_buffer) */ PHPAPI void php_start_implicit_flush() { - OLS_FETCH(); + TSRMLS_FETCH(); php_end_ob_buffer(1, 0); /* Switch out of output buffering if we're in it */ OG(implicit_flush)=1; @@ -291,7 +289,7 @@ PHPAPI void php_start_implicit_flush() */ PHPAPI void php_end_implicit_flush() { - OLS_FETCH(); + TSRMLS_FETCH(); OG(implicit_flush)=0; } @@ -301,7 +299,7 @@ PHPAPI void php_end_implicit_flush() */ PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size) { - OLS_FETCH(); + TSRMLS_FETCH(); if (OG(ob_nesting_level)==0) { return; @@ -321,7 +319,7 @@ PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_outpu */ static inline void php_ob_allocate(void) { - OLS_FETCH(); + TSRMLS_FETCH(); if (OG(active_ob_buffer).size<OG(active_ob_buffer).text_length) { while (OG(active_ob_buffer).size <= OG(active_ob_buffer).text_length) { @@ -337,7 +335,7 @@ static inline void php_ob_allocate(void) */ static void php_ob_init(uint initial_size, uint block_size, zval *output_handler, uint chunk_size) { - OLS_FETCH(); + TSRMLS_FETCH(); if (OG(ob_nesting_level)>0) { if (OG(ob_nesting_level)==1) { /* initialize stack */ @@ -363,7 +361,7 @@ static void php_ob_append(const char *text, uint text_length) { char *target; int original_ob_text_length; - OLS_FETCH(); + TSRMLS_FETCH(); original_ob_text_length=OG(active_ob_buffer).text_length; OG(active_ob_buffer).text_length = OG(active_ob_buffer).text_length + text_length; @@ -390,7 +388,7 @@ static void php_ob_append(const char *text, uint text_length) static void php_ob_prepend(const char *text, uint text_length) { char *p, *start; - OLS_FETCH(); + TSRMLS_FETCH(); OG(active_ob_buffer).text_length += text_length; php_ob_allocate(); @@ -412,7 +410,7 @@ static void php_ob_prepend(const char *text, uint text_length) * Return the current output buffer */ int php_ob_get_buffer(pval *p) { - OLS_FETCH(); + TSRMLS_FETCH(); if (OG(ob_nesting_level)==0) { return FAILURE; @@ -426,7 +424,7 @@ int php_ob_get_buffer(pval *p) * Return the size of the current output buffer */ int php_ob_get_length(pval *p) { - OLS_FETCH(); + TSRMLS_FETCH(); if (OG(ob_nesting_level) == 0) { return FAILURE; @@ -455,8 +453,7 @@ static int php_ub_body_write_no_header(const char *str, uint str_length) char *newstr = NULL; size_t new_length=0; int result; - OLS_FETCH(); - BLS_FETCH(); + TSRMLS_FETCH(); if (OG(disable_output)) { return 0; @@ -485,8 +482,7 @@ static int php_ub_body_write_no_header(const char *str, uint str_length) static int php_ub_body_write(const char *str, uint str_length) { int result = 0; - SLS_FETCH(); - OLS_FETCH(); + TSRMLS_FETCH(); if (SG(request_info).headers_only) { php_header(); @@ -494,10 +490,10 @@ static int php_ub_body_write(const char *str, uint str_length) } if (php_header()) { if (zend_is_compiling()) { - CLS_FETCH(); + TSRMLS_FETCH(); - OG(output_start_filename) = zend_get_compiled_filename(CLS_C); - OG(output_start_lineno) = zend_get_compiled_lineno(CLS_C); + OG(output_start_filename) = zend_get_compiled_filename(TSRMLS_C); + OG(output_start_lineno) = zend_get_compiled_lineno(TSRMLS_C); } else if (zend_is_executing()) { TSRMLS_FETCH(); @@ -557,8 +553,7 @@ PHP_FUNCTION(ob_start) break; } if (php_start_ob_buffer(output_handler, chunk_size)==FAILURE) { - SLS_FETCH(); - OLS_FETCH(); + TSRMLS_FETCH(); if (SG(headers_sent) && !SG(request_info).headers_only) { OG(php_body_write) = php_ub_body_write_no_header; @@ -641,7 +636,7 @@ PHP_FUNCTION(ob_implicit_flush) PHPAPI char *php_get_output_start_filename() { - OLS_FETCH(); + TSRMLS_FETCH(); return OG(output_start_filename); } @@ -649,7 +644,7 @@ PHPAPI char *php_get_output_start_filename() PHPAPI int php_get_output_start_lineno() { - OLS_FETCH(); + TSRMLS_FETCH(); return OG(output_start_lineno); } diff --git a/main/php_content_types.c b/main/php_content_types.c index 902e5e9e0b..80ef9a8290 100644 --- a/main/php_content_types.c +++ b/main/php_content_types.c @@ -38,9 +38,8 @@ static sapi_post_entry php_post_entries[] = { SAPI_POST_READER_FUNC(php_default_post_reader) { char *data; - TSRMLS_FETCH(); - if(!SG(request_info).post_data) sapi_read_standard_form_data(SLS_C); + if(!SG(request_info).post_data) sapi_read_standard_form_data(TSRMLS_C); data = estrndup(SG(request_info).post_data,SG(request_info).post_data_length); SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, SG(request_info).post_data_length); } diff --git a/main/php_globals.h b/main/php_globals.h index bdcf3acc60..0499e8c133 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -25,20 +25,10 @@ typedef struct _php_core_globals php_core_globals; #ifdef ZTS -# define PLS_D php_core_globals *core_globals -# define PLS_DC , PLS_D -# define PLS_C core_globals -# define PLS_CC , PLS_C -# define PG(v) (core_globals->v) -# define PLS_FETCH() php_core_globals *core_globals = ts_resource(core_globals_id) +# define PG(v) TSRMG(core_globals_id, php_core_globals *, v) extern PHPAPI int core_globals_id; #else -# define PLS_D -# define PLS_DC -# define PLS_C -# define PLS_CC # define PG(v) (core_globals.v) -# define PLS_FETCH() extern ZEND_API struct _php_core_globals core_globals; #endif diff --git a/main/php_ini.c b/main/php_ini.c index 586298131c..5e2a54b87e 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -202,7 +202,7 @@ int php_init_config(char *php_ini_path_override) char *open_basedir; int free_ini_search_path=0; zend_file_handle fh; - PLS_FETCH(); + TSRMLS_FETCH(); if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1)==FAILURE) { return FAILURE; diff --git a/main/php_main.h b/main/php_main.h index ff371f5efa..304d199ff8 100644 --- a/main/php_main.h +++ b/main/php_main.h @@ -28,7 +28,7 @@ #include "php_globals.h" #include "SAPI.h" -PHPAPI int php_request_startup(CLS_D TSRMLS_DC PLS_DC SLS_DC); +PHPAPI int php_request_startup(TSRMLS_D); PHPAPI void php_request_shutdown(void *dummy); PHPAPI void php_request_shutdown_for_exec(void *dummy); PHPAPI int php_module_startup(sapi_module_struct *sf); @@ -38,12 +38,12 @@ PHPAPI int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals); PHPAPI int php_startup_extensions(zend_module_entry **ptr, int count); -PHPAPI int php_execute_script(zend_file_handle *primary_file CLS_DC TSRMLS_DC PLS_DC); -PHPAPI int php_handle_special_queries(SLS_D PLS_DC); -PHPAPI int php_lint_script(zend_file_handle *file CLS_DC TSRMLS_DC PLS_DC); +PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC); +PHPAPI int php_handle_special_queries(TSRMLS_D); +PHPAPI int php_lint_script(zend_file_handle *file TSRMLS_DC); PHPAPI void php_handle_aborted_connection(void); -PHPAPI int php_handle_auth_data(const char *auth SLS_DC); +PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC); extern void php_call_shutdown_functions(void); diff --git a/main/php_output.h b/main/php_output.h index 45d8c404a1..38211a5222 100644 --- a/main/php_output.h +++ b/main/php_output.h @@ -77,16 +77,10 @@ typedef struct _php_output_globals { #ifdef ZTS -#define OLS_D php_output_globals *output_globals -#define OLS_C output_globals -#define OG(v) (output_globals->v) -#define OLS_FETCH() php_output_globals *output_globals = ts_resource(output_globals_id) +#define OG(v) TSRMG(output_globals_id, php_output_globals *, v) ZEND_API extern int output_globals_id; #else -#define OLS_D void -#define OLS_C #define OG(v) (output_globals.v) -#define OLS_FETCH() ZEND_API extern php_output_globals output_globals; #endif diff --git a/main/php_ticks.c b/main/php_ticks.c index 95e63df322..de79d9cc84 100644 --- a/main/php_ticks.c +++ b/main/php_ticks.c @@ -21,13 +21,13 @@ #include "php.h" #include "php_ticks.h" -int php_startup_ticks(PLS_D) +int php_startup_ticks(TSRMLS_D) { zend_llist_init(&PG(tick_functions), sizeof(void(*)(int)), NULL, 1); return SUCCESS; } -void php_shutdown_ticks(PLS_D) +void php_shutdown_ticks(TSRMLS_D) { zend_llist_destroy(&PG(tick_functions)); } @@ -43,14 +43,14 @@ static int php_compare_tick_functions(void *elem1, void *elem2) PHPAPI void php_add_tick_function(void (*func)(int)) { - PLS_FETCH(); + TSRMLS_FETCH(); zend_llist_add_element(&PG(tick_functions), (void *)&func); } PHPAPI void php_remove_tick_function(void (*func)(int)) { - PLS_FETCH(); + TSRMLS_FETCH(); zend_llist_del_element(&PG(tick_functions), func, (int(*)(void*,void*))php_compare_tick_functions); @@ -66,7 +66,7 @@ static void php_tick_iterator(void *data, void *arg) void php_run_ticks(int count) { - PLS_FETCH(); + TSRMLS_FETCH(); zend_llist_apply_with_argument(&PG(tick_functions), (void(*)(void*,void*))php_tick_iterator, &count); } diff --git a/main/php_ticks.h b/main/php_ticks.h index 7259a68d55..d7c42bf037 100644 --- a/main/php_ticks.h +++ b/main/php_ticks.h @@ -21,8 +21,8 @@ #ifndef PHP_TICKS_H #define PHP_TICKS_H -int php_startup_ticks(PLS_D); -void php_shutdown_ticks(PLS_D); +int php_startup_ticks(TSRMLS_D); +void php_shutdown_ticks(TSRMLS_D); void php_run_ticks(int count); PHPAPI void php_add_tick_function(void (*func)(int)); PHPAPI void php_remove_tick_function(void (*func)(int)); diff --git a/main/php_variables.c b/main/php_variables.c index 9e0ae88a62..4a9c834d38 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -29,13 +29,13 @@ #include "zend_globals.h" -PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array TSRMLS_DC PLS_DC) +PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array TSRMLS_DC) { - php_register_variable_safe(var, strval, strlen(strval), track_vars_array TSRMLS_CC PLS_CC); + php_register_variable_safe(var, strval, strlen(strval), track_vars_array TSRMLS_CC); } /* binary-safe version */ -PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zval *track_vars_array TSRMLS_DC PLS_DC) +PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zval *track_vars_array TSRMLS_DC) { zval new_entry; @@ -48,11 +48,11 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva } new_entry.type = IS_STRING; - php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC); } -PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array TSRMLS_DC PLS_DC) +PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array TSRMLS_DC) { char *p = NULL; char *ip; /* index pointer */ @@ -196,8 +196,6 @@ SAPI_POST_HANDLER_FUNC(php_std_post_handler) char *var, *val; char *strtok_buf = NULL; zval *array_ptr = (zval *) arg; - TSRMLS_FETCH(); - PLS_FETCH(); var = php_strtok_r(SG(request_info).post_data, "&", &strtok_buf); @@ -209,14 +207,14 @@ SAPI_POST_HANDLER_FUNC(php_std_post_handler) *val++ = '\0'; php_url_decode(var, strlen(var)); val_len = php_url_decode(val, strlen(val)); - php_register_variable_safe(var, val, val_len, array_ptr TSRMLS_CC PLS_CC); + php_register_variable_safe(var, val, val_len, array_ptr TSRMLS_CC); } var = php_strtok_r(NULL, "&", &strtok_buf); } } -void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC PLS_DC SLS_DC) +void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC) { char *res = NULL, *var, *val, *separator=NULL; const char *c_var; @@ -249,7 +247,7 @@ void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC PLS_DC SLS_DC) } if (arg==PARSE_POST) { - sapi_handle_post(array_ptr SLS_CC); + sapi_handle_post(array_ptr TSRMLS_CC); return; } @@ -298,7 +296,7 @@ void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC PLS_DC SLS_DC) *val++ = '\0'; php_url_decode(var, strlen(var)); val_len = php_url_decode(val, strlen(val)); - php_register_variable_safe(var, val, val_len, array_ptr TSRMLS_CC PLS_CC); + php_register_variable_safe(var, val, val_len, array_ptr TSRMLS_CC); } var = php_strtok_r(NULL, separator, &strtok_buf); } @@ -313,7 +311,7 @@ void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC PLS_DC SLS_DC) } -void php_import_environment_variables(zval *array_ptr TSRMLS_DC PLS_DC) +void php_import_environment_variables(zval *array_ptr TSRMLS_DC) { char **env, *p, *t; @@ -323,7 +321,7 @@ void php_import_environment_variables(zval *array_ptr TSRMLS_DC PLS_DC) continue; } t = estrndup(*env, p - *env); - php_register_variable(t, p+1, array_ptr TSRMLS_CC PLS_CC); + php_register_variable(t, p+1, array_ptr TSRMLS_CC); efree(t); } } diff --git a/main/php_variables.h b/main/php_variables.h index 03c47db216..c20ed1f5e1 100644 --- a/main/php_variables.h +++ b/main/php_variables.h @@ -30,12 +30,12 @@ #define PARSE_COOKIE 2 #define PARSE_STRING 3 -void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC PLS_DC SLS_DC); -PHPAPI void php_import_environment_variables(zval *array_ptr TSRMLS_DC PLS_DC); -PHPAPI void php_register_variable(char *var, char *val, pval *track_vars_array TSRMLS_DC PLS_DC); +void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC); +PHPAPI void php_import_environment_variables(zval *array_ptr TSRMLS_DC); +PHPAPI void php_register_variable(char *var, char *val, pval *track_vars_array TSRMLS_DC); /* binary-safe version */ -PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, pval *track_vars_array TSRMLS_DC PLS_DC); -PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array TSRMLS_DC PLS_DC); +PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, pval *track_vars_array TSRMLS_DC); +PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array TSRMLS_DC); #endif /* PHP_VARIABLES_H */ diff --git a/main/rfc1867.c b/main/rfc1867.c index 1806b4f125..92615a4292 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -33,7 +33,7 @@ /* The longest property name we use in an uploaded file array */ #define MAX_SIZE_OF_INDEX sizeof("[tmp_name]") -static void add_protected_variable(char *varname PLS_DC) +static void add_protected_variable(char *varname TSRMLS_DC) { int dummy=1; @@ -41,44 +41,44 @@ static void add_protected_variable(char *varname PLS_DC) } -static zend_bool is_protected_variable(char *varname PLS_DC) +static zend_bool is_protected_variable(char *varname TSRMLS_DC) { return zend_hash_exists(&PG(rfc1867_protected_variables), varname, strlen(varname)+1); } -static void safe_php_register_variable(char *var, char *strval, zval *track_vars_array, zend_bool override_protection TSRMLS_DC PLS_DC) +static void safe_php_register_variable(char *var, char *strval, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) { - if (override_protection || !is_protected_variable(var PLS_CC)) { - php_register_variable(var, strval, track_vars_array TSRMLS_CC PLS_CC); + if (override_protection || !is_protected_variable(var TSRMLS_CC)) { + php_register_variable(var, strval, track_vars_array TSRMLS_CC); } } -static void safe_php_register_variable_ex(char *var, zval *val, pval *track_vars_array, zend_bool override_protection TSRMLS_DC PLS_DC) +static void safe_php_register_variable_ex(char *var, zval *val, pval *track_vars_array, zend_bool override_protection TSRMLS_DC) { - if (override_protection || !is_protected_variable(var PLS_CC)) { - php_register_variable_ex(var, val, track_vars_array TSRMLS_CC PLS_CC); + if (override_protection || !is_protected_variable(var TSRMLS_CC)) { + php_register_variable_ex(var, val, track_vars_array TSRMLS_CC); } } -static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC PLS_DC) +static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC) { int register_globals = PG(register_globals); PG(register_globals) = 0; - safe_php_register_variable(strvar, val, http_post_files, override_protection TSRMLS_CC PLS_CC); + safe_php_register_variable(strvar, val, http_post_files, override_protection TSRMLS_CC); PG(register_globals) = register_globals; } -static void register_http_post_files_variable_ex(char *var, zval *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC PLS_DC) +static void register_http_post_files_variable_ex(char *var, zval *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC) { int register_globals = PG(register_globals); PG(register_globals) = 0; - safe_php_register_variable_ex(var, val, http_post_files, override_protection TSRMLS_CC PLS_CC); + safe_php_register_variable_ex(var, val, http_post_files, override_protection TSRMLS_CC); PG(register_globals) = register_globals; } @@ -90,7 +90,7 @@ static int unlink_filename(char **filename) } -void destroy_uploaded_files_hash(SLS_D) +void destroy_uploaded_files_hash(TSRMLS_D) { zend_hash_apply(SG(rfc1867_uploaded_files), (apply_func_t) unlink_filename); zend_hash_destroy(SG(rfc1867_uploaded_files)); @@ -100,7 +100,7 @@ void destroy_uploaded_files_hash(SLS_D) /* * Split raw mime stream up into appropriate components */ -static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr SLS_DC PLS_DC) +static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr TSRMLS_DC) { char *ptr, *loc, *loc2, *loc3, *s, *name, *filename, *u, *temp_filename; int len, state = 0, Done = 0, rem, urem; @@ -113,7 +113,6 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr S zval *http_post_files=NULL; zend_bool upload_successful; zend_bool magic_quotes_gpc; - TSRMLS_FETCH(); zend_hash_init(&PG(rfc1867_protected_variables), 5, NULL, NULL, 0); @@ -247,9 +246,9 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr S } s = strrchr(filenamebuf, '\\'); if (s && s > filenamebuf) { - safe_php_register_variable(lbuf, s+1, NULL, 0 TSRMLS_CC PLS_CC); + safe_php_register_variable(lbuf, s+1, NULL, 0 TSRMLS_CC); } else { - safe_php_register_variable(lbuf, filenamebuf, NULL, 0 TSRMLS_CC PLS_CC); + safe_php_register_variable(lbuf, filenamebuf, NULL, 0 TSRMLS_CC); } /* Add $foo[name] */ @@ -259,9 +258,9 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr S sprintf(lbuf, "%s[name]", namebuf); } if (s && s > filenamebuf) { - register_http_post_files_variable(lbuf, s+1, http_post_files, 0 TSRMLS_CC PLS_CC); + register_http_post_files_variable(lbuf, s+1, http_post_files, 0 TSRMLS_CC); } else { - register_http_post_files_variable(lbuf, filenamebuf, http_post_files, 0 TSRMLS_CC PLS_CC); + register_http_post_files_variable(lbuf, filenamebuf, http_post_files, 0 TSRMLS_CC); } state = 3; @@ -291,7 +290,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr S } else { sprintf(lbuf, "%s_type", namebuf); } - safe_php_register_variable(lbuf, s, NULL, 0 TSRMLS_CC PLS_CC); + safe_php_register_variable(lbuf, s, NULL, 0 TSRMLS_CC); /* Add $foo[type] */ if (is_arr_upload) { @@ -299,7 +298,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr S } else { sprintf(lbuf, "%s[type]", namebuf); } - register_http_post_files_variable(lbuf, s, http_post_files, 0 TSRMLS_CC PLS_CC); + register_http_post_files_variable(lbuf, s, http_post_files, 0 TSRMLS_CC); if(*s != '\0') { *(loc2 - 1) = '\n'; } @@ -324,7 +323,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr S /* Check to make sure we are not overwriting special file * upload variables */ - safe_php_register_variable(namebuf, ptr, array_ptr, 0 TSRMLS_CC PLS_CC); + safe_php_register_variable(namebuf, ptr, array_ptr, 0 TSRMLS_CC); /* And a little kludge to pick out special MAX_FILE_SIZE */ itype = php_check_ident_type(namebuf); @@ -388,7 +387,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr S upload_successful = 1; } fclose(fp); - add_protected_variable(namebuf PLS_CC); + add_protected_variable(namebuf TSRMLS_CC); if (!upload_successful) { if(temp_filename) { unlink(temp_filename); @@ -401,15 +400,15 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr S magic_quotes_gpc = PG(magic_quotes_gpc); PG(magic_quotes_gpc) = 0; - safe_php_register_variable(namebuf, temp_filename, NULL, 1 TSRMLS_CC PLS_CC); + safe_php_register_variable(namebuf, temp_filename, NULL, 1 TSRMLS_CC); /* Add $foo[tmp_name] */ if(is_arr_upload) { sprintf(lbuf, "%s[tmp_name][%s]", abuf, arr_index); } else { sprintf(lbuf, "%s[tmp_name]", namebuf); } - add_protected_variable(lbuf PLS_CC); - register_http_post_files_variable(lbuf, temp_filename, http_post_files, 1 TSRMLS_CC PLS_CC); + add_protected_variable(lbuf TSRMLS_CC); + register_http_post_files_variable(lbuf, temp_filename, http_post_files, 1 TSRMLS_CC); PG(magic_quotes_gpc) = magic_quotes_gpc; { @@ -424,7 +423,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr S } else { sprintf(lbuf, "%s_size", namebuf); } - safe_php_register_variable_ex(lbuf, &file_size, NULL, 0 TSRMLS_CC PLS_CC); + safe_php_register_variable_ex(lbuf, &file_size, NULL, 0 TSRMLS_CC); /* Add $foo[size] */ if(is_arr_upload) { @@ -432,7 +431,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr S } else { sprintf(lbuf, "%s[size]", namebuf); } - register_http_post_files_variable_ex(lbuf, &file_size, http_post_files, 0 TSRMLS_CC PLS_CC); + register_http_post_files_variable_ex(lbuf, &file_size, http_post_files, 0 TSRMLS_CC); } state = 0; rem -= (loc - ptr); @@ -449,7 +448,6 @@ SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) char *boundary; uint boundary_len; zval *array_ptr = (zval *) arg; - PLS_FETCH(); if (!PG(file_uploads)) { php_error(E_WARNING, "File uploads are disabled"); @@ -471,7 +469,7 @@ SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) } if (SG(request_info).post_data) { - php_mime_split(SG(request_info).post_data, SG(request_info).post_data_length, boundary, array_ptr SLS_CC PLS_CC); + php_mime_split(SG(request_info).post_data, SG(request_info).post_data_length, boundary, array_ptr TSRMLS_CC); } } diff --git a/main/rfc1867.h b/main/rfc1867.h index 1bcba038ea..0e464760fa 100644 --- a/main/rfc1867.h +++ b/main/rfc1867.h @@ -10,6 +10,6 @@ SAPI_POST_HANDLER_FUNC(rfc1867_post_handler); #define FILE_UPLOAD_INPUT_BUFFER_SIZE 8192 -void destroy_uploaded_files_hash(SLS_D); +void destroy_uploaded_files_hash(TSRMLS_D); #endif /* RFC1867_H */ diff --git a/main/safe_mode.c b/main/safe_mode.c index c21e082468..fdf6f161de 100644 --- a/main/safe_mode.c +++ b/main/safe_mode.c @@ -50,7 +50,7 @@ PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode) long uid=0L, gid=0L, duid=0L, dgid=0L; char path[MAXPATHLEN]; char *s; - PLS_FETCH(); + TSRMLS_FETCH(); if (!filename) { return 0; /* path must be provided */ @@ -126,7 +126,7 @@ PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode) } else if (PG(safe_mode_gid) && dgid == php_getgid()) { return 1; } else { - SLS_FETCH(); + TSRMLS_FETCH(); if (SG(rfc1867_uploaded_files)) { if (zend_hash_exists(SG(rfc1867_uploaded_files), (char *) filename, strlen(filename)+1)) { @@ -156,7 +156,7 @@ PHPAPI char *php_get_current_user() { struct passwd *pwd; struct stat *pstat; - SLS_FETCH(); + TSRMLS_FETCH(); if (SG(request_info).current_user) { return SG(request_info).current_user; diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c index 55b74b0233..6f620a3a9e 100644 --- a/sapi/aolserver/aolserver.c +++ b/sapi/aolserver/aolserver.c @@ -54,12 +54,7 @@ int Ns_ModuleVersion = 1; -#define NSLS_D ns_globals_struct *ns_context -#define NSLS_DC , NSLS_D -#define NSLS_C ns_context -#define NSLS_CC , NSLS_C -#define NSG(v) (ns_context->v) -#define NSLS_FETCH() ns_globals_struct *ns_context = ts_resource(ns_globals_id) +#define NSG(v) TSRMG(ns_globals_id, ns_globals_struct *, v) /* php_ns_context is per-server (thus only once at all) */ @@ -95,7 +90,7 @@ php_ns_sapi_ub_write(const char *str, uint str_length) { int n; uint sent = 0; - NSLS_FETCH(); + TSRMLS_FETCH(); while (str_length > 0) { n = Ns_ConnWrite(NSG(conn), (void *) str, str_length); @@ -117,11 +112,11 @@ php_ns_sapi_ub_write(const char *str, uint str_length) */ static int -php_ns_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC) +php_ns_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers) { char *header_name, *header_content; char *p; - NSLS_FETCH(); + TSRMLS_FETCH(); header_name = sapi_header->header; header_content = p = strchr(header_name, ':'); @@ -152,9 +147,9 @@ php_ns_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct */ static int -php_ns_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +php_ns_sapi_send_headers(sapi_headers_struct *sapi_headers) { - NSLS_FETCH(); + TSRMLS_FETCH(); if(SG(sapi_headers).send_default_content_type) { Ns_ConnSetRequiredHeaders(NSG(conn), "text/html", 0); @@ -171,11 +166,11 @@ php_ns_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) */ static int -php_ns_sapi_read_post(char *buf, uint count_bytes SLS_DC) +php_ns_sapi_read_post(char *buf, uint count_bytes) { uint max_read; uint total_read = 0; - NSLS_FETCH(); + TSRMLS_FETCH(); max_read = MIN(NSG(data_avail), count_bytes); @@ -196,11 +191,11 @@ php_ns_sapi_read_post(char *buf, uint count_bytes SLS_DC) */ static char * -php_ns_sapi_read_cookies(SLS_D) +php_ns_sapi_read_cookies() { int i; char *http_cookie = NULL; - NSLS_FETCH(); + TSRMLS_FETCH(); i = Ns_SetIFind(NSG(conn->headers), "cookie"); if(i != -1) { @@ -215,7 +210,7 @@ static void php_info_aolserver(ZEND_MODULE_INFO_FUNC_ARGS) char buf[512]; int uptime = Ns_InfoUptime(); int i; - NSLS_FETCH(); + TSRMLS_FETCH(); php_info_print_table_start(); php_info_print_table_row(2, "SAPI module version", "$Id$"); @@ -272,7 +267,7 @@ static zend_module_entry php_aolserver_module = { PHP_FUNCTION(getallheaders) { int i; - NSLS_FETCH(); + TSRMLS_FETCH(); if (array_init(return_value) == FAILURE) { RETURN_FALSE; @@ -305,18 +300,18 @@ php_ns_startup(sapi_module_struct *sapi_module) */ #define ADD_STRINGX(name,buf) \ - php_register_variable(name, buf, track_vars_array TSRMLS_CC PLS_CC) + php_register_variable(name, buf, track_vars_array TSRMLS_CC) #define ADD_STRING(name) \ ADD_STRINGX(name, buf) static void -php_ns_sapi_register_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS_DC) +php_ns_sapi_register_variables(zval *track_vars_array TSRMLS_DC) { int i; char buf[NS_BUF_SIZE + 1]; char *tmp; - NSLS_FETCH(); + TSRMLS_FETCH(); for(i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) { char *key = Ns_SetKey(NSG(conn->headers), i); @@ -414,12 +409,11 @@ static sapi_module_struct aolserver_sapi_module = { */ static int -php_ns_module_main(NSLS_D SLS_DC) +php_ns_module_main(TSRMLS_D) { zend_file_handle file_handle; - CLS_FETCH(); TSRMLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); file_handle.type = ZEND_HANDLE_FILENAME; file_handle.filename = SG(request_info).path_translated; @@ -427,11 +421,11 @@ php_ns_module_main(NSLS_D SLS_DC) file_handle.opened_path = NULL; php_ns_config(global_context, 0); - if (php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC) == FAILURE) { + if (php_request_startup(TSRMLS_C) == FAILURE) { return NS_ERROR; } - php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + php_execute_script(&file_handle TSRMLS_CC); php_request_shutdown(NULL); return NS_OK; @@ -443,7 +437,7 @@ php_ns_module_main(NSLS_D SLS_DC) */ static void -php_ns_request_ctor(NSLS_D SLS_DC) +php_ns_request_ctor(TSRMLS_D) { char *server; Ns_DString ds; @@ -490,7 +484,7 @@ php_ns_request_ctor(NSLS_D SLS_DC) */ static void -php_ns_request_dtor(NSLS_D SLS_DC) +php_ns_request_dtor(TSRMLS_D) { free(SG(request_info).path_translated); if (SG(request_info).query_string) @@ -507,18 +501,17 @@ static int php_ns_request_handler(void *context, Ns_Conn *conn) { int status = NS_OK; - SLS_FETCH(); - NSLS_FETCH(); + TSRMLS_FETCH(); NSG(conn) = conn; SG(server_context) = global_context; - php_ns_request_ctor(NSLS_C SLS_CC); + php_ns_request_ctor(TSRMLS_C); - status = php_ns_module_main(NSLS_C SLS_CC); + status = php_ns_module_main(TSRMLS_C); - php_ns_request_dtor(NSLS_C SLS_CC); + php_ns_request_dtor(TSRMLS_C); return status; } diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c index 0a17b61721..a38cc94735 100644 --- a/sapi/apache/mod_php4.c +++ b/sapi/apache/mod_php4.c @@ -64,13 +64,13 @@ /* {{{ Prototypes */ -int apache_php_module_main(request_rec *r, int display_source_mode CLS_DC TSRMLS_DC PLS_DC SLS_DC); +int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC); void php_save_umask(void); void php_restore_umask(void); -int sapi_apache_read_post(char *buffer, uint count_bytes SLS_DC); -char *sapi_apache_read_cookies(SLS_D); -int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC); -int sapi_apache_send_headers(sapi_headers_struct *sapi_headers SLS_DC); +int sapi_apache_read_post(char *buffer, uint count_bytes TSRMLS_DC); +char *sapi_apache_read_cookies(TSRMLS_D); +int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC); +int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC); static int send_php(request_rec *r, int display_source_mode, char *filename); static int send_parsed_php(request_rec * r); static int send_parsed_php_source(request_rec * r); @@ -127,7 +127,7 @@ void php_save_umask(void) static int sapi_apache_ub_write(const char *str, uint str_length) { int ret=0; - SLS_FETCH(); + TSRMLS_FETCH(); if (SG(server_context)) { ret = rwrite(str, str_length, (request_rec *) SG(server_context)); @@ -155,7 +155,7 @@ static void sapi_apache_flush(void *server_context) /* {{{ sapi_apache_read_post */ -int sapi_apache_read_post(char *buffer, uint count_bytes SLS_DC) +int sapi_apache_read_post(char *buffer, uint count_bytes TSRMLS_DC) { uint total_read_bytes=0, read_bytes; request_rec *r = (request_rec *) SG(server_context); @@ -178,7 +178,7 @@ int sapi_apache_read_post(char *buffer, uint count_bytes SLS_DC) /* {{{ sapi_apache_read_cookies */ -char *sapi_apache_read_cookies(SLS_D) +char *sapi_apache_read_cookies(TSRMLS_D) { return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, "HTTP_COOKIE"); } @@ -186,7 +186,7 @@ char *sapi_apache_read_cookies(SLS_D) /* {{{ sapi_apache_header_handler */ -int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC) +int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) { char *header_name, *header_content, *p; request_rec *r = (request_rec *) SG(server_context); @@ -221,7 +221,7 @@ int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_str /* {{{ sapi_apache_send_headers */ -int sapi_apache_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { if(SG(server_context) == NULL) { /* server_context is not here anymore */ return SAPI_HEADER_SEND_FAILED; @@ -235,7 +235,7 @@ int sapi_apache_send_headers(sapi_headers_struct *sapi_headers SLS_DC) /* {{{ sapi_apache_register_server_variables */ -static void sapi_apache_register_server_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS_DC) +static void sapi_apache_register_server_variables(zval *track_vars_array TSRMLS_DC) { register int i; array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env); @@ -251,7 +251,7 @@ static void sapi_apache_register_server_variables(zval *track_vars_array TSRMLS_ } else { val = empty_string; } - php_register_variable(elts[i].key, val, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable(elts[i].key, val, track_vars_array TSRMLS_CC); } /* If PATH_TRANSLATED doesn't exist, copy it from SCRIPT_FILENAME */ @@ -266,10 +266,10 @@ static void sapi_apache_register_server_variables(zval *track_vars_array TSRMLS_ if (symbol_table && !zend_hash_exists(symbol_table, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED")) && zend_hash_find(symbol_table, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &path_translated)==SUCCESS) { - php_register_variable("PATH_TRANSLATED", Z_STRVAL_PP(path_translated), track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("PATH_TRANSLATED", Z_STRVAL_PP(path_translated), track_vars_array TSRMLS_CC); } - php_register_variable("PHP_SELF", ((request_rec *) SG(server_context))->uri, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("PHP_SELF", ((request_rec *) SG(server_context))->uri, track_vars_array TSRMLS_CC); } /* }}} */ @@ -290,7 +290,7 @@ static int php_apache_startup(sapi_module_struct *sapi_module) */ static void php_apache_log_message(char *message) { - SLS_FETCH(); + TSRMLS_FETCH(); if (SG(server_context)) { #if MODULE_MAGIC_NUMBER >= 19970831 @@ -309,8 +309,8 @@ static void php_apache_log_message(char *message) */ static void php_apache_request_shutdown(void *dummy) { - SLS_FETCH(); - APLS_FETCH(); + TSRMLS_FETCH(); + TSRMLS_FETCH(); php_output_set_status(0); SG(server_context) = NULL; /* The server context (request) is invalid by the time run_cleanups() is called */ @@ -323,10 +323,10 @@ static void php_apache_request_shutdown(void *dummy) /* {{{ php_apache_sapi_activate */ -static int php_apache_sapi_activate(SLS_D) +static int php_apache_sapi_activate(TSRMLS_D) { request_rec *r = (request_rec *) SG(server_context); - APLS_FETCH(); + TSRMLS_FETCH(); /* * For the Apache module version, this bit of code registers a cleanup @@ -351,7 +351,7 @@ static int php_apache_sapi_activate(SLS_D) /* {{{ php_apache_get_stat */ -static struct stat *php_apache_get_stat(SLS_D) +static struct stat *php_apache_get_stat(TSRMLS_D) { return &((request_rec *) SG(server_context))->finfo; } @@ -359,7 +359,7 @@ static struct stat *php_apache_get_stat(SLS_D) /* {{{ php_apache_getenv */ -static char *php_apache_getenv(char *name, size_t name_len SLS_DC) +static char *php_apache_getenv(char *name, size_t name_len TSRMLS_DC) { return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, name); } @@ -418,7 +418,7 @@ void php_restore_umask(void) /* {{{ init_request_info */ -static void init_request_info(SLS_D) +static void init_request_info(TSRMLS_D) { request_rec *r = ((request_rec *) SG(server_context)); char *content_length = (char *) table_get(r->subprocess_env, "CONTENT_LENGTH"); @@ -468,7 +468,7 @@ static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry) /* {{{ php_apache_get_default_mimetype */ -static char *php_apache_get_default_mimetype(request_rec *r SLS_DC) +static char *php_apache_get_default_mimetype(request_rec *r TSRMLS_DC) { char *mimetype; @@ -476,7 +476,7 @@ static char *php_apache_get_default_mimetype(request_rec *r SLS_DC) /* Assume output will be of the default MIME type. Individual scripts may change this later. */ char *tmpmimetype; - tmpmimetype = sapi_get_default_content_type(SLS_C); + tmpmimetype = sapi_get_default_content_type(TSRMLS_C); mimetype = pstrdup(r->pool, tmpmimetype); efree(tmpmimetype); } else { @@ -492,11 +492,9 @@ static int send_php(request_rec *r, int display_source_mode, char *filename) { int retval; HashTable *per_dir_conf; - SLS_FETCH(); TSRMLS_FETCH(); - CLS_FETCH(); - PLS_FETCH(); - APLS_FETCH(); + TSRMLS_FETCH(); + TSRMLS_FETCH(); if (AP(in_request)) { zend_file_handle fh; @@ -505,7 +503,7 @@ static int send_php(request_rec *r, int display_source_mode, char *filename) fh.opened_path = NULL; fh.free_filename = 0; fh.type = ZEND_HANDLE_FILENAME; - zend_execute_scripts(ZEND_INCLUDE CLS_CC TSRMLS_CC, 1, &fh); + zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC, 1, &fh); return OK; } @@ -530,7 +528,7 @@ static int send_php(request_rec *r, int display_source_mode, char *filename) * directive, then decline to handle this request */ if (!AP(engine)) { - r->content_type = php_apache_get_default_mimetype(r SLS_CC); + r->content_type = php_apache_get_default_mimetype(r TSRMLS_CC); r->allowed |= (1 << METHODS) - 1; zend_try { zend_ini_deactivate(TSRMLS_C); @@ -567,7 +565,7 @@ static int send_php(request_rec *r, int display_source_mode, char *filename) } /* Assume output will be of the default MIME type. Individual scripts may change this later in the request. */ - r->content_type = php_apache_get_default_mimetype(r SLS_CC); + r->content_type = php_apache_get_default_mimetype(r TSRMLS_CC); /* Init timeout */ hard_timeout("send", r); @@ -578,8 +576,8 @@ static int send_php(request_rec *r, int display_source_mode, char *filename) add_common_vars(r); add_cgi_vars(r); - init_request_info(SLS_C); - apache_php_module_main(r, display_source_mode CLS_CC TSRMLS_CC PLS_CC SLS_CC); + init_request_info(TSRMLS_C); + apache_php_module_main(r, display_source_mode TSRMLS_CC); /* Done, restore umask, turn off timeout, close file and return */ php_restore_umask(); @@ -843,7 +841,7 @@ void php_init_handler(server_rec *s, pool *p) } #if MODULE_MAGIC_NUMBER >= 19980527 { - PLS_FETCH(); + TSRMLS_FETCH(); if (PG(expose_php)) { ap_add_version_component("PHP/" PHP_VERSION); } diff --git a/sapi/apache/mod_php4.h b/sapi/apache/mod_php4.h index c70d09a5a8..92229e8cf3 100644 --- a/sapi/apache/mod_php4.h +++ b/sapi/apache/mod_php4.h @@ -38,14 +38,10 @@ extern zend_module_entry apache_module_entry; #ifdef ZTS extern int php_apache_info_id; -#define APLS_D php_apache_info_struct *apache_globals -#define AP(v) (apache_globals->v) -#define APLS_FETCH() APLS_D = ts_resource(php_apache_info_id) +#define AP(v) TSRMG(alloc_globals_id, php_apache_info_struct *, v) #else extern php_apache_info_struct php_apache_info; -#define APLS_D #define AP(v) (php_apache_info.v) -#define APLS_FETCH() #endif diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c index fd0270414a..cfc63ae639 100644 --- a/sapi/apache/php_apache.c +++ b/sapi/apache/php_apache.c @@ -90,7 +90,7 @@ PHP_INI_END() -static void php_apache_globals_ctor(php_apache_info_struct *apache_globals TSRMLS_DC) +static void php_apache_globals_ctor(php_apache_info_struct *apache_globals_p TSRMLS_DC) { apache_globals->in_request = 0; } @@ -124,8 +124,8 @@ zend_module_entry apache_module_entry = { PHP_FUNCTION(apache_child_terminate) { #ifndef MULTITHREAD - APLS_FETCH(); - SLS_FETCH(); + ATSRMLS_FETCH(); + TSRMLS_FETCH(); if (AP(terminate_child)) { ap_child_terminate( ((request_rec *)SG(server_context)) ); @@ -145,7 +145,7 @@ PHP_FUNCTION(apache_note) pval **arg_name,**arg_val; char *note_val; int arg_count = ARG_COUNT(ht); - SLS_FETCH(); + TSRMLS_FETCH(); if (arg_count<1 || arg_count>2 || zend_get_parameters_ex(arg_count,&arg_name,&arg_val) ==FAILURE ) { @@ -185,7 +185,7 @@ PHP_MINFO_FUNCTION(apache) extern char *user_name; extern gid_t group_id; extern int max_requests_per_child; - SLS_FETCH(); + TSRMLS_FETCH(); serv = ((request_rec *) SG(server_context))->server; @@ -245,7 +245,7 @@ PHP_MINFO_FUNCTION(apache) array_header *arr; table_entry *elts; request_rec *r; - SLS_FETCH(); + TSRMLS_FETCH(); r = ((request_rec *) SG(server_context)); arr = table_elts(r->subprocess_env); @@ -265,7 +265,7 @@ PHP_MINFO_FUNCTION(apache) table_entry *env; int i; request_rec *r; - SLS_FETCH(); + TSRMLS_FETCH(); r = ((request_rec *) SG(server_context)); SECTION("HTTP Headers Information"); @@ -306,7 +306,7 @@ PHP_FUNCTION(virtual) { pval **filename; request_rec *rr = NULL; - SLS_FETCH(); + TSRMLS_FETCH(); if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1,&filename) == FAILURE) { WRONG_PARAM_COUNT; @@ -346,8 +346,8 @@ PHP_FUNCTION(getallheaders) array_header *env_arr; table_entry *tenv; int i; - SLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); + TSRMLS_FETCH(); if (array_init(return_value) == FAILURE) { RETURN_FALSE; @@ -373,7 +373,7 @@ PHP_FUNCTION(apache_lookup_uri) { pval **filename; request_rec *rr=NULL; - SLS_FETCH(); + TSRMLS_FETCH(); if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1,&filename) == FAILURE) { WRONG_PARAM_COUNT; @@ -448,7 +448,7 @@ PHP_FUNCTION(apache_exec_uri) { pval **filename; request_rec *rr=NULL; - SLS_FETCH(); + TSRMLS_FETCH(); if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1,&filename) == FAILURE) { WRONG_PARAM_COUNT; diff --git a/sapi/apache/sapi_apache.c b/sapi/apache/sapi_apache.c index 1ad8807f9d..e34f6701f9 100644 --- a/sapi/apache/sapi_apache.c +++ b/sapi/apache/sapi_apache.c @@ -60,12 +60,12 @@ /* {{{ apache_php_module_main */ -int apache_php_module_main(request_rec *r, int display_source_mode CLS_DC TSRMLS_DC PLS_DC SLS_DC) +int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC TSRMLS_DC) { zend_file_handle file_handle; - APLS_FETCH(); + TSRMLS_FETCH(); - if (php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC) == FAILURE) { + if (php_request_startup(TSRMLS_C) == FAILURE) { return FAILURE; } /* sending a file handle to another dll is not working @@ -88,7 +88,7 @@ int apache_php_module_main(request_rec *r, int display_source_mode CLS_DC TSRMLS file_handle.opened_path = NULL; file_handle.free_filename = 0; - (void) php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + (void) php_execute_script(&file_handle TSRMLS_CC); } AP(in_request) = 0; diff --git a/sapi/apache2filter/php_functions.c b/sapi/apache2filter/php_functions.c index 2679c38488..7d1aa1bd08 100644 --- a/sapi/apache2filter/php_functions.c +++ b/sapi/apache2filter/php_functions.c @@ -38,7 +38,7 @@ static request_rec *php_apache_lookup_uri(INTERNAL_FUNCTION_PARAMETERS) { zval **p1; php_struct *ctx; - SLS_FETCH(); + TSRMLS_FETCH(); if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &p1) == FAILURE) return NULL; @@ -110,7 +110,7 @@ PHP_FUNCTION(get_all_headers) php_struct *ctx; apr_array_header_t *arr; char *key, *val; - SLS_FETCH(); + TSRMLS_FETCH(); if (array_init(return_value) == FAILURE) { RETURN_FALSE; diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index 03a2ed90b9..8d47b8a29f 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -50,7 +50,7 @@ php_apache_sapi_ub_write(const char *str, uint str_length) apr_bucket_brigade *bb; php_struct *ctx; uint now; - SLS_FETCH(); + TSRMLS_FETCH(); ctx = SG(server_context); @@ -72,7 +72,7 @@ php_apache_sapi_ub_write(const char *str, uint str_length) } static int -php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC) +php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) { php_struct *ctx = SG(server_context); char *val; @@ -100,7 +100,7 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_str } static int -php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { php_struct *ctx = SG(server_context); @@ -110,7 +110,7 @@ php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) } static int -php_apache_sapi_read_post(char *buf, uint count_bytes SLS_DC) +php_apache_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC) { int n; int to_read; @@ -131,7 +131,7 @@ php_apache_sapi_read_post(char *buf, uint count_bytes SLS_DC) } static char * -php_apache_sapi_read_cookies(SLS_D) +php_apache_sapi_read_cookies(TSRMLS_D) { php_struct *ctx = SG(server_context); const char *http_cookie; @@ -143,7 +143,7 @@ php_apache_sapi_read_cookies(SLS_D) } static void -php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS_DC) +php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC TSRMLS_DC TSRMLS_DC) { php_struct *ctx = SG(server_context); apr_array_header_t *arr = apr_table_elts(ctx->f->r->subprocess_env); @@ -151,10 +151,10 @@ php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS_D APR_ARRAY_FOREACH_OPEN(arr, key, val) if (!val) val = empty_string; - php_register_variable(key, val, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable(key, val, track_vars_array TSRMLS_CC); APR_ARRAY_FOREACH_CLOSE() - php_register_variable("PHP_SELF", ctx->f->r->uri, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("PHP_SELF", ctx->f->r->uri, track_vars_array TSRMLS_CC); } static void @@ -180,7 +180,7 @@ php_apache_sapi_flush(void *server_context) static void php_apache_sapi_log_message(char *msg) { php_struct *ctx; - SLS_FETCH(); + TSRMLS_FETCH(); ctx = SG(server_context); @@ -239,7 +239,7 @@ static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, const char *str; apr_ssize_t n; apr_status_t rv; - SLS_FETCH(); + TSRMLS_FETCH(); ctx = SG(server_context); @@ -261,13 +261,12 @@ static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, return APR_SUCCESS; } -static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx SLS_DC) +static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx TSRMLS_DC) { char *content_type; const char *auth; - CLS_FETCH(); TSRMLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); PG(during_request_startup) = 0; SG(sapi_headers).http_response_code = 200; @@ -278,7 +277,7 @@ static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx SLS_DC) SG(request_info).request_method = f->r->method; SG(request_info).request_uri = safe_strdup(f->r->uri); f->r->no_local_copy = 1; - content_type = sapi_get_default_content_type(SLS_C); + content_type = sapi_get_default_content_type(TSRMLS_C); f->r->content_type = apr_pstrdup(f->r->pool, content_type); SG(request_info).post_data = ctx->post_data; SG(request_info).post_data_length = ctx->post_len; @@ -289,12 +288,12 @@ static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx SLS_DC) apr_table_unset(f->r->headers_out, "ETag"); apr_table_unset(f->r->headers_in, "Connection"); auth = apr_table_get(f->r->headers_in, "Authorization"); - php_handle_auth_data(auth SLS_CC); + php_handle_auth_data(auth TSRMLS_CC); - php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC); + php_request_startup(TSRMLS_C); } -static void php_apache_request_dtor(ap_filter_t *f SLS_DC) +static void php_apache_request_dtor(ap_filter_t *f TSRMLS_DC) { php_request_shutdown(NULL); @@ -309,7 +308,7 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) php_struct *ctx; apr_bucket *b; void *conf = ap_get_module_config(f->r->per_dir_config, &php4_module); - SLS_FETCH(); + TSRMLS_FETCH(); ctx = SG(server_context); INIT_CTX; @@ -327,7 +326,7 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) ctx->state++; - php_apache_request_ctor(f, ctx SLS_CC); + php_apache_request_ctor(f, ctx TSRMLS_CC); } /* moves all buckets from bb to ctx->bb */ @@ -339,9 +338,8 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) if (ctx->state == 1 && APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(ctx->bb))) { zend_file_handle zfd; apr_bucket *eos; - CLS_FETCH(); TSRMLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); /* We want to execute only one script per request. * A bug in Apache or other filters could cause us @@ -351,7 +349,7 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) ctx->state = 2; /* Handle phpinfo/phpcredits/built-in images */ - if (!php_handle_special_queries(SLS_C PLS_CC)) { + if (!php_handle_special_queries(TSRMLS_C)) { b = APR_BRIGADE_FIRST(ctx->bb); @@ -365,7 +363,7 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) zfd.free_filename = 0; zfd.opened_path = NULL; - php_execute_script(&zfd CLS_CC TSRMLS_CC PLS_CC); + php_execute_script(&zfd TSRMLS_CC); } else { #define NO_DATA "The PHP Filter did not receive suitable input data" @@ -375,7 +373,7 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) } } - php_apache_request_dtor(f SLS_CC); + php_apache_request_dtor(f TSRMLS_CC); SG(server_context) = 0; /* Pass EOS bucket to next filter to signal end of request */ diff --git a/sapi/caudium/caudium.c b/sapi/caudium/caudium.c index 4c1cc60f38..356a6ee978 100644 --- a/sapi/caudium/caudium.c +++ b/sapi/caudium/caudium.c @@ -92,13 +92,13 @@ typedef struct struct pike_string *filename; int my_fd; int written; - SLS_D; + TSRMLS_D; } php_caudium_request; void pike_module_init(void); void pike_module_exit(void); -static void free_struct(SLS_D); +static void free_struct(TSRMLS_D); void f_php_caudium_request_handler(INT32 args); /* Defines to get to the data supplied when the script is started. */ @@ -207,7 +207,7 @@ INLINE static int php_caudium_low_ub_write(const char *str, uint str_length) { int sent_bytes = 0; struct pike_string *to_write = NULL; - PLS_FETCH(); + TSRMLS_FETCH(); GET_THIS(); if(!MY_FD_OBJ->prog) { PG(connection_status) = PHP_CONNECTION_ABORTED; @@ -237,7 +237,7 @@ php_caudium_low_ub_write(const char *str, uint str_length) { static int php_caudium_sapi_ub_write(const char *str, uint str_length) { - PLS_FETCH(); + TSRMLS_FETCH(); GET_THIS(); int sent_bytes = 0, fd = MY_FD; if(fd) @@ -332,7 +332,7 @@ php_caudium_set_header(char *header_name, char *value, char *p) */ static int php_caudium_sapi_header_handler(sapi_header_struct *sapi_header, - sapi_headers_struct *sapi_headers SLS_DC) + sapi_headers_struct *sapi_headers TSRMLS_DC) { char *header_name, *header_content, *p; header_name = sapi_header->header; @@ -354,9 +354,9 @@ php_caudium_sapi_header_handler(sapi_header_struct *sapi_header, */ INLINE static int -php_caudium_low_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +php_caudium_low_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { - PLS_FETCH(); + TSRMLS_FETCH(); struct pike_string *ind; struct svalue *s_headermap; GET_THIS(); @@ -381,10 +381,10 @@ php_caudium_low_send_headers(sapi_headers_struct *sapi_headers SLS_DC) } static int -php_caudium_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +php_caudium_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { int res = 0; - THREAD_SAFE_RUN(res = php_caudium_low_send_headers(sapi_headers SLS_CC), "send headers"); + THREAD_SAFE_RUN(res = php_caudium_low_send_headers(sapi_headers TSRMLS_CC), "send headers"); return res; } @@ -397,7 +397,7 @@ INLINE static int php_caudium_low_read_post(char *buf, uint count_bytes) { uint total_read = 0; GET_THIS(); - PLS_FETCH(); + TSRMLS_FETCH(); if(!MY_FD_OBJ->prog) { @@ -418,7 +418,7 @@ INLINE static int php_caudium_low_read_post(char *buf, uint count_bytes) } static int -php_caudium_sapi_read_post(char *buf, uint count_bytes SLS_DC) +php_caudium_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC) { uint total_read = 0; THREAD_SAFE_RUN(total_read = php_caudium_low_read_post(buf, count_bytes), "read post"); @@ -431,7 +431,7 @@ php_caudium_sapi_read_post(char *buf, uint count_bytes SLS_DC) */ static char * -php_caudium_sapi_read_cookies(SLS_D) +php_caudium_sapi_read_cookies(TSRMLS_D) { char *cookies; cookies = lookup_string_header("HTTP_COOKIE", NULL); @@ -474,55 +474,55 @@ static zend_module_entry php_caudium_module = { }; -INLINE static void low_sapi_caudium_register_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS_DC) +INLINE static void low_sapi_caudium_register_variables(zval *track_vars_array TSRMLS_DC TSRMLS_DC TSRMLS_DC) { char *tmp; php_register_variable("PHP_SELF", SG(request_info).request_uri, - track_vars_array TSRMLS_CC PLS_CC); + track_vars_array TSRMLS_CC); php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", - track_vars_array TSRMLS_CC PLS_CC); + track_vars_array TSRMLS_CC); php_register_variable("REQUEST_METHOD", (char *) SG(request_info).request_method, - track_vars_array TSRMLS_CC PLS_CC); + track_vars_array TSRMLS_CC); php_register_variable("REQUEST_URI", SG(request_info).request_uri, - track_vars_array TSRMLS_CC PLS_CC); + track_vars_array TSRMLS_CC); php_register_variable("PATH_TRANSLATED", SG(request_info).path_translated, - track_vars_array TSRMLS_CC PLS_CC); + track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("SERVER_NAME", NULL)) != NULL) - php_register_variable("SERVER_NAME", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("SERVER_NAME", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("SERVER_PORT", NULL)) != NULL) - php_register_variable("SERVER_PORT", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("SERVER_PORT", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("SERVER_PROTOCOL", NULL)) != NULL) - php_register_variable("SERVER_PROTOCOL", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("SERVER_PROTOCOL", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("SCRIPT_NAME", NULL)) != NULL) - php_register_variable("SCRIPT_NAME", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("SCRIPT_NAME", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("SCRIPT_FILENAME", NULL)) != NULL) - php_register_variable("SCRIPT_FILENAME", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("SCRIPT_FILENAME", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("REMOTE_ADDR", NULL)) != NULL) - php_register_variable("REMOTE_ADDR", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("REMOTE_ADDR", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("REMOTE_PORT", NULL)) != NULL) - php_register_variable("REMOTE_PORT", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("REMOTE_PORT", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("DOCUMENT_ROOT", NULL)) != NULL) - php_register_variable("DOCUMENT_ROOT", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("DOCUMENT_ROOT", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("HTTP_CONNECTION", NULL)) != NULL) - php_register_variable("HTTP_CONNECTION", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("HTTP_CONNECTION", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("HTTP_USER_AGENT", NULL)) != NULL) - php_register_variable("HTTP_USER_AGENT", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("HTTP_USER_AGENT", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("DOCUMENT_ROOT", NULL)) != NULL) - php_register_variable("DOCUMENT_ROOT", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("DOCUMENT_ROOT", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("QUERY_STRING", "")) != NULL) - php_register_variable("QUERY_STRING", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("QUERY_STRING", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("REMOTE_USER", NULL)) != NULL) - php_register_variable("REMOTE_USER", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("REMOTE_USER", tmp, track_vars_array TSRMLS_CC); if( (tmp = lookup_string_header("REMOTE_PASSWORD", NULL)) != NULL) - php_register_variable("REMOTE_PASSWORD", tmp, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("REMOTE_PASSWORD", tmp, track_vars_array TSRMLS_CC); } -static void sapi_caudium_register_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS_DC) +static void sapi_caudium_register_variables(zval *track_vars_array TSRMLS_DC TSRMLS_DC TSRMLS_DC) { - THREAD_SAFE_RUN(low_sapi_caudium_register_variables(track_vars_array TSRMLS_CC SLS_CC PLS_CC), "register_variables"); + THREAD_SAFE_RUN(low_sapi_caudium_register_variables(track_vars_array TSRMLS_CC TSRMLS_CC TSRMLS_CC), "register_variables"); } /* this structure is static (as in "it does not change") */ @@ -556,7 +556,7 @@ static sapi_module_struct caudium_sapi_module = { * with a number of variables. HTTP_* variables are created for * the HTTP header data, so that a script can access these. */ -static void php_caudium_hash_environment(CLS_D TSRMLS_DC PLS_DC SLS_DC) +static void php_caudium_hash_environment(TSRMLS_D) { int i; char buf[512]; @@ -612,9 +612,8 @@ static void php_caudium_module_main(php_caudium_request *ureq) struct thread_state *state; extern struct program *thread_id_prog; #endif - SLS_FETCH(); - CLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); + TSRMLS_FETCH(); TSRMLS_FETCH(); GET_THIS(); THIS->filename = ureq->filename; @@ -673,7 +672,7 @@ static void php_caudium_module_main(php_caudium_request *ureq) } /* Let PHP4 handle the deconding of the AUTH */ - php_handle_auth_data(lookup_string_header("HTTP_AUTHORIZATION", NULL), SLS_C); + php_handle_auth_data(lookup_string_header("HTTP_AUTHORIZATION", NULL), TSRMLS_C); /* Swap out this thread and release the interpreter lock to allow * Pike threads to run. We wait since the above would otherwise require * a lot of unlock/lock. @@ -700,24 +699,24 @@ static void php_caudium_module_main(php_caudium_request *ureq) file_handle.free_filename = 0; THIS->written = 0; - res = php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC); + res = php_request_startup(TSRMLS_C); if(res == FAILURE) { THREAD_SAFE_RUN({ apply_svalue(&THIS->done_cb, 0); pop_stack(); - free_struct(SLS_C); + free_struct(TSRMLS_C); }, "Negative run response"); } else { - THREAD_SAFE_RUN(php_caudium_hash_environment(CLS_C TSRMLS_CC PLS_CC SLS_CC), + THREAD_SAFE_RUN(php_caudium_hash_environment(TSRMLS_C), "environment hashing"); - php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + php_execute_script(&file_handle TSRMLS_CC); php_request_shutdown(NULL); THREAD_SAFE_RUN({ push_int(THIS->written); apply_svalue(&THIS->done_cb, 1); pop_stack(); - free_struct(SLS_C); + free_struct(TSRMLS_C); }, "positive run response"); } @@ -795,7 +794,7 @@ void f_php_caudium_request_handler(INT32 args) pop_n_elems(args); } -static void free_struct(SLS_D) +static void free_struct(TSRMLS_D) { GET_THIS(); if(THIS->request_data) free_mapping(THIS->request_data); diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 26378b7639..e58c7be8ae 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -144,7 +144,7 @@ static void sapi_cgi_send_header(sapi_header_struct *sapi_header, void *server_c } -static int sapi_cgi_read_post(char *buffer, uint count_bytes SLS_DC) +static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC) { uint read_bytes=0, tmp_read_bytes; @@ -160,21 +160,21 @@ static int sapi_cgi_read_post(char *buffer, uint count_bytes SLS_DC) } -static char *sapi_cgi_read_cookies(SLS_D) +static char *sapi_cgi_read_cookies(TSRMLS_D) { return getenv("HTTP_COOKIE"); } -static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS_DC) +static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC) { /* In CGI mode, we consider the environment to be a part of the server * variables */ - php_import_environment_variables(track_vars_array TSRMLS_CC PLS_CC); + php_import_environment_variables(track_vars_array TSRMLS_CC); /* Build the special-case PHP_SELF variable for the CGI version */ - php_register_variable("PHP_SELF", (SG(request_info).request_uri ? SG(request_info).request_uri:""), track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("PHP_SELF", (SG(request_info).request_uri ? SG(request_info).request_uri:""), track_vars_array TSRMLS_CC); } @@ -186,7 +186,7 @@ static void sapi_cgi_log_message(char *message) } } -static int sapi_cgi_deactivate(SLS_D) +static int sapi_cgi_deactivate(TSRMLS_D) { fflush(stdout); if(SG(request_info).argv0) { @@ -266,7 +266,7 @@ static void php_cgi_usage(char *argv0) /* {{{ init_request_info */ -static void init_request_info(SLS_D) +static void init_request_info(TSRMLS_D) { char *content_length = getenv("CONTENT_LENGTH"); char *content_type = getenv("CONTENT_TYPE"); @@ -324,7 +324,7 @@ static void init_request_info(SLS_D) /* The CGI RFC allows servers to pass on unvalidated Authorization data */ auth = getenv("HTTP_AUTHORIZATION"); - php_handle_auth_data(auth SLS_CC); + php_handle_auth_data(auth TSRMLS_CC); } /* }}} */ @@ -348,7 +348,6 @@ static void php_register_command_line_global_vars(char **arg) { char *var, *val; TSRMLS_FETCH(); - PLS_FETCH(); var = *arg; val = strchr(var, '='); @@ -356,7 +355,7 @@ static void php_register_command_line_global_vars(char **arg) printf("No value specified for variable '%s'\n", var); } else { *val++ = '\0'; - php_register_variable(var, val, NULL TSRMLS_CC PLS_CC); + php_register_variable(var, val, NULL TSRMLS_CC); } efree(*arg); } @@ -506,7 +505,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine ap_php_optarg = orig_optarg; } - init_request_info(SLS_C); + init_request_info(TSRMLS_C); SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */ CG(extended_info) = 0; @@ -563,7 +562,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine break; case 'i': /* php info & quit */ - if (php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC)==FAILURE) { + if (php_request_startup(TSRMLS_C)==FAILURE) { php_module_shutdown(); return FAILURE; } @@ -610,7 +609,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine case 'v': /* show php version & quit */ no_headers = 1; - if (php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC)==FAILURE) { + if (php_request_startup(TSRMLS_C)==FAILURE) { php_module_shutdown(); return FAILURE; } @@ -667,7 +666,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine SG(request_info).path_translated = script_file; } - if (php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC)==FAILURE) { + if (php_request_startup(TSRMLS_C)==FAILURE) { php_module_shutdown(); return FAILURE; } @@ -734,11 +733,11 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine switch (behavior) { case PHP_MODE_STANDARD: - exit_status = php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + exit_status = php_execute_script(&file_handle TSRMLS_CC); break; case PHP_MODE_LINT: PG(during_request_startup) = 0; - exit_status = php_lint_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + exit_status = php_lint_script(&file_handle TSRMLS_CC); if (exit_status==SUCCESS) { zend_printf("No syntax errors detected in %s\n", file_handle.filename); } else { @@ -749,7 +748,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine { zend_syntax_highlighter_ini syntax_highlighter_ini; - if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) { + if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) { php_get_highlight_struct(&syntax_highlighter_ini); zend_highlight(&syntax_highlighter_ini); fclose(file_handle.handle.fp); @@ -760,7 +759,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine #if 0 /* Zeev might want to do something with this one day */ case PHP_MODE_INDENT: - open_file_for_scanning(&file_handle CLS_CC); + open_file_for_scanning(&file_handle TSRMLS_CC); zend_indent(); fclose(file_handle.handle.fp); return SUCCESS; diff --git a/sapi/fastcgi/fastcgi.c b/sapi/fastcgi/fastcgi.c index 344c343c88..c6f1e5bb84 100644 --- a/sapi/fastcgi/fastcgi.c +++ b/sapi/fastcgi/fastcgi.c @@ -59,13 +59,6 @@ #include <signal.h> #endif -#define TLS_D -#define TLS_DC -#define TLS_C -#define TLS_CC -#define TLS_FETCH() - - FCGX_Stream *in, *out, *err; FCGX_ParamArray envp; char *path_info = NULL; @@ -124,12 +117,12 @@ static void sapi_fastcgi_send_header(sapi_header_struct *sapi_header, void *serv FCGX_PutStr( "\r\n", 2, out ); } -static int sapi_fastcgi_read_post(char *buffer, uint count_bytes SLS_DC) +static int sapi_fastcgi_read_post(char *buffer, uint count_bytes TSRMLS_DC) { size_t read_bytes = 0, tmp; int c; char *pos = buffer; - TLS_FETCH(); + TSRMLS_FETCH(); while( count_bytes ) { c = FCGX_GetStr( pos, count_bytes, in ); @@ -141,13 +134,13 @@ static int sapi_fastcgi_read_post(char *buffer, uint count_bytes SLS_DC) return read_bytes; } -static char *sapi_fastcgi_read_cookies(SLS_D) +static char *sapi_fastcgi_read_cookies(TSRMLS_D) { return getenv( "HTTP_COOKIE" ); } -static void sapi_fastcgi_register_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS_DC) +static void sapi_fastcgi_register_variables(zval *track_vars_array TSRMLS_DC TSRMLS_DC TSRMLS_DC) { char *self = getenv("REQUEST_URI"); char *ptr = strchr( self, '?' ); @@ -162,7 +155,7 @@ static void sapi_fastcgi_register_variables(zval *track_vars_array TSRMLS_DC SLS /* strip query string off this */ if ( ptr ) *ptr = 0; - php_register_variable( "PHP_SELF", getenv("REQUEST_URI"), track_vars_array TSRMLS_CC PLS_CC); + php_register_variable( "PHP_SELF", getenv("REQUEST_URI"), track_vars_array TSRMLS_CC); if ( ptr ) *ptr = '?'; } @@ -199,26 +192,25 @@ static sapi_module_struct fastcgi_sapi_module = { STANDARD_SAPI_MODULE_PROPERTIES }; -static void fastcgi_module_main(TLS_D SLS_DC) +static void fastcgi_module_main(TSRMLS_D TSRMLS_DC) { zend_file_handle file_handle; - CLS_FETCH(); TSRMLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); file_handle.type = ZEND_HANDLE_FILENAME; file_handle.filename = SG(request_info).path_translated; file_handle.free_filename = 0; file_handle.opened_path = NULL; - if (php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC) == SUCCESS) { - php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + if (php_request_startup(TSRMLS_C) == SUCCESS) { + php_execute_script(&file_handle TSRMLS_CC); php_request_shutdown(NULL); } } -static void init_request_info( SLS_D ) +static void init_request_info( TSRMLS_D ) { char *content_length = getenv("CONTENT_LENGTH"); char *content_type = getenv( "CONTENT_TYPE" ); @@ -275,7 +267,7 @@ static void init_request_info( SLS_D ) #ifdef DEBUG_FASTCGI fprintf( stderr, "Authorization: %s\n", auth ); #endif - php_handle_auth_data(auth SLS_CC); + php_handle_auth_data(auth TSRMLS_CC); } @@ -480,13 +472,13 @@ int main(int argc, char *argv[]) cgi_env, (cgi_env_size+1)*sizeof(char *) ); environ = merge_env; - init_request_info( TLS_C SLS_CC ); + init_request_info(TSRMLS_C); SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */ CG(extended_info) = 0; SG(request_info).argv0 = argv0; zend_llist_init(&global_vars, sizeof(char *), NULL, 0); - fastcgi_module_main( TLS_C SLS_CC ); + fastcgi_module_main(TSRMLS_C); if( path_info ) { free( path_info ); path_info = NULL; diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c index 6074fcb216..8526665233 100644 --- a/sapi/isapi/php4isapi.c +++ b/sapi/isapi/php4isapi.c @@ -156,7 +156,7 @@ static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS) }; char ***server_variable_names; LPEXTENSION_CONTROL_BLOCK lpECB; - SLS_FETCH(); + TSRMLS_FETCH(); lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); @@ -204,7 +204,7 @@ static int sapi_isapi_ub_write(const char *str, uint str_length) { DWORD num_bytes = str_length; LPEXTENSION_CONTROL_BLOCK ecb; - SLS_FETCH(); + TSRMLS_FETCH(); ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); if (ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC ) == FALSE) { @@ -214,7 +214,7 @@ static int sapi_isapi_ub_write(const char *str, uint str_length) } -static int sapi_isapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC) +static int sapi_isapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) { return SAPI_HEADER_ADD; } @@ -238,7 +238,7 @@ static void concat_header(sapi_header_struct *sapi_header, char **combined_heade } -static int sapi_isapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +static int sapi_isapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { uint total_length = 2; /* account for the trailing \r\n */ char *combined_headers, *combined_headers_ptr; @@ -246,11 +246,11 @@ static int sapi_isapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) HSE_SEND_HEADER_EX_INFO header_info; char status_buf[MAX_STATUS_LENGTH]; sapi_header_struct default_content_type; - PLS_FETCH(); + TSRMLS_FETCH(); /* Obtain headers length */ if (SG(sapi_headers).send_default_content_type) { - sapi_get_default_content_type_header(&default_content_type SLS_CC); + sapi_get_default_content_type_header(&default_content_type TSRMLS_CC); accumulate_header_length(&default_content_type, (void *) &total_length); } zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) accumulate_header_length, (void *) &total_length); @@ -307,7 +307,7 @@ static int php_isapi_startup(sapi_module_struct *sapi_module) -static int sapi_isapi_read_post(char *buffer, uint count_bytes SLS_DC) +static int sapi_isapi_read_post(char *buffer, uint count_bytes TSRMLS_DC) { LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); DWORD read_from_buf=0; @@ -337,7 +337,7 @@ static int sapi_isapi_read_post(char *buffer, uint count_bytes SLS_DC) } -static char *sapi_isapi_read_cookies(SLS_D) +static char *sapi_isapi_read_cookies(TSRMLS_D) { LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); char variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; @@ -361,7 +361,7 @@ static char *sapi_isapi_read_cookies(SLS_D) #ifdef WITH_ZEUS -static void sapi_isapi_register_zeus_ssl_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC PLS_DC) +static void sapi_isapi_register_zeus_ssl_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC) { char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; @@ -379,7 +379,7 @@ static void sapi_isapi_register_zeus_ssl_variables(LPEXTENSION_CONTROL_BLOCK lpE if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_ST", static_variable_buf, &variable_len ) && static_variable_buf[0] ) { strcat( static_cons_buf, static_variable_buf ); } - php_register_variable( "SSL_CLIENT_DN", static_cons_buf, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( "SSL_CLIENT_DN", static_cons_buf, track_vars_array TSRMLS_CC ); strcpy( static_cons_buf, "/C=" ); variable_len = ISAPI_SERVER_VAR_BUF_SIZE; @@ -391,10 +391,10 @@ static void sapi_isapi_register_zeus_ssl_variables(LPEXTENSION_CONTROL_BLOCK lpE if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_ST", static_variable_buf, &variable_len ) && static_variable_buf[0] ) { strcat( static_cons_buf, static_variable_buf ); } - php_register_variable( "SSL_CLIENT_I_DN", static_cons_buf, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( "SSL_CLIENT_I_DN", static_cons_buf, track_vars_array TSRMLS_CC ); } -static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC PLS_DC) +static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC) { char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; @@ -413,11 +413,11 @@ static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_INFO", static_variable_buf, &variable_len) && static_variable_buf[0] ) { /* PHP_SELF is just PATH_INFO */ - php_register_variable( "PHP_SELF", static_variable_buf, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( "PHP_SELF", static_variable_buf, track_vars_array TSRMLS_CC ); /* Chop off filename to get just the 'real' PATH_INFO' */ pathinfo_len = variable_len - scriptname_len; - php_register_variable( "PATH_INFO", static_variable_buf + scriptname_len - 1, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( "PATH_INFO", static_variable_buf + scriptname_len - 1, track_vars_array TSRMLS_CC ); /* append query string to give url... extra byte for '?' */ if ( strlen(lpECB->lpszQueryString) + variable_len + 1 < ISAPI_SERVER_VAR_BUF_SIZE ) { /* append query string only if it is present... */ @@ -425,8 +425,8 @@ static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, static_variable_buf[ variable_len - 1 ] = '?'; strcpy( static_variable_buf + variable_len, lpECB->lpszQueryString ); } - php_register_variable( "URL", static_variable_buf, track_vars_array TSRMLS_CC PLS_CC ); - php_register_variable( "REQUEST_URI", static_variable_buf, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( "URL", static_variable_buf, track_vars_array TSRMLS_CC ); + php_register_variable( "REQUEST_URI", static_variable_buf, track_vars_array TSRMLS_CC ); } } @@ -434,38 +434,38 @@ static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, variable_len = ISAPI_SERVER_VAR_BUF_SIZE; if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_TRANSLATED", static_variable_buf, &variable_len) && static_variable_buf[0] ) { static_variable_buf[ variable_len - pathinfo_len - 1 ] = '\0'; - php_register_variable( "PATH_TRANSLATED", static_variable_buf, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( "PATH_TRANSLATED", static_variable_buf, track_vars_array TSRMLS_CC ); } /* Bring in the AUTHENTICATION stuff as needed */ variable_len = ISAPI_SERVER_VAR_BUF_SIZE; if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_USER", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - php_register_variable( "PHP_AUTH_USER", static_variable_buf, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( "PHP_AUTH_USER", static_variable_buf, track_vars_array TSRMLS_CC ); } variable_len = ISAPI_SERVER_VAR_BUF_SIZE; if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_PASSWORD", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - php_register_variable( "PHP_AUTH_PW", static_variable_buf, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( "PHP_AUTH_PW", static_variable_buf, track_vars_array TSRMLS_CC ); } variable_len = ISAPI_SERVER_VAR_BUF_SIZE; if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_TYPE", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - php_register_variable( "PHP_AUTH_TYPE", static_variable_buf, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( "PHP_AUTH_TYPE", static_variable_buf, track_vars_array TSRMLS_CC ); } /* And now, for the SSL variables (if applicable) */ variable_len = ISAPI_SERVER_VAR_BUF_SIZE; if ( lpECB->GetServerVariable(lpECB->ConnID, "CERT_COOKIE", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - sapi_isapi_register_zeus_ssl_variables( lpECB, track_vars_array TSRMLS_CC PLS_CC ); + sapi_isapi_register_zeus_ssl_variables( lpECB, track_vars_array TSRMLS_CC ); } /* Copy some of the variables we need to meet Apache specs */ variable_len = ISAPI_SERVER_VAR_BUF_SIZE; if ( lpECB->GetServerVariable(lpECB->ConnID, "SERVER_SOFTWARE", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - php_register_variable( "SERVER_SIGNATURE", static_variable_buf, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( "SERVER_SIGNATURE", static_variable_buf, track_vars_array TSRMLS_CC ); } } #endif -static void sapi_isapi_register_server_variables2(char **server_variables, LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array, char **recorded_values TSRMLS_DC PLS_DC) +static void sapi_isapi_register_server_variables2(char **server_variables, LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array, char **recorded_values TSRMLS_DC) { char **p=server_variables; DWORD variable_len; @@ -476,7 +476,7 @@ static void sapi_isapi_register_server_variables2(char **server_variables, LPEXT variable_len = ISAPI_SERVER_VAR_BUF_SIZE; if (lpECB->GetServerVariable(lpECB->ConnID, *p, static_variable_buf, &variable_len) && static_variable_buf[0]) { - php_register_variable(*p, static_variable_buf, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable(*p, static_variable_buf, track_vars_array TSRMLS_CC); if (recorded_values) { recorded_values[p-server_variables] = estrndup(static_variable_buf, variable_len); } @@ -484,7 +484,7 @@ static void sapi_isapi_register_server_variables2(char **server_variables, LPEXT variable_buf = (char *) emalloc(variable_len); if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len) && variable_buf[0]) { - php_register_variable(*p, variable_buf, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable(*p, variable_buf, track_vars_array TSRMLS_CC); } if (recorded_values) { recorded_values[p-server_variables] = variable_buf; @@ -497,7 +497,7 @@ static void sapi_isapi_register_server_variables2(char **server_variables, LPEXT } -static void sapi_isapi_register_server_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS_DC) +static void sapi_isapi_register_server_variables(zval *track_vars_array TSRMLS_DC TSRMLS_DC TSRMLS_DC) { DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; char *variable; @@ -509,18 +509,18 @@ static void sapi_isapi_register_server_variables(zval *track_vars_array TSRMLS_D /* Register the special ISAPI variables */ memset(isapi_special_server_variables, 0, sizeof(isapi_special_server_variables)); - sapi_isapi_register_server_variables2(isapi_special_server_variable_names, lpECB, track_vars_array, isapi_special_server_variables TSRMLS_CC PLS_CC); + sapi_isapi_register_server_variables2(isapi_special_server_variable_names, lpECB, track_vars_array, isapi_special_server_variables TSRMLS_CC); if (SG(request_info).cookie_data) { - php_register_variable("HTTP_COOKIE", SG(request_info).cookie_data, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("HTTP_COOKIE", SG(request_info).cookie_data, track_vars_array TSRMLS_CC); } /* Register the standard ISAPI variables */ - sapi_isapi_register_server_variables2(isapi_server_variable_names, lpECB, track_vars_array, NULL TSRMLS_CC PLS_CC); + sapi_isapi_register_server_variables2(isapi_server_variable_names, lpECB, track_vars_array, NULL TSRMLS_CC); if (isapi_special_server_variables[SPECIAL_VAR_HTTPS] && atoi(isapi_special_server_variables[SPECIAL_VAR_HTTPS])) { /* Register SSL ISAPI variables */ - sapi_isapi_register_server_variables2(isapi_secure_server_variable_names, lpECB, track_vars_array, NULL TSRMLS_CC PLS_CC); + sapi_isapi_register_server_variables2(isapi_secure_server_variable_names, lpECB, track_vars_array, NULL TSRMLS_CC); } if (isapi_special_server_variables[SPECIAL_VAR_HTTPS]) { @@ -529,12 +529,12 @@ static void sapi_isapi_register_server_variables(zval *track_vars_array TSRMLS_D #ifdef WITH_ZEUS - sapi_isapi_register_zeus_variables(lpECB, track_vars_array TSRMLS_CC PLS_CC); + sapi_isapi_register_zeus_variables(lpECB, track_vars_array TSRMLS_CC); #endif /* PHP_SELF support */ if (isapi_special_server_variables[SPECIAL_VAR_PHP_SELF]) { - php_register_variable("PHP_SELF", isapi_special_server_variables[SPECIAL_VAR_PHP_SELF], track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("PHP_SELF", isapi_special_server_variables[SPECIAL_VAR_PHP_SELF], track_vars_array TSRMLS_CC); efree(isapi_special_server_variables[SPECIAL_VAR_PHP_SELF]); } @@ -551,7 +551,7 @@ static void sapi_isapi_register_server_variables(zval *track_vars_array TSRMLS_D value++; } *colon = 0; - php_register_variable(variable, value, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable(variable, value, track_vars_array TSRMLS_CC); *colon = ':'; } variable = php_strtok_r(NULL, "\r\n", &strtok_buf); @@ -570,7 +570,7 @@ static void sapi_isapi_register_server_variables(zval *track_vars_array TSRMLS_D if (humi.lpszPath[path_len-2] == '\\') { humi.lpszPath[path_len-2] = 0; } - php_register_variable("DOCUMENT_ROOT", humi.lpszPath, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("DOCUMENT_ROOT", humi.lpszPath, track_vars_array TSRMLS_CC); } } #endif @@ -623,7 +623,7 @@ BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pFilterVersion) DWORD WINAPI HttpFilterProc(PHTTP_FILTER_CONTEXT pfc, DWORD notificationType, LPVOID pvNotification) { - SLS_FETCH(); + TSRMLS_FETCH(); switch (notificationType) { case SF_NOTIFY_PREPROC_HEADERS: @@ -663,7 +663,7 @@ static void init_request_info(sapi_globals_struct *sapi_globals, LPEXTENSION_CON } -static void php_isapi_report_exception(char *message, int message_len SLS_DC) +static void php_isapi_report_exception(char *message, int message_len TSRMLS_DC) { if (!SG(headers_sent)) { HSE_SEND_HEADER_EX_INFO header_info; @@ -718,10 +718,9 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) { zend_file_handle file_handle; zend_bool stack_overflown=0; - SLS_FETCH(); - CLS_FETCH(); TSRMLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); + TSRMLS_FETCH(); #ifdef PHP_ENABLE_SEH LPEXCEPTION_POINTERS e; #endif @@ -757,8 +756,8 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) file_handle.type = ZEND_HANDLE_FILENAME; file_handle.opened_path = NULL; - php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC); - php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + php_request_startup(TSRMLS_C); + php_execute_script(&file_handle TSRMLS_CC); if (SG(request_info).cookie_data) { efree(SG(request_info).cookie_data); } @@ -794,14 +793,14 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) CG(unclean_shutdown)=1; _snprintf(buf,sizeof(buf)-1,"PHP has encountered a Stack overflow"); - php_isapi_report_exception(buf, strlen(buf) SLS_CC); + php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC); } else if (_exception_code()==EXCEPTION_ACCESS_VIOLATION) { _snprintf(buf,sizeof(buf)-1,"PHP has encountered an Access Violation at %p",e->ExceptionRecord->ExceptionAddress); - php_isapi_report_exception(buf, strlen(buf) SLS_CC); + php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC); my_endthread(); } else { _snprintf(buf,sizeof(buf)-1,"PHP has encountered an Unhandled Exception Code %d at %p",e->ExceptionRecord->ExceptionCode , e->ExceptionRecord->ExceptionAddress); - php_isapi_report_exception(buf, strlen(buf) SLS_CC); + php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC); my_endthread(); } #endif diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c index 32710d2e1e..0ed677a96d 100644 --- a/sapi/nsapi/nsapi.c +++ b/sapi/nsapi/nsapi.c @@ -140,7 +140,7 @@ sapi_nsapi_ub_write(const char *str, unsigned int str_length) int retval; nsapi_request_context *rc; - SLS_FETCH(); + TSRMLS_FETCH(); rc = (nsapi_request_context *)SG(server_context); retval = net_write(rc->sn->csd, (char *)str, str_length); if (retval == IO_ERROR /*-1*/ || retval == IO_EOF /*0*/) @@ -278,7 +278,7 @@ sapi_nsapi_read_cookies(SLS_D) } static void -sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS_DC) +sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_DC SLS_DC TSRMLS_DC) { nsapi_request_context *rc = (nsapi_request_context *)SG(server_context); size_t i; @@ -288,55 +288,55 @@ sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS for (i = 0; i < nsapi_reqpb_size; i++) { value = pblock_findval(nsapi_reqpb[i].nsapi_eq, rc->rq->reqpb); if (value) { - php_register_variable( (char *)nsapi_reqpb[i].env_var, value, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( (char *)nsapi_reqpb[i].env_var, value, track_vars_array TSRMLS_CC ); } } for (i = 0; i < nsapi_headers_size; i++) { value = pblock_findval(nsapi_headers[i].nsapi_eq, rc->rq->headers); if (value) { - php_register_variable( (char *)nsapi_headers[i].env_var, value, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( (char *)nsapi_headers[i].env_var, value, track_vars_array TSRMLS_CC ); } } for (i = 0; i < nsapi_vars_size; i++) { value = pblock_findval(nsapi_vars[i].nsapi_eq, rc->rq->vars); if (value) { - php_register_variable( (char *)nsapi_vars[i].env_var, value, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( (char *)nsapi_vars[i].env_var, value, track_vars_array TSRMLS_CC ); } } for (i = 0; i < nsapi_client_size; i++) { value = pblock_findval(nsapi_client[i].nsapi_eq, rc->sn->client); if (value) { - php_register_variable( (char *)nsapi_client[i].env_var, value, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable( (char *)nsapi_client[i].env_var, value, track_vars_array TSRMLS_CC ); } } value = session_dns(rc->sn); if (value) { - php_register_variable("REMOTE_HOST", value, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable("REMOTE_HOST", value, track_vars_array TSRMLS_CC ); } sprintf(buf, "%d", conf_getglobals()->Vport); - php_register_variable("SERVER_PORT", buf, track_vars_array TSRMLS_CC PLS_CC ); - php_register_variable("SERVER_NAME", util_hostname(), track_vars_array TSRMLS_CC PLS_CC ); - php_register_variable("SERVER_URL", http_uri2url("", ""), track_vars_array TSRMLS_CC PLS_CC ); - php_register_variable("HTTPS", (security_active ? "ON" : "OFF"), track_vars_array TSRMLS_CC PLS_CC ); -/* php_register_variable("SERVER_SOFTWARE", MAGNUS_VERSION_STRING, track_vars_array TSRMLS_CC PLS_CC ); */ + php_register_variable("SERVER_PORT", buf, track_vars_array TSRMLS_CC ); + php_register_variable("SERVER_NAME", util_hostname(), track_vars_array TSRMLS_CC ); + php_register_variable("SERVER_URL", http_uri2url("", ""), track_vars_array TSRMLS_CC ); + php_register_variable("HTTPS", (security_active ? "ON" : "OFF"), track_vars_array TSRMLS_CC ); +/* php_register_variable("SERVER_SOFTWARE", MAGNUS_VERSION_STRING, track_vars_array TSRMLS_CC ); */ /* * Special PHP_SELF variable. */ value = pblock_findval("uri", rc->rq->reqpb); if ( value != NULL ) { - php_register_variable("PHP_SELF", value, track_vars_array TSRMLS_CC PLS_CC ); + php_register_variable("PHP_SELF", value, track_vars_array TSRMLS_CC ); } } static void nsapi_log_message(char *message) { - SLS_FETCH(); + TSRMLS_FETCH(); nsapi_request_context *rc = (nsapi_request_context *)SG(server_context); log_error(LOG_INFORM, "PHP_log_message", rc->sn, rc->rq, "%s", message); @@ -447,12 +447,10 @@ nsapi_module_main(NSLS_D SLS_DC) { int result; zend_file_handle file_handle; - - CLS_FETCH(); TSRMLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); - if (php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC) == FAILURE) { + if (php_request_startup(TSRMLS_C) == FAILURE) { return FAILURE; } @@ -466,7 +464,7 @@ nsapi_module_main(NSLS_D SLS_DC) "Parsing [%s]", SG(request_info).path_translated); #endif - php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + php_execute_script(&file_handle TSRMLS_CC); php_request_shutdown(NULL); #if defined(NSAPI_DEBUG) @@ -506,7 +504,7 @@ php4_execute(pblock *pb, Session *sn, Request *rq) int retval; nsapi_request_context *request_context; - SLS_FETCH(); + TSRMLS_FETCH(); request_context = (nsapi_request_context *)MALLOC(sizeof(nsapi_request_context)); request_context->pb = pb; diff --git a/sapi/phttpd/phttpd.c b/sapi/phttpd/phttpd.c index 7ea34fc795..a7fbebcde1 100644 --- a/sapi/phttpd/phttpd.c +++ b/sapi/phttpd/phttpd.c @@ -38,12 +38,7 @@ typedef struct { static int ph_globals_id; -#define PHLS_D phttpd_globals_struct *ph_context -#define PHLS_DC , PHLS_D -#define PHLS_C ph_context -#define PHLS_CC , PHLS_C -#define PHG(v) (ph_context->v) -#define PHLS_FETCH() phttpd_globals_struct *ph_context = ts_resource(ph_globals_id) +#define PHG(v) TSRMG(ph_globals_id, phttpd_globals_struct *, v) static int php_phttpd_startup(sapi_module_struct *sapi_module) @@ -65,7 +60,7 @@ static int php_phttpd_sapi_ub_write(const char *str, uint str_length) { int sent_bytes; - PHLS_FETCH(); + TSRMLS_FETCH(); sent_bytes = fd_write(PHG(cip)->fd,str,str_length); @@ -77,11 +72,11 @@ php_phttpd_sapi_ub_write(const char *str, uint str_length) } static int -php_phttpd_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC) +php_phttpd_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) { char *header_name, *header_content; char *p; - PHLS_FETCH(); + TSRMLS_FETCH(); http_sendheaders(PHG(cip)->fd,PHG(cip), SG(sapi_headers).http_response_code, NULL); @@ -105,9 +100,9 @@ php_phttpd_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_str } static int -php_phttpd_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +php_phttpd_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { - PHLS_FETCH(); + TSRMLS_FETCH(); if (SG(sapi_headers).send_default_content_type) { fd_printf(PHG(cip)->fd,"Content-Type: text/html\n"); @@ -119,13 +114,13 @@ php_phttpd_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) } static char * -php_phttpd_sapi_read_cookies(SLS_D) +php_phttpd_sapi_read_cookies(TSRMLS_D) { /* int i; char *http_cookie = NULL; - NSLS_FETCH(); + NTSRMLS_FETCH(); i = Ns_SetIFind(NSG(conn->headers), "cookie"); if(i != -1) { @@ -140,12 +135,12 @@ php_phttpd_sapi_read_cookies(SLS_D) } static int -php_phttpd_sapi_read_post(char *buf, uint count_bytes SLS_DC) +php_phttpd_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC) { /* uint max_read; uint total_read = 0; - NSLS_FETCH(); + NTSRMLS_FETCH(); max_read = MIN(NSG(data_avail), count_bytes); @@ -197,7 +192,7 @@ static sapi_module_struct phttpd_sapi_module = { }; static void -php_phttpd_request_ctor(PHLS_D SLS_DC) +php_phttpd_request_ctor(TSRMLS_D TSRMLS_DC) { memset(&SG(request_info),0,sizeof(sapi_globals_struct)); /* pfusch! */ @@ -248,23 +243,21 @@ php_phttpd_request_ctor(PHLS_D SLS_DC) } static void -php_phttpd_request_dtor(PHLS_D SLS_DC) +php_phttpd_request_dtor(TSRMLS_D TSRMLS_DC) { free(SG(request_info).path_translated); } -int php_doit(PHLS_D SLS_DC) +int php_doit(TSRMLS_D TSRMLS_DC) { struct stat sb; zend_file_handle file_handle; struct httpinfo *hip = PHG(cip)->hip; - - CLS_FETCH(); TSRMLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); - if (php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC) == FAILURE) { + if (php_request_startup(TSRMLS_C) == FAILURE) { return -1; } @@ -273,9 +266,9 @@ int php_doit(PHLS_D SLS_DC) file_handle.free_filename = 0; /* - php_phttpd_hash_environment(PHLS_C CLS_CC TSRMLS_CC PLS_CC SLS_CC); + php_phttpd_hash_environment(TSRMLS_C); */ - php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + php_execute_script(&file_handle TSRMLS_CC); php_request_shutdown(NULL); return SG(sapi_headers).http_response_code; @@ -301,17 +294,17 @@ int pm_request(struct connectioninfo *cip) { struct httpinfo *hip = cip->hip; int status; - PHLS_FETCH(); - SLS_FETCH(); + TSRMLS_FETCH(); + TSRMLS_FETCH(); if (strcasecmp(hip->method, "GET") == 0 || strcasecmp(hip->method, "HEAD") == 0 || strcasecmp(hip->method, "POST") == 0) { PHG(cip) = cip; - php_phttpd_request_ctor(PHLS_C SLS_CC); - status = php_doit(PHLS_C SLS_CC); - php_phttpd_request_dtor(PHLS_C SLS_CC); + php_phttpd_request_ctor(TSRMLS_C); + status = php_doit(TSRMLS_C); + php_phttpd_request_dtor(TSRMLS_C); return status; } else { diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c index 30eb7ba36e..120cf91c72 100644 --- a/sapi/pi3web/pi3web_sapi.c +++ b/sapi/pi3web/pi3web_sapi.c @@ -71,7 +71,7 @@ static void php_info_pi3web(ZEND_MODULE_INFO_FUNC_ARGS) char variable_buf[PI3WEB_SERVER_VAR_BUF_SIZE]; DWORD variable_len; LPCONTROL_BLOCK lpCB; - SLS_FETCH(); + TSRMLS_FETCH(); lpCB = (LPCONTROL_BLOCK) SG(server_context); @@ -137,7 +137,7 @@ static int zend_pi3web_ub_write(const char *str, uint str_length) { DWORD num_bytes = str_length; LPCONTROL_BLOCK cb; - SLS_FETCH(); + TSRMLS_FETCH(); cb = (LPCONTROL_BLOCK) SG(server_context); @@ -150,7 +150,7 @@ static int zend_pi3web_ub_write(const char *str, uint str_length) } -static int sapi_pi3web_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC) +static int sapi_pi3web_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) { return SAPI_HEADER_ADD; } @@ -174,19 +174,19 @@ static void concat_header(sapi_header_struct *sapi_header, char **combined_heade } -static int sapi_pi3web_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +static int sapi_pi3web_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { uint total_length = 2; /* account for the trailing \r\n */ char *combined_headers, *combined_headers_ptr; LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context); sapi_header_struct default_content_type; - PLS_FETCH(); + TSRMLS_FETCH(); if ( !IWasLoaded ) return SAPI_HEADER_SENT_SUCCESSFULLY; if (SG(sapi_headers).send_default_content_type) { - sapi_get_default_content_type_header(&default_content_type SLS_CC); + sapi_get_default_content_type_header(&default_content_type TSRMLS_CC); accumulate_header_length(&default_content_type, (void *) &total_length); } zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) accumulate_header_length, (void *) &total_length); @@ -225,7 +225,7 @@ static int php_pi3web_startup(sapi_module_struct *sapi_module) } -static int sapi_pi3web_read_post(char *buffer, uint count_bytes SLS_DC) +static int sapi_pi3web_read_post(char *buffer, uint count_bytes TSRMLS_DC) { LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context); DWORD read_from_buf=0; @@ -256,7 +256,7 @@ static int sapi_pi3web_read_post(char *buffer, uint count_bytes SLS_DC) } -static char *sapi_pi3web_read_cookies(SLS_D) +static char *sapi_pi3web_read_cookies(TSRMLS_D) { LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context); char variable_buf[PI3WEB_SERVER_VAR_BUF_SIZE]; @@ -320,7 +320,7 @@ static void init_request_info(sapi_globals_struct *sapi_globals, LPCONTROL_BLOCK SG(sapi_headers).http_response_code = 200; } -static void hash_pi3web_variables(TSRMLS_D SLS_DC) +static void hash_pi3web_variables(TSRMLS_D TSRMLS_DC) { char static_variable_buf[PI3WEB_SERVER_VAR_BUF_SIZE]; char *variable_buf; @@ -377,10 +377,9 @@ DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) zend_file_handle file_handle; char *header_line; int iRet = PIAPI_COMPLETED; - SLS_FETCH(); - CLS_FETCH(); TSRMLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); + TSRMLS_FETCH(); zend_try { file_handle.filename = lpCB->lpszFileName; @@ -390,18 +389,18 @@ DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) CG(extended_info) = 0; init_request_info(sapi_globals, lpCB); - php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC); + php_request_startup(TSRMLS_C); - hash_pi3web_variables(TSRMLS_C SLS_CC); + hash_pi3web_variables(TSRMLS_C); switch ( lpCB->dwBehavior ) { case PHP_MODE_STANDARD: - iRet = ( php_execute_script( &file_handle CLS_CC TSRMLS_CC PLS_CC ) == SUCCESS ) ? + iRet = ( php_execute_script( &file_handle TSRMLS_CC ) == SUCCESS ) ? PIAPI_COMPLETED : PIAPI_ERROR; break; case PHP_MODE_HIGHLIGHT: { zend_syntax_highlighter_ini syntax_highlighter_ini; - if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) + if ( open_file_for_scanning( &file_handle TSRMLS_CC ) == SUCCESS ) { php_get_highlight_struct( &syntax_highlighter_ini ); zend_highlight( &syntax_highlighter_ini ); @@ -415,7 +414,7 @@ DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) case PHP_MODE_INDENT: header_line = (char *)estrdup("Content-Type: text/plain"); sapi_add_header_ex(header_line, strlen(header_line), 1, 1); - if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) + if ( open_file_for_scanning( &file_handle TSRMLS_CC ) == SUCCESS ) { zend_indent(); } @@ -426,7 +425,7 @@ DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) efree(header_line); break; case PHP_MODE_LINT: - iRet = (php_lint_script(&file_handle CLS_CC TSRMLS_CC PLS_CC) == SUCCESS) ? + iRet = (php_lint_script(&file_handle TSRMLS_CC) == SUCCESS) ? PIAPI_COMPLETED : PIAPI_ERROR; break; default: diff --git a/sapi/roxen/roxen.c b/sapi/roxen/roxen.c index 407cba1989..bad3621e7d 100644 --- a/sapi/roxen/roxen.c +++ b/sapi/roxen/roxen.c @@ -215,7 +215,7 @@ php_roxen_low_ub_write(const char *str, uint str_length) { int sent_bytes = 0; struct pike_string *to_write = NULL; #ifdef ZTS - PLS_FETCH(); + TSRMLS_FETCH(); #endif #ifdef ROXEN_USE_ZTS GET_THIS(); @@ -247,7 +247,7 @@ static int php_roxen_sapi_ub_write(const char *str, uint str_length) { #ifdef ZTS - PLS_FETCH(); + TSRMLS_FETCH(); #endif #ifdef ROXEN_USE_ZTS GET_THIS(); @@ -328,7 +328,7 @@ static void php_roxen_set_header(char *header_name, char *value, char *p) */ static int php_roxen_sapi_header_handler(sapi_header_struct *sapi_header, - sapi_headers_struct *sapi_headers SLS_DC) + sapi_headers_struct *sapi_headers TSRMLS_DC) { char *header_name, *header_content, *p; header_name = sapi_header->header; @@ -350,10 +350,10 @@ php_roxen_sapi_header_handler(sapi_header_struct *sapi_header, */ static int -php_roxen_low_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +php_roxen_low_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { #ifdef ZTS - PLS_FETCH(); + TSRMLS_FETCH(); #endif struct pike_string *ind; struct svalue *s_headermap; @@ -381,10 +381,10 @@ php_roxen_low_send_headers(sapi_headers_struct *sapi_headers SLS_DC) } static int -php_roxen_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +php_roxen_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { int res = 0; - THREAD_SAFE_RUN(res = php_roxen_low_send_headers(sapi_headers SLS_CC), "send headers"); + THREAD_SAFE_RUN(res = php_roxen_low_send_headers(sapi_headers TSRMLS_CC), "send headers"); return res; } @@ -400,7 +400,7 @@ INLINE static int php_roxen_low_read_post(char *buf, uint count_bytes) GET_THIS(); #endif #ifdef ZTS - PLS_FETCH(); + TSRMLS_FETCH(); #endif if(!MY_FD_OBJ->prog) @@ -422,7 +422,7 @@ INLINE static int php_roxen_low_read_post(char *buf, uint count_bytes) } static int -php_roxen_sapi_read_post(char *buf, uint count_bytes SLS_DC) +php_roxen_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC) { uint total_read = 0; THREAD_SAFE_RUN(total_read = php_roxen_low_read_post(buf, count_bytes), "read post"); @@ -435,7 +435,7 @@ php_roxen_sapi_read_post(char *buf, uint count_bytes SLS_DC) */ static char * -php_roxen_sapi_read_cookies(SLS_D) +php_roxen_sapi_read_cookies(TSRMLS_D) { char *cookies; cookies = lookup_string_header("HTTP_COOKIE", NULL); @@ -528,7 +528,7 @@ static sapi_module_struct roxen_sapi_module = { &pval, sizeof(zval *), NULL) static void -php_roxen_hash_environment(CLS_D TSRMLS_DC PLS_DC SLS_DC) +php_roxen_hash_environment(TSRMLS_D) { int i; char buf[512]; @@ -578,14 +578,13 @@ php_roxen_hash_environment(CLS_D TSRMLS_DC PLS_DC SLS_DC) * "executes" the script */ -static int php_roxen_module_main(SLS_D) +static int php_roxen_module_main(TSRMLS_D) { int res, len; char *dir; zend_file_handle file_handle; #ifdef ZTS - CLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); TSRMLS_FETCH(); #ifdef ROXEN_USE_ZTS GET_THIS(); @@ -598,14 +597,14 @@ static int php_roxen_module_main(SLS_D) file_handle.opened_path = NULL; THREADS_ALLOW(); - res = php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC); + res = php_request_startup(TSRMLS_C); THREADS_DISALLOW(); if(res == FAILURE) { return 0; } - php_roxen_hash_environment(CLS_C TSRMLS_CC PLS_CC SLS_CC); + php_roxen_hash_environment(TSRMLS_C); THREADS_ALLOW(); - php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + php_execute_script(&file_handle TSRMLS_CC); php_request_shutdown(NULL); THREADS_DISALLOW(); return 1; @@ -623,7 +622,7 @@ void f_php_roxen_request_handler(INT32 args) struct svalue *done_callback, *raw_fd; struct pike_string *script, *ind; int status = 1; - SLS_FETCH(); + TSRMLS_FETCH(); #ifdef ROXEN_USE_ZTS GET_THIS(); #endif @@ -675,7 +674,7 @@ void f_php_roxen_request_handler(INT32 args) } else THIS->my_fd = 0; - status = php_roxen_module_main(SLS_C); + status = php_roxen_module_main(TSRMLS_C); current_thread = -1; apply_svalue(done_callback, 0); diff --git a/sapi/servlet/servlet.c b/sapi/servlet/servlet.c index 14f2a42a8a..fccdf017d0 100644 --- a/sapi/servlet/servlet.c +++ b/sapi/servlet/servlet.c @@ -116,7 +116,7 @@ void ThrowServletException (JNIEnv *jenv, char *msg) { static int sapi_servlet_ub_write(const char *str, uint str_length) { - SLS_FETCH(); + TSRMLS_FETCH(); if (!SG(server_context)) { fprintf(stderr, str); return 0; @@ -144,7 +144,7 @@ static int sapi_servlet_ub_write(const char *str, uint str_length) static void sapi_servlet_send_header(sapi_header_struct *sapi_header, void *server_context) { - SLS_FETCH(); + TSRMLS_FETCH(); if (!sapi_header) return; if (!SG(server_context)) return; @@ -162,7 +162,7 @@ static void sapi_servlet_send_header(sapi_header_struct *sapi_header, void *serv } -static int sapi_servlet_read_post(char *buffer, uint count_bytes SLS_DC) +static int sapi_servlet_read_post(char *buffer, uint count_bytes TSRMLS_DC) { if (count_bytes == 0) { return 0; @@ -190,7 +190,7 @@ static int sapi_servlet_read_post(char *buffer, uint count_bytes SLS_DC) } -static char *sapi_servlet_read_cookies(SLS_D) +static char *sapi_servlet_read_cookies(TSRMLS_D) { JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv; jobject servlet = ((servlet_request*)SG(server_context))->servlet; @@ -318,9 +318,8 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send #ifndef VIRTUAL_DIR char cwd[MAXPATHLEN]; #endif - SLS_FETCH(); - PLS_FETCH(); - CLS_FETCH(); + TSRMLS_FETCH(); + TSRMLS_FETCH(); TSRMLS_FETCH(); zend_try { @@ -342,7 +341,7 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send SG(sapi_headers).http_response_code = 200; SG(request_info).content_length = contentLength; SG(request_info).auth_password = NULL; - if (php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC)==FAILURE) { + if (php_request_startup(TSRMLS_C)==FAILURE) { ThrowServletException(jenv,"request startup failure"); return; } @@ -379,13 +378,13 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send if (display_source_mode) { zend_syntax_highlighter_ini syntax_highlighter_ini; - if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) { + if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) { php_get_highlight_struct(&syntax_highlighter_ini); sapi_send_headers(); zend_highlight(&syntax_highlighter_ini); } } else { - php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + php_execute_script(&file_handle TSRMLS_CC); php_header(); /* Make sure headers have been sent */ } diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c index 19dcd983d2..f12e50a79a 100644 --- a/sapi/thttpd/thttpd.c +++ b/sapi/thttpd/thttpd.c @@ -37,27 +37,27 @@ typedef struct { #ifdef ZTS static int thttpd_globals_id; -#define TLS_D php_thttpd_globals *thttpd_context -#define TLS_DC , TLS_D -#define TLS_C thttpd_context -#define TLS_CC , thttpd_context +#define TSRMLS_D php_thttpd_globals *thttpd_context +#define TSRMLS_DC , TSRMLS_D +#define TSRMLS_C thttpd_context +#define TSRMLS_CC , thttpd_context #define TG(v) (thttpd_context->v) -#define TLS_FETCH() TLS_D = ts_resource(thttpd_globals_id) +#define TSRMLS_FETCH() TSRMLS_D = ts_resource(thttpd_globals_id) #else static php_thttpd_globals thttpd_globals; -#define TLS_D -#define TLS_DC -#define TLS_C -#define TLS_CC +#define TSRMLS_D +#define TSRMLS_DC +#define TSRMLS_C +#define TSRMLS_CC #define TG(v) (thttpd_globals.v) -#define TLS_FETCH() +#define TSRMLS_FETCH() #endif static int sapi_thttpd_ub_write(const char *str, uint str_length) { int n; uint sent = 0; - TLS_FETCH(); + TSRMLS_FETCH(); while (str_length > 0) { n = send(TG(hc)->conn_fd, str, str_length, 0); @@ -80,7 +80,7 @@ static int sapi_thttpd_ub_write(const char *str, uint str_length) #define COMBINE_HEADERS 30 -static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { char buf[1024]; struct iovec vec[COMBINE_HEADERS]; @@ -88,7 +88,7 @@ static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers SLS_DC) zend_llist_position pos; sapi_header_struct *h; size_t len; - TLS_FETCH(); + TSRMLS_FETCH(); if (!SG(sapi_headers).http_status_line) { snprintf(buf, 1023, "HTTP/1.0 %d Something\r\n", SG(sapi_headers).http_response_code); @@ -133,11 +133,11 @@ static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers SLS_DC) return SAPI_HEADER_SENT_SUCCESSFULLY; } -static int sapi_thttpd_read_post(char *buffer, uint count_bytes SLS_DC) +static int sapi_thttpd_read_post(char *buffer, uint count_bytes TSRMLS_DC) { size_t read_bytes = 0, tmp; int c; - TLS_FETCH(); + TSRMLS_FETCH(); /* to understand this, read cgi_interpose_input() in libhttpd.c */ c = TG(hc)->read_idx - TG(hc)->checked_idx; @@ -162,29 +162,29 @@ static int sapi_thttpd_read_post(char *buffer, uint count_bytes SLS_DC) return read_bytes; } -static char *sapi_thttpd_read_cookies(SLS_D) +static char *sapi_thttpd_read_cookies(TSRMLS_D) { - TLS_FETCH(); + TSRMLS_FETCH(); return TG(hc)->cookie; } #define BUF_SIZE 512 #define ADD_STRING(name) \ - php_register_variable(name, buf, track_vars_array TSRMLS_CC PLS_CC) + php_register_variable(name, buf, track_vars_array TSRMLS_CC) -static void sapi_thttpd_register_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS_DC) +static void sapi_thttpd_register_variables(zval *track_vars_array TSRMLS_DC TSRMLS_DC TSRMLS_DC) { char buf[BUF_SIZE + 1]; char *p; - TLS_FETCH(); + TSRMLS_FETCH(); - php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array TSRMLS_CC PLS_CC); - php_register_variable("SERVER_SOFTWARE", SERVER_SOFTWARE, track_vars_array TSRMLS_CC PLS_CC); - php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array TSRMLS_CC PLS_CC); - php_register_variable("REQUEST_METHOD", (char *) SG(request_info).request_method, track_vars_array TSRMLS_CC PLS_CC); - php_register_variable("REQUEST_URI", SG(request_info).request_uri, track_vars_array TSRMLS_CC PLS_CC); - php_register_variable("PATH_TRANSLATED", SG(request_info).path_translated, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array TSRMLS_CC); + php_register_variable("SERVER_SOFTWARE", SERVER_SOFTWARE, track_vars_array TSRMLS_CC); + php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array TSRMLS_CC); + php_register_variable("REQUEST_METHOD", (char *) SG(request_info).request_method, track_vars_array TSRMLS_CC); + php_register_variable("REQUEST_URI", SG(request_info).request_uri, track_vars_array TSRMLS_CC); + php_register_variable("PATH_TRANSLATED", SG(request_info).path_translated, track_vars_array TSRMLS_CC); p = inet_ntoa(TG(hc)->client_addr.sa_in.sin_addr); /* string representation of IPs are never larger than 512 bytes */ @@ -205,7 +205,7 @@ static void sapi_thttpd_register_variables(zval *track_vars_array TSRMLS_DC SLS_ #define CONDADD(name, field) \ if (TG(hc)->field[0]) { \ - php_register_variable(#name, TG(hc)->field, track_vars_array TSRMLS_CC PLS_CC); \ + php_register_variable(#name, TG(hc)->field, track_vars_array TSRMLS_CC); \ } CONDADD(HTTP_REFERER, referer); @@ -223,7 +223,7 @@ static void sapi_thttpd_register_variables(zval *track_vars_array TSRMLS_DC SLS_ } if (TG(hc)->authorization[0]) - php_register_variable("AUTH_TYPE", "Basic", track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("AUTH_TYPE", "Basic", track_vars_array TSRMLS_CC); } static sapi_module_struct thttpd_sapi_module = { @@ -258,27 +258,26 @@ static sapi_module_struct thttpd_sapi_module = { STANDARD_SAPI_MODULE_PROPERTIES }; -static void thttpd_module_main(TLS_D SLS_DC) +static void thttpd_module_main(TSRMLS_D TSRMLS_DC) { zend_file_handle file_handle; - CLS_FETCH(); TSRMLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); file_handle.type = ZEND_HANDLE_FILENAME; file_handle.filename = SG(request_info).path_translated; file_handle.free_filename = 0; file_handle.opened_path = NULL; - if (php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC) == FAILURE) { + if (php_request_startup(TSRMLS_C) == FAILURE) { return; } - php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + php_execute_script(&file_handle TSRMLS_CC); php_request_shutdown(NULL); } -static void thttpd_request_ctor(TLS_D SLS_DC) +static void thttpd_request_ctor(TSRMLS_D TSRMLS_DC) { int offset; smart_str s = {0}; @@ -300,7 +299,7 @@ static void thttpd_request_ctor(TLS_D SLS_DC) SG(request_info).content_type = TG(hc)->contenttype; SG(request_info).content_length = TG(hc)->contentlength; - php_handle_auth_data(TG(hc)->authorization SLS_CC); + php_handle_auth_data(TG(hc)->authorization TSRMLS_CC); TG(post_off) = TG(hc)->read_idx - TG(hc)->checked_idx; @@ -313,7 +312,7 @@ static void thttpd_request_ctor(TLS_D SLS_DC) } } -static void thttpd_request_dtor(TLS_D SLS_DC) +static void thttpd_request_dtor(TSRMLS_D TSRMLS_DC) { if (SG(request_info).query_string) free(SG(request_info).query_string); @@ -440,14 +439,14 @@ static void queue_request(httpd_conn *hc) tsrm_mutex_unlock(qr_lock); } -static off_t thttpd_real_php_request(httpd_conn *hc TLS_DC SLS_DC); +static off_t thttpd_real_php_request(httpd_conn *hc TSRMLS_DC TSRMLS_DC); static void *worker_thread(void *dummy) { int do_work = 50; httpd_conn *hc; - SLS_FETCH(); - TLS_FETCH(); + TSRMLS_FETCH(); + TSRMLS_FETCH(); while (do_work) { hc = dequeue_request(); @@ -461,7 +460,7 @@ static void *worker_thread(void *dummy) thread_atomic_dec(nr_free_threads); - thttpd_real_php_request(hc TLS_CC SLS_CC); + thttpd_real_php_request(hc TSRMLS_CC TSRMLS_CC); shutdown(hc->conn_fd, 0); destroy_conn(hc); free(hc); @@ -500,16 +499,16 @@ static void remove_dead_conn(int fd) #endif -static off_t thttpd_real_php_request(httpd_conn *hc TLS_DC SLS_DC) +static off_t thttpd_real_php_request(httpd_conn *hc TSRMLS_DC TSRMLS_DC) { TG(hc) = hc; hc->bytes_sent = 0; - thttpd_request_ctor(TLS_C SLS_CC); + thttpd_request_ctor(TSRMLS_C); - thttpd_module_main(TLS_C SLS_CC); + thttpd_module_main(TSRMLS_C); - thttpd_request_dtor(TLS_C SLS_CC); + thttpd_request_dtor(TSRMLS_C); return 0; } @@ -519,33 +518,33 @@ off_t thttpd_php_request(httpd_conn *hc) #ifdef ZTS queue_request(hc); #else - SLS_FETCH(); - TLS_FETCH(); - return thttpd_real_php_request(hc TLS_CC SLS_CC); + TSRMLS_FETCH(); + TSRMLS_FETCH(); + return thttpd_real_php_request(hc TSRMLS_CC TSRMLS_CC); #endif } void thttpd_register_on_close(void (*arg)(int)) { - TLS_FETCH(); + TSRMLS_FETCH(); TG(on_close) = arg; } void thttpd_closed_conn(int fd) { - TLS_FETCH(); + TSRMLS_FETCH(); if (TG(on_close)) TG(on_close)(fd); } int thttpd_get_fd(void) { - TLS_FETCH(); + TSRMLS_FETCH(); return TG(hc)->conn_fd; } void thttpd_set_dont_close(void) { - TLS_FETCH(); + TSRMLS_FETCH(); TG(hc)->file_address = (char *) 1; } @@ -561,14 +560,14 @@ void thttpd_php_init(void) sapi_startup(&thttpd_sapi_module); thttpd_sapi_module.startup(&thttpd_sapi_module); { - SLS_FETCH(); + TSRMLS_FETCH(); SG(server_context) = (void *) 1; } } void thttpd_php_shutdown(void) { - SLS_FETCH(); + TSRMLS_FETCH(); if (SG(server_context) != NULL) { thttpd_sapi_module.shutdown(&thttpd_sapi_module); diff --git a/sapi/tux/php_tux.c b/sapi/tux/php_tux.c index 7dbc6f748c..215e4d5cbe 100644 --- a/sapi/tux/php_tux.c +++ b/sapi/tux/php_tux.c @@ -47,18 +47,13 @@ typedef struct { static php_tux_globals tux_globals; -#define TLS_D -#define TLS_DC -#define TLS_C -#define TLS_CC #define TG(v) (tux_globals.v) -#define TLS_FETCH() static int sapi_tux_ub_write(const char *str, uint str_length) { int n; uint sent = 0; - TLS_FETCH(); + TSRMLS_FETCH(); /* combine headers and body */ if (TG(number_vec)) { @@ -94,7 +89,7 @@ static int sapi_tux_ub_write(const char *str, uint str_length) return sent; } -static int sapi_tux_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +static int sapi_tux_send_headers(sapi_headers_struct *sapi_headers) { char buf[1024]; struct iovec *vec; @@ -105,7 +100,7 @@ static int sapi_tux_send_headers(sapi_headers_struct *sapi_headers SLS_DC) size_t len; char *status_line; int locate_cl; - TLS_FETCH(); + TSRMLS_FETCH(); max_headers = 30; snprintf(buf, 1023, "HTTP/1.1 %d NA\r\n", SG(sapi_headers).http_response_code); @@ -153,11 +148,11 @@ static int sapi_tux_send_headers(sapi_headers_struct *sapi_headers SLS_DC) return SAPI_HEADER_SENT_SUCCESSFULLY; } -static int sapi_tux_read_post(char *buffer, uint count_bytes SLS_DC) +static int sapi_tux_read_post(char *buffer, uint count_bytes) { #if 0 int amount = 0; - TLS_FETCH(); + TSRMLS_FETCH(); TG(req)->objectlen = count_bytes; TG(req)->object_addr = buffer; @@ -172,34 +167,34 @@ static int sapi_tux_read_post(char *buffer, uint count_bytes SLS_DC) #endif } -static char *sapi_tux_read_cookies(SLS_D) +static char *sapi_tux_read_cookies(void) { - TLS_FETCH(); + TSRMLS_FETCH(); return TG(req)->cookies; } #define BUF_SIZE 512 #define ADD_STRING(name) \ - php_register_variable(name, buf, track_vars_array TSRMLS_CC PLS_CC) + php_register_variable(name, buf, track_vars_array TSRMLS_FETCH()CC TSRMLS_FETCH()CC) -static void sapi_tux_register_variables(zval *track_vars_array TSRMLS_DC SLS_DC PLS_DC) +static void sapi_tux_register_variables(zval *track_vars_array TSRMLS_DC) { char buf[BUF_SIZE + 1]; char *p; - TLS_FETCH(); + TSRMLS_FETCH(); sprintf(buf, "Server: %s", TUXAPI_version); sapi_add_header_ex(buf, strlen(buf), 1, 0); - php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array TSRMLS_CC PLS_CC); - php_register_variable("SERVER_SOFTWARE", TUXAPI_version, track_vars_array TSRMLS_CC PLS_CC); - php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array TSRMLS_CC PLS_CC); - php_register_variable("REQUEST_METHOD", (char *) SG(request_info).request_method, track_vars_array TSRMLS_CC PLS_CC); - php_register_variable("DOCUMENT_ROOT", TUXAPI_docroot, track_vars_array TSRMLS_CC PLS_CC); - php_register_variable("SERVER_NAME", TUXAPI_servername, track_vars_array TSRMLS_CC PLS_CC); - php_register_variable("REQUEST_URI", SG(request_info).request_uri, track_vars_array TSRMLS_CC PLS_CC); - php_register_variable("PATH_TRANSLATED", SG(request_info).path_translated, track_vars_array TSRMLS_CC PLS_CC); + php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array TSRMLS_FETCH()CC TSRMLS_FETCH()CC); + php_register_variable("SERVER_SOFTWARE", TUXAPI_version, track_vars_array TSRMLS_FETCH()CC TSRMLS_FETCH()CC); + php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array TSRMLS_FETCH()CC TSRMLS_FETCH()CC); + php_register_variable("REQUEST_METHOD", (char *) SG(request_info).request_method, track_vars_array TSRMLS_FETCH()CC TSRMLS_FETCH()CC); + php_register_variable("DOCUMENT_ROOT", TUXAPI_docroot, track_vars_array TSRMLS_FETCH()CC TSRMLS_FETCH()CC); + php_register_variable("SERVER_NAME", TUXAPI_servername, track_vars_array TSRMLS_FETCH()CC TSRMLS_FETCH()CC); + php_register_variable("REQUEST_URI", SG(request_info).request_uri, track_vars_array TSRMLS_FETCH()CC TSRMLS_FETCH()CC); + php_register_variable("PATH_TRANSLATED", SG(request_info).path_translated, track_vars_array TSRMLS_FETCH()CC TSRMLS_FETCH()CC); p = inet_ntoa(TG(req)->client_host); /* string representation of IPs are never larger than 512 bytes */ @@ -222,7 +217,7 @@ static void sapi_tux_register_variables(zval *track_vars_array TSRMLS_DC SLS_DC #define CONDADD(name, field) \ if (TG(req)->field[0]) { \ - php_register_variable(#name, TG(req)->field, track_vars_array TSRMLS_CC PLS_C); \ + php_register_variable(#name, TG(req)->field, track_vars_array TSRMLS_FETCH()CC TSRMLS_FETCH()C); \ } CONDADD(HTTP_REFERER, referer); @@ -242,7 +237,7 @@ static void sapi_tux_register_variables(zval *track_vars_array TSRMLS_DC SLS_DC #if 0 if (TG(hc)->authorization[0]) - php_register_variable("AUTH_TYPE", "Basic", track_vars_array TSRMLS_CC PLS_C); + php_register_variable("AUTH_TYPE", "Basic", track_vars_array TSRMLS_FETCH()CC TSRMLS_FETCH()C); #endif } @@ -278,27 +273,26 @@ static sapi_module_struct tux_sapi_module = { STANDARD_SAPI_MODULE_PROPERTIES }; -static void tux_module_main(TLS_D SLS_DC) +static void tux_module_main(TSRMLS_D) { zend_file_handle file_handle; - CLS_FETCH(); - TSRMLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH()FETCH(); + TSRMLS_FETCH()FETCH(); file_handle.type = ZEND_HANDLE_FILENAME; file_handle.filename = SG(request_info).path_translated; file_handle.free_filename = 0; file_handle.opened_path = NULL; - if (php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC) == FAILURE) { + if (php_request_startup(TSRMLS_C) == FAILURE) { return; } - php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + php_execute_script(&file_handle TSRMLS_FETCH()CC TSRMLS_FETCH()CC); php_request_shutdown(NULL); } -static void tux_request_ctor(TLS_D SLS_DC) +static void tux_request_ctor(TSRMLS_D) { char buf[1024]; int offset; @@ -329,11 +323,11 @@ static void tux_request_ctor(TLS_D SLS_DC) SG(request_info).content_length = 0; // TG(req)->contentlength; #if 0 - php_handle_auth_data(TG(hc)->authorization SLS_CC); + php_handle_auth_data(TG(hc)->authorization TSRMLS_CC); #endif } -static void tux_request_dtor(TLS_D SLS_DC) +static void tux_request_dtor(TSRMLS_D) { if (TG(header_vec)) free(TG(header_vec)); @@ -367,8 +361,7 @@ static void *separate_thread(void *bla) int TUXAPI_handle_events(user_req_t *req) { - SLS_FETCH(); - TLS_FETCH(); + TSRMLS_FETCH(); if (req->event == PHP_TUX_BACKGROUND_CONN) { tux_closed_conn(req->sock); @@ -378,11 +371,11 @@ int TUXAPI_handle_events(user_req_t *req) TG(req) = req; TG(tux_action) = TUX_ACTION_FINISH_CLOSE_REQ; - tux_request_ctor(TLS_C SLS_CC); + tux_request_ctor(TSRMLS_C); - tux_module_main(TLS_C SLS_CC); + tux_module_main(TSRMLS_C); - tux_request_dtor(TLS_C SLS_CC); + tux_request_dtor(TSRMLS_C); return tux(TG(tux_action), req); } @@ -394,21 +387,21 @@ void tux_register_on_close(void (*arg)(int)) void tux_closed_conn(int fd) { - TLS_FETCH(); + TSRMLS_FETCH(); if (TG(on_close)) TG(on_close)(fd); } int tux_get_fd(void) { - TLS_FETCH(); + TSRMLS_FETCH(); return TG(req)->sock; } void tux_set_dont_close(void) { - TLS_FETCH(); + TSRMLS_FETCH(); TG(req)->event = PHP_TUX_BACKGROUND_CONN; tux(TUX_ACTION_POSTPONE_REQ, TG(req)); diff --git a/win32/php4.dsp b/win32/php4.dsp index 2ac2aa056a..52325e7e12 100644 --- a/win32/php4.dsp +++ b/win32/php4.dsp @@ -68,7 +68,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "DEBUG" /D "_DEBUG" /D "_CONSOLE" /D ZEND_DEBUG=1 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "DEBUG" /D "_DEBUG" /D "_CONSOLE" /D "MSVC5" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
diff --git a/win32/php4dll.dsp b/win32/php4dll.dsp index c882aac62f..558d638b14 100644 --- a/win32/php4dll.dsp +++ b/win32/php4dll.dsp @@ -44,7 +44,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\Zend" /I "..\regex" /I "..\..\bindlib_w32" /I "..\TSRM" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=1 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\Zend" /I "..\regex" /I "..\..\bindlib_w32" /I "..\TSRM" /I "..\ext\xml\expat" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D "TSRM_EXPORTS" /D "MSVC5" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "_DEBUG"
@@ -70,7 +70,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLL_EXPORTS" /D "PHP_EXPORTS" /D "SAPI_EXPORTS" /D "LIBZEND_EXPORTS" /D ZEND_DEBUG=0 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex" /I "..\..\bindlib_w32" /I "..\TSRM" /I "..\ext\xml\expat" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLL_EXPORTS" /D "PHP_EXPORTS" /D "SAPI_EXPORTS" /D "LIBZEND_EXPORTS" /D ZEND_DEBUG=0 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
@@ -97,7 +97,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "Zend" /I "." /I "regex" /I "..\bindlib_w32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "MSVC5" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D ZEND_DEBUG=0 /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "Zend" /I "." /I "regex" /I "..\bindlib_w32" /I "main" /I ".." /I "..\main" /I "..\Zend" /I "..\regex" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "Zend" /I "." /I "regex" /I "..\bindlib_w32" /I "main" /I ".." /I "..\main" /I "..\Zend" /I "..\regex" /I "..\..\bindlib_w32" /I "..\TSRM" /I "..\ext\xml\expat" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
@@ -149,7 +149,7 @@ SOURCE=..\main\network.c # End Source File
# Begin Source File
-SOURCE=..\ext\standard\output.c
+SOURCE=..\main\output.c
# End Source File
# Begin Source File
@@ -1670,6 +1670,10 @@ InputPath=..\ext\standard\parsedate.y # Begin Group "Scanners"
# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\standard\url_scanner_ex.re
+# End Source File
# End Group
# Begin Group "Text Files"
|