diff options
Diffstat (limited to 'main')
49 files changed, 1739 insertions, 1761 deletions
diff --git a/main/SAPI.c b/main/SAPI.c index b1be4443d2..b05b14be5e 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -62,14 +62,17 @@ static void _type_dtor(zval *zv) free(Z_PTR_P(zv)); } -static void sapi_globals_ctor(sapi_globals_struct *sapi_globals TSRMLS_DC) +static void sapi_globals_ctor(sapi_globals_struct *sapi_globals) { +#ifdef ZTS + ZEND_TSRMLS_CACHE_UPDATE; +#endif memset(sapi_globals, 0, sizeof(*sapi_globals)); zend_hash_init_ex(&sapi_globals->known_post_content_types, 8, NULL, _type_dtor, 1, 0); - php_setup_sapi_content_types(TSRMLS_C); + php_setup_sapi_content_types(); } -static void sapi_globals_dtor(sapi_globals_struct *sapi_globals TSRMLS_DC) +static void sapi_globals_dtor(sapi_globals_struct *sapi_globals) { zend_hash_destroy(&sapi_globals->known_post_content_types); } @@ -130,11 +133,11 @@ PHP_FUNCTION(header_register_callback) { zval *callback_func; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &callback_func) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callback_func) == FAILURE) { return; } - if (!zend_is_callable(callback_func, 0, NULL TSRMLS_CC)) { + if (!zend_is_callable(callback_func, 0, NULL)) { RETURN_FALSE; } @@ -149,17 +152,17 @@ PHP_FUNCTION(header_register_callback) } /* }}} */ -static void sapi_run_header_callback(TSRMLS_D) +static void sapi_run_header_callback(void) { int error; zend_fcall_info fci; char *callback_error = NULL; zval retval; - if (zend_fcall_info_init(&SG(callback_func), 0, &fci, &SG(fci_cache), NULL, &callback_error TSRMLS_CC) == SUCCESS) { + if (zend_fcall_info_init(&SG(callback_func), 0, &fci, &SG(fci_cache), NULL, &callback_error) == SUCCESS) { fci.retval = &retval; - error = zend_call_function(&fci, &SG(fci_cache) TSRMLS_CC); + error = zend_call_function(&fci, &SG(fci_cache)); if (error == FAILURE) { goto callback_failed; } else { @@ -167,7 +170,7 @@ static void sapi_run_header_callback(TSRMLS_D) } } else { callback_failed: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the sapi_header_callback"); + php_error_docref(NULL, E_WARNING, "Could not call the sapi_header_callback"); } if (callback_error) { @@ -175,23 +178,23 @@ callback_failed: } } -SAPI_API void sapi_handle_post(void *arg TSRMLS_DC) +SAPI_API void sapi_handle_post(void *arg) { 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 TSRMLS_CC); + SG(request_info).post_entry->post_handler(SG(request_info).content_type_dup, arg); efree(SG(request_info).content_type_dup); SG(request_info).content_type_dup = NULL; } } -static void sapi_read_post_data(TSRMLS_D) +static void sapi_read_post_data(void) { sapi_post_entry *post_entry; uint content_type_length = (uint)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)(TSRMLS_D) = NULL; + void (*post_reader_func)(void) = NULL; /* dedicated implementation for increased performance: @@ -236,15 +239,15 @@ static void sapi_read_post_data(TSRMLS_D) SG(request_info).content_type_dup = content_type; if(post_reader_func) { - post_reader_func(TSRMLS_C); + post_reader_func(); } if(sapi_module.default_post_reader) { - sapi_module.default_post_reader(TSRMLS_C); + sapi_module.default_post_reader(); } } -SAPI_API int sapi_read_post_block(char *buffer, size_t buflen TSRMLS_DC) +SAPI_API int sapi_read_post_block(char *buffer, size_t buflen) { int read_bytes; @@ -252,7 +255,7 @@ SAPI_API int sapi_read_post_block(char *buffer, size_t buflen TSRMLS_DC) return -1; } - read_bytes = (int)sapi_module.read_post(buffer, buflen TSRMLS_CC); + read_bytes = (int)sapi_module.read_post(buffer, buflen); if (read_bytes > 0) { /* gogo */ @@ -269,7 +272,7 @@ SAPI_API int sapi_read_post_block(char *buffer, size_t buflen TSRMLS_DC) SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data) { if ((SG(post_max_size) > 0) && (SG(request_info).content_length > SG(post_max_size))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "POST Content-Length of %pd bytes exceeds the limit of %pd bytes", + php_error_docref(NULL, E_WARNING, "POST Content-Length of %pd bytes exceeds the limit of %pd bytes", SG(request_info).content_length, SG(post_max_size)); return; } @@ -283,14 +286,14 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data) for (;;) { char buffer[SAPI_POST_BLOCK_SIZE]; - read_bytes = sapi_read_post_block(buffer, SAPI_POST_BLOCK_SIZE TSRMLS_CC); + read_bytes = sapi_read_post_block(buffer, SAPI_POST_BLOCK_SIZE); if (read_bytes > 0) { php_stream_write(SG(request_info).request_body, buffer, read_bytes); } if ((SG(post_max_size) > 0) && (SG(read_post_bytes) > SG(post_max_size))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Actual POST length does not match Content-Length, and exceeds " ZEND_LONG_FMT " bytes", SG(post_max_size)); + php_error_docref(NULL, E_WARNING, "Actual POST length does not match Content-Length, and exceeds " ZEND_LONG_FMT " bytes", SG(post_max_size)); break; } @@ -304,7 +307,7 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data) } -static inline char *get_default_content_type(uint prefix_len, uint *len TSRMLS_DC) +static inline char *get_default_content_type(uint prefix_len, uint *len) { char *mimetype, *charset, *content_type; uint mimetype_len, charset_len; @@ -344,19 +347,19 @@ static inline char *get_default_content_type(uint prefix_len, uint *len TSRMLS_D } -SAPI_API char *sapi_get_default_content_type(TSRMLS_D) +SAPI_API char *sapi_get_default_content_type(void) { uint len; - return get_default_content_type(0, &len TSRMLS_CC); + return get_default_content_type(0, &len); } -SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header TSRMLS_DC) +SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header) { uint len; - default_header->header = get_default_content_type(sizeof("Content-type: ")-1, &len TSRMLS_CC); + default_header->header = get_default_content_type(sizeof("Content-type: ")-1, &len); default_header->header_len = len; memcpy(default_header->header, "Content-type: ", sizeof("Content-type: ") - 1); } @@ -372,7 +375,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 TSRMLS_DC) +SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len) { char *charset, *newtype; size_t newlen; @@ -393,7 +396,7 @@ SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len TSRMLS_DC return 0; } -SAPI_API void sapi_activate_headers_only(TSRMLS_D) +SAPI_API void sapi_activate_headers_only(void) { if (SG(request_info).headers_read == 1) return; @@ -423,13 +426,13 @@ SAPI_API void sapi_activate_headers_only(TSRMLS_D) SG(request_info).headers_only = 0; } if (SG(server_context)) { - SG(request_info).cookie_data = sapi_module.read_cookies(TSRMLS_C); + SG(request_info).cookie_data = sapi_module.read_cookies(); if (sapi_module.activate) { - sapi_module.activate(TSRMLS_C); + sapi_module.activate(); } } if (sapi_module.input_filter_init ) { - sapi_module.input_filter_init(TSRMLS_C); + sapi_module.input_filter_init(); } } @@ -437,7 +440,7 @@ SAPI_API void sapi_activate_headers_only(TSRMLS_D) * Called from php_request_startup() for every request. */ -SAPI_API void sapi_activate(TSRMLS_D) +SAPI_API void sapi_activate(void) { 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; @@ -475,25 +478,25 @@ SAPI_API void sapi_activate(TSRMLS_D) && !strcmp(SG(request_info).request_method, "POST")) { /* HTTP POST may contain form data to be processed into variables * depending on given content type */ - sapi_read_post_data(TSRMLS_C); + sapi_read_post_data(); } else { SG(request_info).content_type_dup = NULL; } /* Cookies */ - SG(request_info).cookie_data = sapi_module.read_cookies(TSRMLS_C); + SG(request_info).cookie_data = sapi_module.read_cookies(); if (sapi_module.activate) { - sapi_module.activate(TSRMLS_C); + sapi_module.activate(); } } if (sapi_module.input_filter_init) { - sapi_module.input_filter_init(TSRMLS_C); + sapi_module.input_filter_init(); } } -static void sapi_send_headers_free(TSRMLS_D) +static void sapi_send_headers_free(void) { if (SG(sapi_headers).http_status_line) { efree(SG(sapi_headers).http_status_line); @@ -501,7 +504,7 @@ static void sapi_send_headers_free(TSRMLS_D) } } -SAPI_API void sapi_deactivate(TSRMLS_D) +SAPI_API void sapi_deactivate(void) { zend_llist_destroy(&SG(sapi_headers).headers); if (SG(request_info).request_body) { @@ -513,7 +516,7 @@ SAPI_API void sapi_deactivate(TSRMLS_D) int read_bytes; do { - read_bytes = sapi_read_post_block(dummy, SAPI_POST_BLOCK_SIZE TSRMLS_CC); + read_bytes = sapi_read_post_block(dummy, SAPI_POST_BLOCK_SIZE); } while (SAPI_POST_BLOCK_SIZE == read_bytes); } } @@ -533,16 +536,16 @@ SAPI_API void sapi_deactivate(TSRMLS_D) efree(SG(request_info).current_user); } if (sapi_module.deactivate) { - sapi_module.deactivate(TSRMLS_C); + sapi_module.deactivate(); } if (SG(rfc1867_uploaded_files)) { - destroy_uploaded_files_hash(TSRMLS_C); + destroy_uploaded_files_hash(); } if (SG(sapi_headers).mimetype) { efree(SG(sapi_headers).mimetype); SG(sapi_headers).mimetype = NULL; } - sapi_send_headers_free(TSRMLS_C); + sapi_send_headers_free(); SG(sapi_started) = 0; SG(headers_sent) = 0; SG(callback_run) = 0; @@ -552,7 +555,7 @@ SAPI_API void sapi_deactivate(TSRMLS_D) } -SAPI_API void sapi_initialize_empty_request(TSRMLS_D) +SAPI_API void sapi_initialize_empty_request(void) { SG(server_context) = NULL; SG(request_info).request_method = NULL; @@ -577,7 +580,7 @@ static int sapi_extract_response_code(const char *header_line) } -static void sapi_update_response_code(int ncode TSRMLS_DC) +static void sapi_update_response_code(int ncode) { /* if the status code did not change, we do not want to change the status line, and no need to change the code */ @@ -624,7 +627,7 @@ static void sapi_remove_header(zend_llist *l, char *name, uint len) { } } -SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC) +SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace) { sapi_header_line ctr = {0}; int r; @@ -633,7 +636,7 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo ctr.line_len = header_line_len; r = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, - &ctr TSRMLS_CC); + &ctr); if (!duplicate) efree(header_line); @@ -641,10 +644,10 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo return r; } -static void sapi_header_add_op(sapi_header_op_enum op, sapi_header_struct *sapi_header TSRMLS_DC) +static void sapi_header_add_op(sapi_header_op_enum op, sapi_header_struct *sapi_header) { if (!sapi_module.header_handler || - (SAPI_HEADER_ADD & sapi_module.header_handler(sapi_header, op, &SG(sapi_headers) TSRMLS_CC))) { + (SAPI_HEADER_ADD & sapi_module.header_handler(sapi_header, op, &SG(sapi_headers)))) { if (op == SAPI_HEADER_REPLACE) { char *colon_offset = strchr(sapi_header->header, ':'); @@ -662,7 +665,7 @@ static void sapi_header_add_op(sapi_header_op_enum op, sapi_header_struct *sapi_ } } -SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) +SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg) { sapi_header_struct sapi_header; char *colon_offset; @@ -671,8 +674,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) int http_response_code; if (SG(headers_sent) && !SG(request_info).no_headers) { - const char *output_start_filename = php_output_get_start_filename(TSRMLS_C); - int output_start_lineno = php_output_get_start_lineno(TSRMLS_C); + const char *output_start_filename = php_output_get_start_filename(); + int output_start_lineno = php_output_get_start_lineno(); if (output_start_filename) { sapi_module.sapi_error(E_WARNING, "Cannot modify header information - headers already sent by (output started at %s:%d)", @@ -685,7 +688,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) switch (op) { case SAPI_HEADER_SET_STATUS: - sapi_update_response_code((int)(zend_intptr_t) arg TSRMLS_CC); + sapi_update_response_code((int)(zend_intptr_t) arg); return SUCCESS; case SAPI_HEADER_ADD: @@ -704,7 +707,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) case SAPI_HEADER_DELETE_ALL: if (sapi_module.header_handler) { - sapi_module.header_handler(&sapi_header, op, &SG(sapi_headers) TSRMLS_CC); + sapi_module.header_handler(&sapi_header, op, &SG(sapi_headers)); } zend_llist_clean(&SG(sapi_headers).headers); return SUCCESS; @@ -732,7 +735,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) if (sapi_module.header_handler) { sapi_header.header = header_line; sapi_header.header_len = header_line_len; - sapi_module.header_handler(&sapi_header, op, &SG(sapi_headers) TSRMLS_CC); + sapi_module.header_handler(&sapi_header, op, &SG(sapi_headers)); } sapi_remove_header(&SG(sapi_headers).headers, header_line, header_line_len); efree(header_line); @@ -768,7 +771,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) if (header_line_len>=5 && !strncasecmp(header_line, "HTTP/", 5)) { /* filter out the response code */ - sapi_update_response_code(sapi_extract_response_code(header_line) TSRMLS_CC); + sapi_update_response_code(sapi_extract_response_code(header_line)); /* sapi_update_response_code doesn't free the status line if the code didn't change */ if (SG(sapi_headers).http_status_line) { efree(SG(sapi_headers).http_status_line); @@ -795,7 +798,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) } mimetype = estrdup(ptr); - newlen = sapi_apply_default_charset(&mimetype, len TSRMLS_CC); + newlen = sapi_apply_default_charset(&mimetype, len); if (!SG(sapi_headers).mimetype){ SG(sapi_headers).mimetype = estrdup(mimetype); } @@ -827,18 +830,18 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) SG(sapi_headers).http_response_code != 201) { /* Return a Found Redirect if one is not already specified */ if (http_response_code) { /* user specified redirect code */ - sapi_update_response_code(http_response_code TSRMLS_CC); + sapi_update_response_code(http_response_code); } else if (SG(request_info).proto_num > 1000 && SG(request_info).request_method && strcmp(SG(request_info).request_method, "HEAD") && strcmp(SG(request_info).request_method, "GET")) { - sapi_update_response_code(303 TSRMLS_CC); + sapi_update_response_code(303); } else { - sapi_update_response_code(302 TSRMLS_CC); + sapi_update_response_code(302); } } } else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */ - sapi_update_response_code(401 TSRMLS_CC); /* authentication-required */ + sapi_update_response_code(401); /* authentication-required */ } if (sapi_header.header==header_line) { *colon_offset = ':'; @@ -846,14 +849,14 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) } } if (http_response_code) { - sapi_update_response_code(http_response_code TSRMLS_CC); + sapi_update_response_code(http_response_code); } - sapi_header_add_op(op, &sapi_header TSRMLS_CC); + sapi_header_add_op(op, &sapi_header); return SUCCESS; } -SAPI_API int sapi_send_headers(TSRMLS_D) +SAPI_API int sapi_send_headers(void) { int retval; int ret = FAILURE; @@ -869,24 +872,24 @@ SAPI_API int sapi_send_headers(TSRMLS_D) sapi_header_struct default_header; uint len; - SG(sapi_headers).mimetype = get_default_content_type(0, &len TSRMLS_CC); + SG(sapi_headers).mimetype = get_default_content_type(0, &len); default_header.header_len = sizeof("Content-type: ") - 1 + len; default_header.header = emalloc(default_header.header_len + 1); memcpy(default_header.header, "Content-type: ", sizeof("Content-type: ") - 1); memcpy(default_header.header + sizeof("Content-type: ") - 1, SG(sapi_headers).mimetype, len + 1); - sapi_header_add_op(SAPI_HEADER_ADD, &default_header TSRMLS_CC); + sapi_header_add_op(SAPI_HEADER_ADD, &default_header); SG(sapi_headers).send_default_content_type = 0; } if (Z_TYPE(SG(callback_func)) != IS_UNDEF && !SG(callback_run)) { SG(callback_run) = 1; - sapi_run_header_callback(TSRMLS_C); + sapi_run_header_callback(); } SG(headers_sent) = 1; if (sapi_module.send_headers) { - retval = sapi_module.send_headers(&SG(sapi_headers) TSRMLS_CC); + retval = sapi_module.send_headers(&SG(sapi_headers)); } else { retval = SAPI_HEADER_DO_SEND; } @@ -906,17 +909,17 @@ SAPI_API int sapi_send_headers(TSRMLS_D) http_status_line.header = buf; http_status_line.header_len = slprintf(buf, sizeof(buf), "HTTP/1.0 %d X", SG(sapi_headers).http_response_code); } - sapi_module.send_header(&http_status_line, SG(server_context) TSRMLS_CC); + sapi_module.send_header(&http_status_line, SG(server_context)); } - zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) sapi_module.send_header, SG(server_context) TSRMLS_CC); + zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) sapi_module.send_header, SG(server_context)); if(SG(sapi_headers).send_default_content_type) { sapi_header_struct default_header; - sapi_get_default_content_type_header(&default_header TSRMLS_CC); - sapi_module.send_header(&default_header, SG(server_context) TSRMLS_CC); + sapi_get_default_content_type_header(&default_header); + sapi_module.send_header(&default_header, SG(server_context)); sapi_free_header(&default_header); } - sapi_module.send_header(NULL, SG(server_context) TSRMLS_CC); + sapi_module.send_header(NULL, SG(server_context)); ret = SUCCESS; break; case SAPI_HEADER_SEND_FAILED: @@ -925,18 +928,18 @@ SAPI_API int sapi_send_headers(TSRMLS_D) break; } - sapi_send_headers_free(TSRMLS_C); + sapi_send_headers_free(); return ret; } -SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries TSRMLS_DC) +SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries) { sapi_post_entry *p=post_entries; while (p->content_type) { - if (sapi_register_post_entry(p TSRMLS_CC) == FAILURE) { + if (sapi_register_post_entry(p) == FAILURE) { return FAILURE; } p++; @@ -945,7 +948,7 @@ SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries TSRMLS_DC) } -SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC) +SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry) { if (SG(sapi_started) && EG(current_execute_data)) { return FAILURE; @@ -955,7 +958,7 @@ SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC) (void *) post_entry, sizeof(sapi_post_entry)) ? SUCCESS : FAILURE; } -SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC) +SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry) { if (SG(sapi_started) && EG(current_execute_data)) { return; @@ -965,7 +968,7 @@ SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC) } -SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D) TSRMLS_DC) +SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(void)) { if (SG(sapi_started) && EG(current_execute_data)) { return FAILURE; @@ -975,7 +978,7 @@ SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRML } -SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC) TSRMLS_DC) +SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray)) { if (SG(sapi_started) && EG(current_execute_data)) { return FAILURE; @@ -984,7 +987,7 @@ SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zva return SUCCESS; } -SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC) +SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void)) { if (SG(sapi_started) && EG(current_execute_data)) { return FAILURE; @@ -994,20 +997,20 @@ SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, ch return SUCCESS; } -SAPI_API int sapi_flush(TSRMLS_D) +SAPI_API int sapi_flush(void) { if (sapi_module.flush) { - sapi_module.flush(SG(server_context) TSRMLS_CC); + sapi_module.flush(SG(server_context)); return SUCCESS; } else { return FAILURE; } } -SAPI_API zend_stat_t *sapi_get_stat(TSRMLS_D) +SAPI_API zend_stat_t *sapi_get_stat(void) { if (sapi_module.get_stat) { - return sapi_module.get_stat(TSRMLS_C); + return sapi_module.get_stat(); } else { if (!SG(request_info).path_translated || (VCWD_STAT(SG(request_info).path_translated, &SG(global_stat)) == -1)) { return NULL; @@ -1016,66 +1019,66 @@ SAPI_API zend_stat_t *sapi_get_stat(TSRMLS_D) } } -SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC) +SAPI_API char *sapi_getenv(char *name, size_t name_len) { if (sapi_module.getenv) { - char *value, *tmp = sapi_module.getenv(name, name_len TSRMLS_CC); + char *value, *tmp = sapi_module.getenv(name, name_len); if (tmp) { value = estrdup(tmp); } else { return NULL; } if (sapi_module.input_filter) { - sapi_module.input_filter(PARSE_STRING, name, &value, strlen(value), NULL TSRMLS_CC); + sapi_module.input_filter(PARSE_STRING, name, &value, strlen(value), NULL); } return value; } return NULL; } -SAPI_API int sapi_get_fd(int *fd TSRMLS_DC) +SAPI_API int sapi_get_fd(int *fd) { if (sapi_module.get_fd) { - return sapi_module.get_fd(fd TSRMLS_CC); + return sapi_module.get_fd(fd); } else { return FAILURE; } } -SAPI_API int sapi_force_http_10(TSRMLS_D) +SAPI_API int sapi_force_http_10(void) { if (sapi_module.force_http_10) { - return sapi_module.force_http_10(TSRMLS_C); + return sapi_module.force_http_10(); } else { return FAILURE; } } -SAPI_API int sapi_get_target_uid(uid_t *obj TSRMLS_DC) +SAPI_API int sapi_get_target_uid(uid_t *obj) { if (sapi_module.get_target_uid) { - return sapi_module.get_target_uid(obj TSRMLS_CC); + return sapi_module.get_target_uid(obj); } else { return FAILURE; } } -SAPI_API int sapi_get_target_gid(gid_t *obj TSRMLS_DC) +SAPI_API int sapi_get_target_gid(gid_t *obj) { if (sapi_module.get_target_gid) { - return sapi_module.get_target_gid(obj TSRMLS_CC); + return sapi_module.get_target_gid(obj); } else { return FAILURE; } } -SAPI_API double sapi_get_request_time(TSRMLS_D) +SAPI_API double sapi_get_request_time(void) { if(SG(global_request_time)) return SG(global_request_time); if (sapi_module.get_request_time && SG(server_context)) { - SG(global_request_time) = sapi_module.get_request_time(TSRMLS_C); + SG(global_request_time) = sapi_module.get_request_time(); } else { struct timeval tp = {0}; if (!gettimeofday(&tp, NULL)) { @@ -1087,9 +1090,9 @@ SAPI_API double sapi_get_request_time(TSRMLS_D) return SG(global_request_time); } -SAPI_API void sapi_terminate_process(TSRMLS_D) { +SAPI_API void sapi_terminate_process(void) { if (sapi_module.terminate_process) { - sapi_module.terminate_process(TSRMLS_C); + sapi_module.terminate_process(); } } diff --git a/main/SAPI.h b/main/SAPI.h index 79661371d9..bb523604bd 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -142,7 +142,7 @@ typedef struct _sapi_globals_struct { BEGIN_EXTERN_C() #ifdef ZTS -# define SG(v) TSRMG(sapi_globals_id, sapi_globals_struct *, v) +# define SG(v) ZEND_TSRMG(sapi_globals_id, sapi_globals_struct *, v) SAPI_API extern int sapi_globals_id; #else # define SG(v) (sapi_globals.v) @@ -151,9 +151,9 @@ extern SAPI_API sapi_globals_struct sapi_globals; SAPI_API void sapi_startup(sapi_module_struct *sf); SAPI_API void sapi_shutdown(void); -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 void sapi_activate(void); +SAPI_API void sapi_deactivate(void); +SAPI_API void sapi_initialize_empty_request(void); END_EXTERN_C() /* @@ -182,40 +182,40 @@ typedef enum { /* Parameter: */ } sapi_header_op_enum; BEGIN_EXTERN_C() -SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC); +SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg); /* Deprecated functions. Use sapi_header_op instead. */ -SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC); -#define sapi_add_header(a, b, c) sapi_add_header_ex((a),(b),(c),1 TSRMLS_CC) +SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace); +#define sapi_add_header(a, b, c) sapi_add_header_ex((a),(b),(c),1) -SAPI_API int sapi_send_headers(TSRMLS_D); +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 TSRMLS_DC); -SAPI_API int sapi_read_post_block(char *buffer, size_t buflen TSRMLS_DC); -SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entry TSRMLS_DC); -SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC); -SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC); -SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D) TSRMLS_DC); -SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC) TSRMLS_DC); -SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC); - -SAPI_API int sapi_flush(TSRMLS_D); -SAPI_API zend_stat_t *sapi_get_stat(TSRMLS_D); -SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_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); -SAPI_API void sapi_activate_headers_only(TSRMLS_D); - -SAPI_API int sapi_get_fd(int *fd TSRMLS_DC); -SAPI_API int sapi_force_http_10(TSRMLS_D); - -SAPI_API int sapi_get_target_uid(uid_t * TSRMLS_DC); -SAPI_API int sapi_get_target_gid(gid_t * TSRMLS_DC); -SAPI_API double sapi_get_request_time(TSRMLS_D); -SAPI_API void sapi_terminate_process(TSRMLS_D); +SAPI_API void sapi_handle_post(void *arg); +SAPI_API int sapi_read_post_block(char *buffer, size_t buflen); +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)(void)); +SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray)); +SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void)); + +SAPI_API int sapi_flush(void); +SAPI_API zend_stat_t *sapi_get_stat(void); +SAPI_API char *sapi_getenv(char *name, size_t name_len); + +SAPI_API char *sapi_get_default_content_type(void); +SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header); +SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len); +SAPI_API void sapi_activate_headers_only(void); + +SAPI_API int sapi_get_fd(int *fd); +SAPI_API int sapi_force_http_10(void); + +SAPI_API int sapi_get_target_uid(uid_t *); +SAPI_API int sapi_get_target_gid(gid_t *); +SAPI_API double sapi_get_request_time(void); +SAPI_API void sapi_terminate_process(void); END_EXTERN_C() struct _sapi_module_struct { @@ -225,63 +225,63 @@ struct _sapi_module_struct { int (*startup)(struct _sapi_module_struct *sapi_module); int (*shutdown)(struct _sapi_module_struct *sapi_module); - int (*activate)(TSRMLS_D); - int (*deactivate)(TSRMLS_D); + int (*activate)(void); + int (*deactivate)(void); - size_t (*ub_write)(const char *str, size_t str_length TSRMLS_DC); - void (*flush)(void *server_context TSRMLS_DC); - zend_stat_t *(*get_stat)(TSRMLS_D); - char *(*getenv)(char *name, size_t name_len TSRMLS_DC); + size_t (*ub_write)(const char *str, size_t str_length); + void (*flush)(void *server_context); + zend_stat_t *(*get_stat)(void); + char *(*getenv)(char *name, size_t name_len); void (*sapi_error)(int type, const char *error_msg, ...); - int (*header_handler)(sapi_header_struct *sapi_header, sapi_header_op_enum op, 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 TSRMLS_DC); + int (*header_handler)(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers); + int (*send_headers)(sapi_headers_struct *sapi_headers); + void (*send_header)(sapi_header_struct *sapi_header, void *server_context); - size_t (*read_post)(char *buffer, size_t count_bytes TSRMLS_DC); - char *(*read_cookies)(TSRMLS_D); + size_t (*read_post)(char *buffer, size_t count_bytes); + char *(*read_cookies)(void); - void (*register_server_variables)(zval *track_vars_array TSRMLS_DC); - void (*log_message)(char *message TSRMLS_DC); - double (*get_request_time)(TSRMLS_D); - void (*terminate_process)(TSRMLS_D); + void (*register_server_variables)(zval *track_vars_array); + void (*log_message)(char *message); + double (*get_request_time)(void); + void (*terminate_process)(void); char *php_ini_path_override; void (*block_interruptions)(void); void (*unblock_interruptions)(void); - void (*default_post_reader)(TSRMLS_D); - void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC); + void (*default_post_reader)(void); + void (*treat_data)(int arg, char *str, zval *destArray); char *executable_location; int php_ini_ignore; int php_ini_ignore_cwd; /* don't look for php.ini in the current directory */ - int (*get_fd)(int *fd TSRMLS_DC); + int (*get_fd)(int *fd); - int (*force_http_10)(TSRMLS_D); + int (*force_http_10)(void); - int (*get_target_uid)(uid_t * TSRMLS_DC); - int (*get_target_gid)(gid_t * TSRMLS_DC); + int (*get_target_uid)(uid_t *); + int (*get_target_gid)(gid_t *); - unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC); + unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len); void (*ini_defaults)(HashTable *configuration_hash); int phpinfo_as_text; char *ini_entries; const zend_function_entry *additional_functions; - unsigned int (*input_filter_init)(TSRMLS_D); + unsigned int (*input_filter_init)(void); }; struct _sapi_post_entry { char *content_type; uint content_type_len; - void (*post_reader)(TSRMLS_D); - void (*post_handler)(char *content_type_dup, void *arg TSRMLS_DC); + void (*post_reader)(void); + void (*post_handler)(char *content_type_dup, void *arg); }; /* header_handler() constants */ @@ -296,11 +296,11 @@ struct _sapi_post_entry { #define SAPI_DEFAULT_CHARSET PHP_DEFAULT_CHARSET #define SAPI_PHP_VERSION_HEADER "X-Powered-By: PHP/" PHP_VERSION -#define SAPI_POST_READER_FUNC(post_reader) void post_reader(TSRMLS_D) -#define SAPI_POST_HANDLER_FUNC(post_handler) void post_handler(char *content_type_dup, void *arg TSRMLS_DC) +#define SAPI_POST_READER_FUNC(post_reader) void post_reader(void) +#define SAPI_POST_HANDLER_FUNC(post_handler) void post_handler(char *content_type_dup, void *arg) -#define SAPI_TREAT_DATA_FUNC(treat_data) void treat_data(int arg, char *str, zval* destArray TSRMLS_DC) -#define SAPI_INPUT_FILTER_FUNC(input_filter) unsigned int input_filter(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC) +#define SAPI_TREAT_DATA_FUNC(treat_data) void treat_data(int arg, char *str, zval* destArray) +#define SAPI_INPUT_FILTER_FUNC(input_filter) unsigned int input_filter(int arg, char *var, char **val, size_t val_len, size_t *new_val_len) BEGIN_EXTERN_C() SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data); diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index b5b12eba56..9a53276be0 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -118,7 +118,7 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir) *end = '\0'; end++; } - if (php_check_open_basedir_ex(ptr, 0 TSRMLS_CC) != 0) { + if (php_check_open_basedir_ex(ptr, 0) != 0) { /* At least one portion of this open_basedir is less restrictive than the prior one, FAIL */ efree(pathbuf); return FAILURE; @@ -139,7 +139,7 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir) open_basedir. Returns -1 if error or not in the open_basedir, else 0. When open_basedir is NULL, always return 0. */ -PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path TSRMLS_DC) +PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path) { char resolved_name[MAXPATHLEN]; char resolved_basedir[MAXPATHLEN]; @@ -164,7 +164,7 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path } /* normalize and expand path */ - if (expand_filepath(path, resolved_name TSRMLS_CC) == NULL) { + if (expand_filepath(path, resolved_name) == NULL) { return -1; } @@ -225,7 +225,7 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path } /* Resolve open_basedir to resolved_basedir */ - if (expand_filepath(local_open_basedir, resolved_basedir TSRMLS_CC) != NULL) { + if (expand_filepath(local_open_basedir, resolved_basedir) != NULL) { int basedir_len = (int)strlen(basedir); /* Handler for basedirs that end with a / */ resolved_basedir_len = (int)strlen(resolved_basedir); @@ -284,14 +284,14 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path } /* }}} */ -PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC) +PHPAPI int php_check_open_basedir(const char *path) { - return php_check_open_basedir_ex(path, 1 TSRMLS_CC); + return php_check_open_basedir_ex(path, 1); } /* {{{ php_check_open_basedir */ -PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC) +PHPAPI int php_check_open_basedir_ex(const char *path, int warn) { /* Only check when open_basedir is available */ if (PG(open_basedir) && *PG(open_basedir)) { @@ -302,7 +302,7 @@ PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC) /* Check if the path is too long so we can give a more useful error * message. */ if (strlen(path) > (MAXPATHLEN - 1)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "File name is longer than the maximum allowed path length on this platform (%d): %s", MAXPATHLEN, path); + php_error_docref(NULL, E_WARNING, "File name is longer than the maximum allowed path length on this platform (%d): %s", MAXPATHLEN, path); errno = EINVAL; return -1; } @@ -318,7 +318,7 @@ PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC) end++; } - if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) { + if (php_check_specific_open_basedir(ptr, path) == 0) { efree(pathbuf); return 0; } @@ -326,7 +326,7 @@ PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC) ptr = end; } if (warn) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s)", path, PG(open_basedir)); + php_error_docref(NULL, E_WARNING, "open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s)", path, PG(open_basedir)); } efree(pathbuf); errno = EPERM; /* we deny permission to open it */ @@ -340,16 +340,16 @@ PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC) /* {{{ php_fopen_and_set_opened_path */ -static FILE *php_fopen_and_set_opened_path(const char *path, const char *mode, char **opened_path TSRMLS_DC) +static FILE *php_fopen_and_set_opened_path(const char *path, const char *mode, char **opened_path) { FILE *fp; - if (php_check_open_basedir((char *)path TSRMLS_CC)) { + if (php_check_open_basedir((char *)path)) { return NULL; } fp = VCWD_FOPEN(path, mode); if (fp && opened_path) { - *opened_path = expand_filepath_with_mode(path, NULL, NULL, 0, CWD_EXPAND TSRMLS_CC); + *opened_path = expand_filepath_with_mode(path, NULL, NULL, 0, CWD_EXPAND); } return fp; } @@ -357,7 +357,7 @@ static FILE *php_fopen_and_set_opened_path(const char *path, const char *mode, c /* {{{ php_fopen_primary_script */ -PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC) +PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle) { char *path_info; char *filename = NULL; @@ -429,7 +429,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC) if (filename) { - resolved_path = zend_resolve_path(filename, (int)strlen(filename) TSRMLS_CC); + resolved_path = zend_resolve_path(filename, (int)strlen(filename)); } if (!resolved_path) { @@ -452,7 +452,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC) orig_display_errors = PG(display_errors); PG(display_errors) = 0; - if (zend_stream_open(filename, file_handle TSRMLS_CC) == FAILURE) { + if (zend_stream_open(filename, file_handle) == FAILURE) { PG(display_errors) = orig_display_errors; if (SG(request_info).path_translated != filename) { if (filename) { @@ -481,7 +481,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC) /* {{{ php_resolve_path * Returns the realpath for given filename according to include path */ -PHPAPI char *php_resolve_path(const char *filename, int filename_length, const char *path TSRMLS_DC) +PHPAPI char *php_resolve_path(const char *filename, int filename_length, const char *path) { char resolved_path[MAXPATHLEN]; char trypath[MAXPATHLEN]; @@ -496,9 +496,9 @@ PHPAPI char *php_resolve_path(const char *filename, int filename_length, const c /* Don't resolve paths which contain protocol (except of file://) */ for (p = filename; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++); if ((*p == ':') && (p - filename > 1) && (p[1] == '/') && (p[2] == '/')) { - wrapper = php_stream_locate_url_wrapper(filename, &actual_path, STREAM_OPEN_FOR_INCLUDE TSRMLS_CC); + wrapper = php_stream_locate_url_wrapper(filename, &actual_path, STREAM_OPEN_FOR_INCLUDE); if (wrapper == &php_plain_files_wrapper) { - if (tsrm_realpath(actual_path, resolved_path TSRMLS_CC)) { + if (tsrm_realpath(actual_path, resolved_path)) { return estrdup(resolved_path); } } @@ -511,7 +511,7 @@ PHPAPI char *php_resolve_path(const char *filename, int filename_length, const c IS_ABSOLUTE_PATH(filename, filename_length) || !path || !*path) { - if (tsrm_realpath(filename, resolved_path TSRMLS_CC)) { + if (tsrm_realpath(filename, resolved_path)) { return estrdup(resolved_path); } else { return NULL; @@ -554,29 +554,29 @@ PHPAPI char *php_resolve_path(const char *filename, int filename_length, const c } actual_path = trypath; if (is_stream_wrapper) { - wrapper = php_stream_locate_url_wrapper(trypath, &actual_path, STREAM_OPEN_FOR_INCLUDE TSRMLS_CC); + wrapper = php_stream_locate_url_wrapper(trypath, &actual_path, STREAM_OPEN_FOR_INCLUDE); if (!wrapper) { continue; } else if (wrapper != &php_plain_files_wrapper) { if (wrapper->wops->url_stat) { php_stream_statbuf ssb; - if (SUCCESS == wrapper->wops->url_stat(wrapper, trypath, 0, &ssb, NULL TSRMLS_CC)) { + if (SUCCESS == wrapper->wops->url_stat(wrapper, trypath, 0, &ssb, NULL)) { return estrdup(trypath); } } continue; } } - if (tsrm_realpath(actual_path, resolved_path TSRMLS_CC)) { + if (tsrm_realpath(actual_path, resolved_path)) { return estrdup(resolved_path); } } /* end provided path */ /* check in calling scripts' current working directory as a fall back case */ - if (zend_is_executing(TSRMLS_C)) { - const char *exec_fname = zend_get_executed_filename(TSRMLS_C); + if (zend_is_executing()) { + const char *exec_fname = zend_get_executed_filename(); int exec_fname_length = (int)strlen(exec_fname); while ((--exec_fname_length >= 0) && !IS_SLASH(exec_fname[exec_fname_length])); @@ -590,14 +590,14 @@ PHPAPI char *php_resolve_path(const char *filename, int filename_length, const c /* Check for stream wrapper */ for (p = trypath; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++); if ((*p == ':') && (p - trypath > 1) && (p[1] == '/') && (p[2] == '/')) { - wrapper = php_stream_locate_url_wrapper(trypath, &actual_path, STREAM_OPEN_FOR_INCLUDE TSRMLS_CC); + wrapper = php_stream_locate_url_wrapper(trypath, &actual_path, STREAM_OPEN_FOR_INCLUDE); if (!wrapper) { return NULL; } else if (wrapper != &php_plain_files_wrapper) { if (wrapper->wops->url_stat) { php_stream_statbuf ssb; - if (SUCCESS == wrapper->wops->url_stat(wrapper, trypath, 0, &ssb, NULL TSRMLS_CC)) { + if (SUCCESS == wrapper->wops->url_stat(wrapper, trypath, 0, &ssb, NULL)) { return estrdup(trypath); } } @@ -605,7 +605,7 @@ PHPAPI char *php_resolve_path(const char *filename, int filename_length, const c } } - if (tsrm_realpath(actual_path, resolved_path TSRMLS_CC)) { + if (tsrm_realpath(actual_path, resolved_path)) { return estrdup(resolved_path); } } @@ -619,7 +619,7 @@ PHPAPI char *php_resolve_path(const char *filename, int filename_length, const c * Tries to open a file with a PATH-style list of directories. * If the filename starts with "." or "/", the path is ignored. */ -PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path TSRMLS_DC) +PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path) { char *pathbuf, *ptr, *end; const char *exec_fname; @@ -645,15 +645,15 @@ PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const c || IS_ABSOLUTE_PATH(filename, filename_length) || (!path || (path && !*path)) ) { - return php_fopen_and_set_opened_path(filename, mode, opened_path TSRMLS_CC); + return php_fopen_and_set_opened_path(filename, mode, opened_path); } /* check in provided path */ /* append the calling scripts' current working directory * as a fall back case */ - if (zend_is_executing(TSRMLS_C)) { - exec_fname = zend_get_executed_filename(TSRMLS_C); + if (zend_is_executing()) { + exec_fname = zend_get_executed_filename(); exec_fname_length = (int)strlen(exec_fname); path_length = (int)strlen(path); @@ -681,9 +681,9 @@ PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const c end++; } if (snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename) >= MAXPATHLEN) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path was truncated to %d", ptr, filename, MAXPATHLEN); + php_error_docref(NULL, E_NOTICE, "%s/%s path was truncated to %d", ptr, filename, MAXPATHLEN); } - fp = php_fopen_and_set_opened_path(trypath, mode, opened_path TSRMLS_CC); + fp = php_fopen_and_set_opened_path(trypath, mode, opened_path); if (fp) { efree(pathbuf); return fp; @@ -738,23 +738,23 @@ PHPAPI char *php_strip_url_passwd(char *url) /* {{{ expand_filepath */ -PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC) +PHPAPI char *expand_filepath(const char *filepath, char *real_path) { - return expand_filepath_ex(filepath, real_path, NULL, 0 TSRMLS_CC); + return expand_filepath_ex(filepath, real_path, NULL, 0); } /* }}} */ /* {{{ expand_filepath_ex */ -PHPAPI char *expand_filepath_ex(const char *filepath, char *real_path, const char *relative_to, size_t relative_to_len TSRMLS_DC) +PHPAPI char *expand_filepath_ex(const char *filepath, char *real_path, const char *relative_to, size_t relative_to_len) { - return expand_filepath_with_mode(filepath, real_path, relative_to, relative_to_len, CWD_FILEPATH TSRMLS_CC); + return expand_filepath_with_mode(filepath, real_path, relative_to, relative_to_len, CWD_FILEPATH); } /* }}} */ /* {{{ expand_filepath_use_realpath */ -PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char *relative_to, size_t relative_to_len, int realpath_mode TSRMLS_DC) +PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char *relative_to, size_t relative_to_len, int realpath_mode) { cwd_state new_state; char cwd[MAXPATHLEN]; @@ -810,7 +810,7 @@ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, co new_state.cwd = estrdup(cwd); new_state.cwd_length = (int)strlen(cwd); - if (virtual_file_ex(&new_state, filepath, NULL, realpath_mode TSRMLS_CC)) { + if (virtual_file_ex(&new_state, filepath, NULL, realpath_mode)) { efree(new_state.cwd); return NULL; } diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h index b58f54dce8..77fd69ef8c 100644 --- a/main/fopen_wrappers.h +++ b/main/fopen_wrappers.h @@ -25,30 +25,30 @@ BEGIN_EXTERN_C() #include "php_globals.h" #include "php_ini.h" -PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC); -PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC); -PHPAPI char *expand_filepath_ex(const char *filepath, char *real_path, const char *relative_to, size_t relative_to_len TSRMLS_DC); -PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char *relative_to, size_t relative_to_len, int use_realpath TSRMLS_DC); +PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle); +PHPAPI char *expand_filepath(const char *filepath, char *real_path); +PHPAPI char *expand_filepath_ex(const char *filepath, char *real_path, const char *relative_to, size_t relative_to_len); +PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char *relative_to, size_t relative_to_len, int use_realpath); -PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC); -PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC); -PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path TSRMLS_DC); +PHPAPI int php_check_open_basedir(const char *path); +PHPAPI int php_check_open_basedir_ex(const char *path, int warn); +PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path); /* {{{ OPENBASEDIR_CHECKPATH(filename) to ease merge between 6.x and 5.x */ #if PHP_API_VERSION < 20100412 # define OPENBASEDIR_CHECKPATH(filename) \ - (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC) + (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename) #else #define OPENBASEDIR_CHECKPATH(filename) \ - php_check_open_basedir(filename TSRMLS_CC) + php_check_open_basedir(filename) #endif /* }}} */ -PHPAPI int php_check_safe_mode_include_dir(const char *path TSRMLS_DC); +PHPAPI int php_check_safe_mode_include_dir(const char *path); -PHPAPI char *php_resolve_path(const char *filename, int filename_len, const char *path TSRMLS_DC); +PHPAPI char *php_resolve_path(const char *filename, int filename_len, const char *path); -PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path TSRMLS_DC); +PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path); PHPAPI char *php_strip_url_passwd(char *path); diff --git a/main/internal_functions.c.in b/main/internal_functions.c.in index 3f02921ddf..d04eea3103 100644 --- a/main/internal_functions.c.in +++ b/main/internal_functions.c.in @@ -35,9 +35,9 @@ static zend_module_entry *php_builtin_extensions[] = { #define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *)) -PHPAPI int php_register_internal_extensions(TSRMLS_D) +PHPAPI int php_register_internal_extensions(void) { - return php_register_extensions(php_builtin_extensions, EXTCOUNT TSRMLS_CC); + return php_register_extensions(php_builtin_extensions, EXTCOUNT); } /* diff --git a/main/internal_functions_nw.c b/main/internal_functions_nw.c index dcb84c346c..298a9115c2 100644 --- a/main/internal_functions_nw.c +++ b/main/internal_functions_nw.c @@ -84,9 +84,9 @@ static zend_module_entry *php_builtin_extensions[] = { #define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *)) -PHPAPI int php_register_internal_extensions(TSRMLS_D) +PHPAPI int php_register_internal_extensions(void) { - return php_register_extensions(php_builtin_extensions, EXTCOUNT TSRMLS_CC); + return php_register_extensions(php_builtin_extensions, EXTCOUNT); } diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c index b4718c379f..cb0234b4c3 100644 --- a/main/internal_functions_win32.c +++ b/main/internal_functions_win32.c @@ -189,9 +189,9 @@ static zend_module_entry *php_builtin_extensions[] = { #define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *)) -PHPAPI int php_register_internal_extensions(TSRMLS_D) +PHPAPI int php_register_internal_extensions(void) { - return php_register_extensions(php_builtin_extensions, EXTCOUNT TSRMLS_CC); + return php_register_extensions(php_builtin_extensions, EXTCOUNT); } /* diff --git a/main/main.c b/main/main.c index b58a643e84..276058ca3a 100644 --- a/main/main.c +++ b/main/main.c @@ -119,7 +119,7 @@ #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) #endif -PHPAPI int (*php_register_internal_extensions_func)(TSRMLS_D) = php_register_internal_extensions; +PHPAPI int (*php_register_internal_extensions_func)(void) = php_register_internal_extensions; #ifndef ZTS php_core_globals core_globals; @@ -130,7 +130,7 @@ PHPAPI int core_globals_id; #ifdef PHP_WIN32 #include "win32_internal_function_disabled.h" -static int php_win32_disable_functions(TSRMLS_D) +static int php_win32_disable_functions(void) { int i; @@ -182,14 +182,14 @@ static PHP_INI_MH(OnChangeMemoryLimit) } else { PG(memory_limit) = 1<<30; /* effectively, no limit */ } - return zend_set_memory_limit(PG(memory_limit) TSRMLS_CC); + return zend_set_memory_limit(PG(memory_limit)); } /* }}} */ /* {{{ php_disable_functions */ -static void php_disable_functions(TSRMLS_D) +static void php_disable_functions(void) { char *s = NULL, *e; @@ -207,7 +207,7 @@ static void php_disable_functions(TSRMLS_D) case ',': if (s) { *e = '\0'; - zend_disable_function(s, e-s TSRMLS_CC); + zend_disable_function(s, e-s); s = NULL; } break; @@ -220,14 +220,14 @@ static void php_disable_functions(TSRMLS_D) e++; } if (s) { - zend_disable_function(s, e-s TSRMLS_CC); + zend_disable_function(s, e-s); } } /* }}} */ /* {{{ php_disable_classes */ -static void php_disable_classes(TSRMLS_D) +static void php_disable_classes(void) { char *s = NULL, *e; @@ -243,7 +243,7 @@ static void php_disable_classes(TSRMLS_D) case ',': if (s) { *e = '\0'; - zend_disable_class(s, e-s TSRMLS_CC); + zend_disable_class(s, e-s); s = NULL; } break; @@ -256,14 +256,14 @@ static void php_disable_classes(TSRMLS_D) e++; } if (s) { - zend_disable_class(s, e-s TSRMLS_CC); + zend_disable_class(s, e-s); } } /* }}} */ /* {{{ php_binary_init */ -static void php_binary_init(TSRMLS_D) +static void php_binary_init(void) { char *binary_location; #ifdef PHP_WIN32 @@ -322,7 +322,7 @@ static PHP_INI_MH(OnUpdateTimeout) ZEND_ATOL(EG(timeout_seconds), new_value->val); return SUCCESS; } - zend_unset_timeout(TSRMLS_C); + zend_unset_timeout(); ZEND_ATOL(EG(timeout_seconds), new_value->val); zend_set_timeout(EG(timeout_seconds), 0); return SUCCESS; @@ -376,7 +376,6 @@ static PHP_INI_DISP(display_errors_mode) { int mode, tmp_value_length, cgi_or_cli; char *tmp_value; - TSRMLS_FETCH(); if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { tmp_value = (ini_entry->orig_value ? ini_entry->orig_value->val : NULL ); @@ -423,7 +422,7 @@ static PHP_INI_DISP(display_errors_mode) static PHP_INI_MH(OnUpdateInternalEncoding) { if (new_value) { - OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); } else { PG(internal_encoding) = SG(default_charset); } @@ -436,7 +435,7 @@ static PHP_INI_MH(OnUpdateInternalEncoding) static PHP_INI_MH(OnUpdateInputEncoding) { if (new_value) { - OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); } else { PG(input_encoding) = SG(default_charset); } @@ -449,7 +448,7 @@ static PHP_INI_MH(OnUpdateInputEncoding) static PHP_INI_MH(OnUpdateOutputEncoding) { if (new_value) { - OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); } else { PG(output_encoding) = SG(default_charset); } @@ -463,11 +462,11 @@ static PHP_INI_MH(OnUpdateErrorLog) { /* Only do the safemode/open_basedir check at runtime */ if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value && strcmp(new_value->val, "syslog")) { - if (PG(open_basedir) && php_check_open_basedir(new_value->val TSRMLS_CC)) { + if (PG(open_basedir) && php_check_open_basedir(new_value->val)) { return FAILURE; } } - OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); return SUCCESS; } /* }}} */ @@ -478,11 +477,11 @@ static PHP_INI_MH(OnUpdateMailLog) { /* Only do the safemode/open_basedir check at runtime */ if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value) { - if (PG(open_basedir) && php_check_open_basedir(new_value->val TSRMLS_CC)) { + if (PG(open_basedir) && php_check_open_basedir(new_value->val)) { return FAILURE; } } - OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); return SUCCESS; } /* }}} */ @@ -649,7 +648,7 @@ PHPAPI int php_get_module_initialized(void) /* {{{ php_log_err */ -PHPAPI void php_log_err(char *log_message TSRMLS_DC) +PHPAPI void php_log_err(char *log_message) { int fd = -1; time_t error_time; @@ -678,12 +677,12 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) time(&error_time); #ifdef ZTS if (!php_during_module_startup()) { - error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC); + error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1); } else { - error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC); + error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0); } #else - error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC); + error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1); #endif len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str->val, log_message, PHP_EOL); #ifdef PHP_WIN32 @@ -704,7 +703,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) /* Otherwise fall back to the default logging location, if we have one */ if (sapi_module.log_message) { - sapi_module.log_message(log_message TSRMLS_CC); + sapi_module.log_message(log_message); } PG(in_error_log) = 0; } @@ -712,7 +711,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) /* {{{ php_write wrapper for modules to use PHPWRITE */ -PHPAPI size_t php_write(void *buf, size_t size TSRMLS_DC) +PHPAPI size_t php_write(void *buf, size_t size) { return PHPWRITE(buf, size); } @@ -726,7 +725,6 @@ PHPAPI size_t php_printf(const char *format, ...) size_t ret; char *buffer; size_t size; - TSRMLS_FETCH(); va_start(args, format); size = vspprintf(&buffer, 0, format, args); @@ -744,7 +742,7 @@ PHPAPI size_t php_printf(const char *format, ...) * html error messages if correcponding ini setting (html_errors) is activated. * See: CODING_STANDARDS for details. */ -PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC) +PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args) { zend_string *replace_buffer = NULL, *replace_origin = NULL; char *buffer = NULL, *docref_buf = NULL, *target = NULL; @@ -763,7 +761,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c buffer_len = (int)vspprintf(&buffer, 0, format, args); if (PG(html_errors)) { - replace_buffer = php_escape_html_entities(buffer, buffer_len, 0, ENT_COMPAT, NULL TSRMLS_CC); + replace_buffer = php_escape_html_entities(buffer, buffer_len, 0, ENT_COMPAT, NULL); efree(buffer); buffer = replace_buffer->val; buffer_len = (int)replace_buffer->len; @@ -805,12 +803,12 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c function = "Unknown"; } } else { - function = get_active_function_name(TSRMLS_C); + function = get_active_function_name(); if (!function || !strlen(function)) { function = "Unknown"; } else { is_function = 1; - class_name = get_active_class_name(&space TSRMLS_CC); + class_name = get_active_class_name(&space); } } @@ -822,7 +820,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c } if (PG(html_errors)) { - replace_origin = php_escape_html_entities(origin, origin_len, 0, ENT_COMPAT, NULL TSRMLS_CC); + replace_origin = php_escape_html_entities(origin, origin_len, 0, ENT_COMPAT, NULL); efree(origin); origin = replace_origin->val; } @@ -909,7 +907,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c zval tmp; ZVAL_STRINGL(&tmp, buffer, buffer_len); if (EG(current_execute_data)) { - if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0 TSRMLS_CC) == FAILURE) { + if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) { zval_ptr_dtor(&tmp); } } else { @@ -929,38 +927,38 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c /* {{{ php_error_docref0 */ /* See: CODING_STANDARDS for details. */ -PHPAPI void php_error_docref0(const char *docref TSRMLS_DC, int type, const char *format, ...) +PHPAPI void php_error_docref0(const char *docref, int type, const char *format, ...) { va_list args; va_start(args, format); - php_verror(docref, "", type, format, args TSRMLS_CC); + php_verror(docref, "", type, format, args); va_end(args); } /* }}} */ /* {{{ php_error_docref1 */ /* See: CODING_STANDARDS for details. */ -PHPAPI void php_error_docref1(const char *docref TSRMLS_DC, const char *param1, int type, const char *format, ...) +PHPAPI void php_error_docref1(const char *docref, const char *param1, int type, const char *format, ...) { va_list args; va_start(args, format); - php_verror(docref, param1, type, format, args TSRMLS_CC); + php_verror(docref, param1, type, format, args); va_end(args); } /* }}} */ /* {{{ php_error_docref2 */ /* See: CODING_STANDARDS for details. */ -PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char *format, ...) +PHPAPI void php_error_docref2(const char *docref, const char *param1, const char *param2, int type, const char *format, ...) { char *params; va_list args; spprintf(¶ms, 0, "%s,%s", param1, param2); va_start(args, format); - php_verror(docref, params ? params : "...", type, format, args TSRMLS_CC); + php_verror(docref, params ? params : "...", type, format, args); va_end(args); if (params) { efree(params); @@ -970,9 +968,9 @@ PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, #ifdef PHP_WIN32 #define PHP_WIN32_ERROR_MSG_BUFFER_SIZE 512 -PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2 TSRMLS_DC) { +PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2) { if (error == 0) { - php_error_docref2(NULL TSRMLS_CC, param1, param2, E_WARNING, "%s", strerror(errno)); + php_error_docref2(NULL, param1, param2, E_WARNING, "%s", strerror(errno)); } else { char buf[PHP_WIN32_ERROR_MSG_BUFFER_SIZE + 1]; int buf_len; @@ -983,16 +981,16 @@ PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const buf[buf_len - 1] = '\0'; buf[buf_len - 2] = '\0'; } - php_error_docref2(NULL TSRMLS_CC, param1, param2, E_WARNING, "%s (code: %lu)", (char *)buf, error); + php_error_docref2(NULL, param1, param2, E_WARNING, "%s (code: %lu)", (char *)buf, error); } } #undef PHP_WIN32_ERROR_MSG_BUFFER_SIZE #endif /* {{{ php_html_puts */ -PHPAPI void php_html_puts(const char *str, size_t size TSRMLS_DC) +PHPAPI void php_html_puts(const char *str, size_t size) { - zend_html_puts(str, size TSRMLS_CC); + zend_html_puts(str, size); } /* }}} */ @@ -1002,7 +1000,6 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ { char *buffer; int buffer_len, display; - TSRMLS_FETCH(); buffer_len = (int)vspprintf(&buffer, PG(log_errors_max_len), format, args); @@ -1071,7 +1068,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ * but DO NOT overwrite a pending exception */ if (EG(error_handling) == EH_THROW && !EG(exception)) { - zend_throw_error_exception(EG(exception_class), buffer, 0, type TSRMLS_CC); + zend_throw_error_exception(EG(exception_class), buffer, 0, type); } efree(buffer); return; @@ -1126,7 +1123,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ } #endif spprintf(&log_buffer, 0, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno); - php_log_err(log_buffer TSRMLS_CC); + php_log_err(log_buffer); efree(log_buffer); } @@ -1139,7 +1136,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ if (PG(html_errors)) { if (type == E_ERROR || type == E_PARSE) { - zend_string *buf = php_escape_html_entities(buffer, buffer_len, 0, ENT_COMPAT, NULL TSRMLS_CC); + zend_string *buf = php_escape_html_entities(buffer, buffer_len, 0, ENT_COMPAT, NULL); php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, buf->val, error_filename, error_lineno, STR_PRINT(append_string)); zend_string_free(buf); } else { @@ -1223,16 +1220,16 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ ctr.line = "HTTP/1.0 500 Internal Server Error"; ctr.line_len = sizeof("HTTP/1.0 500 Internal Server Error") - 1; - sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC); + sapi_header_op(SAPI_HEADER_REPLACE, &ctr); } /* the parser would return 1 (failure), we can bail out nicely */ if (type == E_PARSE) { CG(parse_error) = 0; } else { /* restore memory limit */ - zend_set_memory_limit(PG(memory_limit) TSRMLS_CC); + zend_set_memory_limit(PG(memory_limit)); efree(buffer); - zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC); + zend_objects_store_mark_destructed(&EG(objects_store)); zend_bailout(); return; } @@ -1252,7 +1249,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ ZVAL_STRINGL(&tmp, buffer, buffer_len); if (EG(current_execute_data)) { - if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0 TSRMLS_CC) == FAILURE) { + if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) { zval_ptr_dtor(&tmp); } } else { @@ -1266,7 +1263,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ /* {{{ php_get_current_user */ -PHPAPI char *php_get_current_user(TSRMLS_D) +PHPAPI char *php_get_current_user(void) { zend_stat_t *pstat; @@ -1278,7 +1275,7 @@ PHPAPI char *php_get_current_user(TSRMLS_D) USE_SAPI is defined, because cgi will also be interfaced in USE_SAPI */ - pstat = sapi_get_stat(TSRMLS_C); + pstat = sapi_get_stat(); if (!pstat) { return ""; @@ -1336,14 +1333,14 @@ PHP_FUNCTION(set_time_limit) int new_timeout_strlen; zend_string *key; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_timeout) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &new_timeout) == FAILURE) { return; } new_timeout_strlen = (int)zend_spprintf(&new_timeout_str, 0, ZEND_LONG_FMT, new_timeout); key = zend_string_init("max_execution_time", sizeof("max_execution_time")-1, 0); - if (zend_alter_ini_entry_chars_ex(key, new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) { + if (zend_alter_ini_entry_chars_ex(key, new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0) == SUCCESS) { RETVAL_TRUE; } else { RETVAL_FALSE; @@ -1355,26 +1352,26 @@ PHP_FUNCTION(set_time_limit) /* {{{ php_fopen_wrapper_for_zend */ -static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path TSRMLS_DC) +static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path) { return php_stream_open_wrapper_as_file((char *)filename, "rb", USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE, opened_path); } /* }}} */ -static void php_zend_stream_closer(void *handle TSRMLS_DC) /* {{{ */ +static void php_zend_stream_closer(void *handle) /* {{{ */ { php_stream_close((php_stream*)handle); } /* }}} */ -static void php_zend_stream_mmap_closer(void *handle TSRMLS_DC) /* {{{ */ +static void php_zend_stream_mmap_closer(void *handle) /* {{{ */ { php_stream_mmap_unmap((php_stream*)handle); - php_zend_stream_closer(handle TSRMLS_CC); + php_zend_stream_closer(handle); } /* }}} */ -static size_t php_zend_stream_fsizer(void *handle TSRMLS_DC) /* {{{ */ +static size_t php_zend_stream_fsizer(void *handle) /* {{{ */ { php_stream_statbuf ssb; if (php_stream_stat((php_stream*)handle, &ssb) == 0) { @@ -1384,13 +1381,13 @@ static size_t php_zend_stream_fsizer(void *handle TSRMLS_DC) /* {{{ */ } /* }}} */ -static int php_stream_open_for_zend(const char *filename, zend_file_handle *handle TSRMLS_DC) /* {{{ */ +static int php_stream_open_for_zend(const char *filename, zend_file_handle *handle) /* {{{ */ { - return php_stream_open_for_zend_ex(filename, handle, USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC); + return php_stream_open_for_zend_ex(filename, handle, USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE); } /* }}} */ -PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode TSRMLS_DC) /* {{{ */ +PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode) /* {{{ */ { char *p; size_t len, mapped_len; @@ -1409,7 +1406,7 @@ PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *h handle->handle.stream.isatty = 0; /* can we mmap immediately? */ memset(&handle->handle.stream.mmap, 0, sizeof(handle->handle.stream.mmap)); - len = php_zend_stream_fsizer(stream TSRMLS_CC); + len = php_zend_stream_fsizer(stream); if (len != 0 #if HAVE_MMAP || defined(PHP_WIN32) && ((len - 1) % page_size) <= page_size - ZEND_MMAP_AHEAD @@ -1433,9 +1430,9 @@ PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *h } /* }}} */ -static char *php_resolve_path_for_zend(const char *filename, int filename_len TSRMLS_DC) /* {{{ */ +static char *php_resolve_path_for_zend(const char *filename, int filename_len) /* {{{ */ { - return php_resolve_path(filename, filename_len, PG(include_path) TSRMLS_CC); + return php_resolve_path(filename, filename_len, PG(include_path)); } /* }}} */ @@ -1449,17 +1446,17 @@ static zval *php_get_configuration_directive_for_zend(zend_string *name) /* {{{ php_message_handler_for_zend */ -static void php_message_handler_for_zend(zend_long message, const void *data TSRMLS_DC) +static void php_message_handler_for_zend(zend_long message, const void *data) { switch (message) { case ZMSG_FAILED_INCLUDE_FOPEN: - php_error_docref("function.include" TSRMLS_CC, E_WARNING, "Failed opening '%s' for inclusion (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); + php_error_docref("function.include", 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: - php_error_docref("function.require" TSRMLS_CC, E_COMPILE_ERROR, "Failed opening required '%s' (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); + php_error_docref("function.require", E_COMPILE_ERROR, "Failed opening required '%s' (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); break; case ZMSG_FAILED_HIGHLIGHT_FOPEN: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed opening '%s' for highlighting", php_strip_url_passwd((char *) data)); + php_error_docref(NULL, E_WARNING, "Failed opening '%s' for highlighting", php_strip_url_passwd((char *) data)); break; case ZMSG_MEMORY_LEAK_DETECTED: case ZMSG_MEMORY_LEAK_REPEATED: @@ -1531,11 +1528,11 @@ static void php_message_handler_for_zend(zend_long message, const void *data TSR /* }}} */ -void php_on_timeout(int seconds TSRMLS_DC) +void php_on_timeout(int seconds) { PG(connection_status) |= PHP_CONNECTION_TIMEOUT; zend_set_timeout(EG(timeout_seconds), 1); - if(PG(exit_on_timeout)) sapi_terminate_process(TSRMLS_C); + if(PG(exit_on_timeout)) sapi_terminate_process(); } #if PHP_SIGCHILD @@ -1555,7 +1552,7 @@ static void sigchld_handler(int apar) /* {{{ php_start_sapi() */ -static int php_start_sapi(TSRMLS_D) +static int php_start_sapi(void) { int retval = SUCCESS; @@ -1568,9 +1565,9 @@ static int php_start_sapi(TSRMLS_D) PG(header_is_being_sent) = 0; PG(connection_status) = PHP_CONNECTION_NORMAL; - zend_activate(TSRMLS_C); + zend_activate(); zend_set_timeout(EG(timeout_seconds), 1); - zend_activate_modules(TSRMLS_C); + zend_activate_modules(); PG(modules_activated)=1; } zend_catch { retval = FAILURE; @@ -1586,7 +1583,7 @@ static int php_start_sapi(TSRMLS_D) /* {{{ php_request_startup */ #ifndef APACHE_HOOKS -int php_request_startup(TSRMLS_D) +int php_request_startup(void) { int retval = SUCCESS; @@ -1606,7 +1603,7 @@ int php_request_startup(TSRMLS_D) PG(in_error_log) = 0; PG(during_request_startup) = 1; - php_output_activate(TSRMLS_C); + php_output_activate(); /* initialize global variables */ PG(modules_activated) = 0; @@ -1614,11 +1611,11 @@ int php_request_startup(TSRMLS_D) PG(connection_status) = PHP_CONNECTION_NORMAL; PG(in_user_include) = 0; - zend_activate(TSRMLS_C); - sapi_activate(TSRMLS_C); + zend_activate(); + sapi_activate(); #ifdef ZEND_SIGNALS - zend_signal_activate(TSRMLS_C); + zend_signal_activate(); #endif if (PG(max_input_time) == -1) { @@ -1640,19 +1637,19 @@ int php_request_startup(TSRMLS_D) zval oh; ZVAL_STRING(&oh, PG(output_handler)); - php_output_start_user(&oh, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC); + php_output_start_user(&oh, 0, PHP_OUTPUT_HANDLER_STDFLAGS); zval_ptr_dtor(&oh); } else if (PG(output_buffering)) { - php_output_start_user(NULL, PG(output_buffering) > 1 ? PG(output_buffering) : 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC); + php_output_start_user(NULL, PG(output_buffering) > 1 ? PG(output_buffering) : 0, PHP_OUTPUT_HANDLER_STDFLAGS); } else if (PG(implicit_flush)) { - php_output_set_implicit_flush(1 TSRMLS_CC); + php_output_set_implicit_flush(1); } /* We turn this off in php_execute_script() */ /* PG(during_request_startup) = 0; */ - php_hash_environment(TSRMLS_C); - zend_activate_modules(TSRMLS_C); + php_hash_environment(); + zend_activate_modules(); PG(modules_activated)=1; } zend_catch { retval = FAILURE; @@ -1663,7 +1660,7 @@ int php_request_startup(TSRMLS_D) return retval; } # else -int php_request_startup(TSRMLS_D) +int php_request_startup(void) { int retval = SUCCESS; @@ -1675,9 +1672,9 @@ int php_request_startup(TSRMLS_D) return FAILURE; } - php_output_activate(TSRMLS_C); - sapi_activate(TSRMLS_C); - php_hash_environment(TSRMLS_C); + php_output_activate(); + sapi_activate(); + php_hash_environment(); zend_try { PG(during_request_startup) = 1; @@ -1695,7 +1692,7 @@ int php_request_startup(TSRMLS_D) /* {{{ php_request_startup_for_hook */ -int php_request_startup_for_hook(TSRMLS_D) +int php_request_startup_for_hook(void) { int retval = SUCCESS; @@ -1703,13 +1700,13 @@ int php_request_startup_for_hook(TSRMLS_D) signal(SIGCHLD, sigchld_handler); #endif - if (php_start_sapi(TSRMLS_C) == FAILURE) { + if (php_start_sapi() == FAILURE) { return FAILURE; } - php_output_activate(TSRMLS_C); - sapi_activate_headers_only(TSRMLS_C); - php_hash_environment(TSRMLS_C); + php_output_activate(); + sapi_activate_headers_only(); + php_hash_environment(); return retval; } @@ -1719,12 +1716,11 @@ int php_request_startup_for_hook(TSRMLS_D) */ void php_request_shutdown_for_exec(void *dummy) { - TSRMLS_FETCH(); /* used to close fd's in the 3..255 range here, but it's problematic */ - shutdown_memory_manager(1, 1 TSRMLS_CC); - zend_interned_strings_restore(TSRMLS_C); + shutdown_memory_manager(1, 1); + zend_interned_strings_restore(); } /* }}} */ @@ -1732,19 +1728,18 @@ void php_request_shutdown_for_exec(void *dummy) */ void php_request_shutdown_for_hook(void *dummy) { - TSRMLS_FETCH(); if (PG(modules_activated)) zend_try { - php_call_shutdown_functions(TSRMLS_C); + php_call_shutdown_functions(); } zend_end_try(); if (PG(modules_activated)) { - zend_deactivate_modules(TSRMLS_C); - php_free_shutdown_functions(TSRMLS_C); + zend_deactivate_modules(); + php_free_shutdown_functions(); } zend_try { - zend_unset_timeout(TSRMLS_C); + zend_unset_timeout(); } zend_end_try(); zend_try { @@ -1755,25 +1750,25 @@ void php_request_shutdown_for_hook(void *dummy) } } zend_end_try(); - zend_deactivate(TSRMLS_C); + zend_deactivate(); zend_try { - sapi_deactivate(TSRMLS_C); + sapi_deactivate(); } zend_end_try(); zend_try { - php_shutdown_stream_hashes(TSRMLS_C); + php_shutdown_stream_hashes(); } zend_end_try(); zend_try { - shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC); + shutdown_memory_manager(CG(unclean_shutdown), 0); } zend_end_try(); - zend_interned_strings_restore(TSRMLS_C); + zend_interned_strings_restore(); #ifdef ZEND_SIGNALS zend_try { - zend_signal_deactivate(TSRMLS_C); + zend_signal_deactivate(); } zend_end_try(); #endif } @@ -1785,7 +1780,6 @@ void php_request_shutdown_for_hook(void *dummy) void php_request_shutdown(void *dummy) { zend_bool report_memleaks; - TSRMLS_FETCH(); report_memleaks = PG(report_memleaks); @@ -1794,16 +1788,16 @@ void php_request_shutdown(void *dummy) */ EG(current_execute_data) = NULL; - php_deactivate_ticks(TSRMLS_C); + php_deactivate_ticks(); /* 1. Call all possible shutdown functions registered with register_shutdown_function() */ if (PG(modules_activated)) zend_try { - php_call_shutdown_functions(TSRMLS_C); + php_call_shutdown_functions(); } zend_end_try(); /* 2. Call all possible __destruct() functions */ zend_try { - zend_call_destructors(TSRMLS_C); + zend_call_destructors(); } zend_end_try(); /* 3. Flush all output buffers */ @@ -1811,32 +1805,32 @@ void php_request_shutdown(void *dummy) zend_bool send_buffer = SG(request_info).headers_only ? 0 : 1; if (CG(unclean_shutdown) && PG(last_error_type) == E_ERROR && - (size_t)PG(memory_limit) < zend_memory_usage(1 TSRMLS_CC) + (size_t)PG(memory_limit) < zend_memory_usage(1) ) { send_buffer = 0; } if (!send_buffer) { - php_output_discard_all(TSRMLS_C); + php_output_discard_all(); } else { - php_output_end_all(TSRMLS_C); + php_output_end_all(); } } zend_end_try(); /* 4. Reset max_execution_time (no longer executing php code after response sent) */ zend_try { - zend_unset_timeout(TSRMLS_C); + zend_unset_timeout(); } zend_end_try(); /* 5. Call all extensions RSHUTDOWN functions */ if (PG(modules_activated)) { - zend_deactivate_modules(TSRMLS_C); - php_free_shutdown_functions(TSRMLS_C); + zend_deactivate_modules(); + php_free_shutdown_functions(); } /* 6. Shutdown output layer (send the set HTTP headers, cleanup output handlers, etc.) */ zend_try { - php_output_deactivate(TSRMLS_C); + php_output_deactivate(); } zend_end_try(); /* 7. Destroy super-globals */ @@ -1859,35 +1853,35 @@ void php_request_shutdown(void *dummy) } /* 9. Shutdown scanner/executor/compiler and restore ini entries */ - zend_deactivate(TSRMLS_C); + zend_deactivate(); /* 10. Call all extensions post-RSHUTDOWN functions */ zend_try { - zend_post_deactivate_modules(TSRMLS_C); + zend_post_deactivate_modules(); } zend_end_try(); /* 11. SAPI related shutdown (free stuff) */ zend_try { - sapi_deactivate(TSRMLS_C); + sapi_deactivate(); } zend_end_try(); /* 12. free virtual CWD memory */ - virtual_cwd_deactivate(TSRMLS_C); + virtual_cwd_deactivate(); /* 13. Destroy stream hashes */ zend_try { - php_shutdown_stream_hashes(TSRMLS_C); + php_shutdown_stream_hashes(); } zend_end_try(); /* 14. Free Willy (here be crashes) */ - zend_interned_strings_restore(TSRMLS_C); + zend_interned_strings_restore(); zend_try { - shutdown_memory_manager(CG(unclean_shutdown) || !report_memleaks, 0 TSRMLS_CC); + shutdown_memory_manager(CG(unclean_shutdown) || !report_memleaks, 0); } zend_end_try(); /* 15. Reset max_execution_time */ zend_try { - zend_unset_timeout(TSRMLS_C); + zend_unset_timeout(); } zend_end_try(); #ifdef PHP_WIN32 @@ -1905,7 +1899,7 @@ void php_request_shutdown(void *dummy) /* {{{ php_com_initialize */ -PHPAPI void php_com_initialize(TSRMLS_D) +PHPAPI void php_com_initialize(void) { #ifdef PHP_WIN32 if (!PG(com_initialized)) { @@ -1921,26 +1915,25 @@ PHPAPI void php_com_initialize(TSRMLS_D) */ static size_t php_output_wrapper(const char *str, size_t str_length) { - TSRMLS_FETCH(); - return php_output_write(str, str_length TSRMLS_CC); + return php_output_write(str, str_length); } /* }}} */ #ifdef ZTS /* {{{ core_globals_ctor */ -static void core_globals_ctor(php_core_globals *core_globals TSRMLS_DC) +static void core_globals_ctor(php_core_globals *core_globals) { memset(core_globals, 0, sizeof(*core_globals)); - php_startup_ticks(TSRMLS_C); + php_startup_ticks(); } /* }}} */ #endif /* {{{ core_globals_dtor */ -static void core_globals_dtor(php_core_globals *core_globals TSRMLS_DC) +static void core_globals_dtor(php_core_globals *core_globals) { if (core_globals->last_error_message) { free(core_globals->last_error_message); @@ -1958,7 +1951,7 @@ static void core_globals_dtor(php_core_globals *core_globals TSRMLS_DC) free(core_globals->php_binary); } - php_shutdown_ticks(TSRMLS_C); + php_shutdown_ticks(); } /* }}} */ @@ -1972,13 +1965,13 @@ PHP_MINFO_FUNCTION(php_core) { /* {{{ */ /* {{{ php_register_extensions */ -int php_register_extensions(zend_module_entry **ptr, int count TSRMLS_DC) +int php_register_extensions(zend_module_entry **ptr, int count) { zend_module_entry **end = ptr + count; while (ptr < end) { if (*ptr) { - if (zend_register_internal_module(*ptr TSRMLS_CC)==NULL) { + if (zend_register_internal_module(*ptr)==NULL) { return FAILURE; } } @@ -1994,10 +1987,10 @@ int php_register_extensions(zend_module_entry **ptr, int count TSRMLS_DC) * * See algo: https://bugs.php.net/bug.php?id=63159 */ -static int php_register_extensions_bc(zend_module_entry *ptr, int count TSRMLS_DC) +static int php_register_extensions_bc(zend_module_entry *ptr, int count) { while (count--) { - if (zend_register_internal_module(ptr++ TSRMLS_CC) == NULL) { + if (zend_register_internal_module(ptr++) == NULL) { return FAILURE; } } @@ -2020,8 +2013,7 @@ void dummy_invalid_parameter_handler( int len; if (!called) { - TSRMLS_FETCH(); - if(PG(windows_show_crt_warning)) { + if(PG(windows_show_crt_warning)) { called = 1; if (function) { if (file) { @@ -2084,8 +2076,8 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod module_shutdown = 0; module_startup = 1; - sapi_initialize_empty_request(TSRMLS_C); - sapi_activate(TSRMLS_C); + sapi_initialize_empty_request(); + sapi_activate(); if (module_initialized) { return SUCCESS; @@ -2110,7 +2102,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod zuf.vstrpprintf_function = vstrpprintf; zuf.getenv_function = sapi_getenv; zuf.resolve_path_function = php_resolve_path_for_zend; - zend_startup(&zuf, NULL TSRMLS_CC); + zend_startup(&zuf, NULL); #ifdef ZTS executor_globals = ts_resource(executor_globals_id); @@ -2120,9 +2112,9 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod ts_allocate_id(&php_win32_core_globals_id, sizeof(php_win32_core_globals), (ts_allocate_ctor) php_win32_core_globals_ctor, (ts_allocate_dtor) php_win32_core_globals_dtor); #endif #else - php_startup_ticks(TSRMLS_C); + php_startup_ticks(); #endif - gc_globals_ctor(TSRMLS_C); + gc_globals_ctor(); #ifdef PHP_WIN32 { @@ -2225,20 +2217,20 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_NT_WORKSTATION", VER_NT_WORKSTATION, CONST_PERSISTENT | CONST_CS); #endif - php_binary_init(TSRMLS_C); + php_binary_init(); if (PG(php_binary)) { REGISTER_MAIN_STRINGL_CONSTANT("PHP_BINARY", PG(php_binary), strlen(PG(php_binary)), CONST_PERSISTENT | CONST_CS); } else { REGISTER_MAIN_STRINGL_CONSTANT("PHP_BINARY", "", 0, CONST_PERSISTENT | CONST_CS); } - php_output_register_constants(TSRMLS_C); - php_rfc1867_register_constants(TSRMLS_C); + php_output_register_constants(); + php_rfc1867_register_constants(); /* this will read in php.ini, set up the configuration parameters, load zend extensions and register php function extensions to be loaded later */ - if (php_init_config(TSRMLS_C) == FAILURE) { + if (php_init_config() == FAILURE) { return FAILURE; } @@ -2246,7 +2238,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod REGISTER_INI_ENTRIES(); /* Register Zend ini entries */ - zend_register_standard_ini_entries(TSRMLS_C); + zend_register_standard_ini_entries(); /* Disable realpath cache if an open_basedir is set */ if (PG(open_basedir) && *PG(open_basedir)) { @@ -2256,25 +2248,25 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod /* initialize stream wrappers registry * (this uses configuration parameters from php.ini) */ - if (php_init_stream_wrappers(module_number TSRMLS_CC) == FAILURE) { + if (php_init_stream_wrappers(module_number) == FAILURE) { php_printf("PHP: Unable to initialize stream url wrappers.\n"); return FAILURE; } zuv.html_errors = 1; zuv.import_use_extension = ".php"; - php_startup_auto_globals(TSRMLS_C); + php_startup_auto_globals(); zend_set_utility_values(&zuv); - php_startup_sapi_content_types(TSRMLS_C); + php_startup_sapi_content_types(); /* startup extensions statically compiled in */ - if (php_register_internal_extensions_func(TSRMLS_C) == FAILURE) { + if (php_register_internal_extensions_func() == FAILURE) { php_printf("Unable to start builtin modules\n"); return FAILURE; } /* start additional PHP extensions */ - php_register_extensions_bc(additional_modules, num_additional_modules TSRMLS_CC); + php_register_extensions_bc(additional_modules, num_additional_modules); /* load and startup extensions compiled as shared objects (aka DLLs) as requested by php.ini entries @@ -2283,26 +2275,26 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod which is always an internal extension and to be initialized ahead of all other internals */ - php_ini_register_extensions(TSRMLS_C); - zend_startup_modules(TSRMLS_C); + php_ini_register_extensions(); + zend_startup_modules(); /* start Zend extensions */ zend_startup_extensions(); - zend_collect_module_handlers(TSRMLS_C); + zend_collect_module_handlers(); /* register additional functions */ if (sapi_module.additional_functions) { if ((module = zend_hash_str_find_ptr(&module_registry, "standard", sizeof("standard")-1)) != NULL) { EG(current_module) = module; - zend_register_functions(NULL, sapi_module.additional_functions, NULL, MODULE_PERSISTENT TSRMLS_CC); + zend_register_functions(NULL, sapi_module.additional_functions, NULL, MODULE_PERSISTENT); EG(current_module) = NULL; } } /* disable certain classes and functions as requested by php.ini */ - php_disable_functions(TSRMLS_C); - php_disable_classes(TSRMLS_C); + php_disable_functions(); + php_disable_classes(); /* make core report what it should */ if ((module = zend_hash_str_find_ptr(&module_registry, "core", sizeof("core")-1)) != NULL) { @@ -2313,13 +2305,13 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod #ifdef PHP_WIN32 /* Disable incompatible functions for the running platform */ - if (php_win32_disable_functions(TSRMLS_C) == FAILURE) { + if (php_win32_disable_functions() == FAILURE) { php_printf("Unable to disable unsupported functions\n"); return FAILURE; } #endif - zend_post_startup(TSRMLS_C); + zend_post_startup(); module_initialized = 1; @@ -2385,12 +2377,12 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod } zend_end_try(); } - sapi_deactivate(TSRMLS_C); + sapi_deactivate(); module_startup = 0; - shutdown_memory_manager(1, 0 TSRMLS_CC); - zend_interned_strings_snapshot(TSRMLS_C); - virtual_cwd_activate(TSRMLS_C); + shutdown_memory_manager(1, 0); + zend_interned_strings_snapshot(); + virtual_cwd_activate(); /* we're done */ return retval; @@ -2406,15 +2398,14 @@ void php_module_shutdown_for_exec(void) */ int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals) { - TSRMLS_FETCH(); - php_module_shutdown(TSRMLS_C); + php_module_shutdown(); return SUCCESS; } /* }}} */ /* {{{ php_module_shutdown */ -void php_module_shutdown(TSRMLS_D) +void php_module_shutdown(void) { int module_number=0; /* for UNREGISTER_INI_ENTRIES() */ @@ -2437,12 +2428,12 @@ void php_module_shutdown(TSRMLS_D) php_win32_free_rng_lock(); #endif - sapi_flush(TSRMLS_C); + sapi_flush(); - zend_shutdown(TSRMLS_C); + zend_shutdown(); /* Destroys filter & transport registries too */ - php_shutdown_stream_wrappers(module_number TSRMLS_CC); + php_shutdown_stream_wrappers(module_number); UNREGISTER_INI_ENTRIES(); @@ -2450,10 +2441,10 @@ void php_module_shutdown(TSRMLS_D) php_shutdown_config(); #ifndef ZTS - zend_ini_shutdown(TSRMLS_C); - shutdown_memory_manager(CG(unclean_shutdown), 1 TSRMLS_CC); + zend_ini_shutdown(); + shutdown_memory_manager(CG(unclean_shutdown), 1); #else - zend_ini_global_shutdown(TSRMLS_C); + zend_ini_global_shutdown(); #endif php_output_shutdown(); @@ -2462,8 +2453,8 @@ void php_module_shutdown(TSRMLS_D) module_initialized = 0; #ifndef ZTS - core_globals_dtor(&core_globals TSRMLS_CC); - gc_globals_dtor(TSRMLS_C); + core_globals_dtor(&core_globals); + gc_globals_dtor(); #else ts_free_id(core_globals_id); #endif @@ -2478,7 +2469,7 @@ void php_module_shutdown(TSRMLS_D) /* {{{ php_execute_script */ -PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) +PHPAPI int php_execute_script(zend_file_handle *primary_file) { zend_file_handle *prepend_file_p, *append_file_p; zend_file_handle prepend_file = {0}, append_file = {0}; @@ -2502,7 +2493,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) #ifdef PHP_WIN32 if(primary_file->filename) { - UpdateIniFromRegistry((char*)primary_file->filename TSRMLS_CC); + UpdateIniFromRegistry((char*)primary_file->filename); } #endif @@ -2528,7 +2519,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) ) { int realfile_len; - if (expand_filepath(primary_file->filename, realfile TSRMLS_CC)) { + if (expand_filepath(primary_file->filename, realfile)) { realfile_len = (int)strlen(realfile); zend_hash_str_add_empty_element(&EG(included_files), realfile, realfile_len); primary_file->opened_path = estrndup(realfile, realfile_len); @@ -2556,11 +2547,11 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) } if (PG(max_input_time) != -1) { #ifdef PHP_WIN32 - zend_unset_timeout(TSRMLS_C); + zend_unset_timeout(); #endif zend_set_timeout(INI_INT("max_execution_time"), 0); } - retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS); + retval = (zend_execute_scripts(ZEND_REQUIRE, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS); } zend_end_try(); @@ -2581,7 +2572,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) /* {{{ php_execute_simple_script */ -PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval *ret TSRMLS_DC) +PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval *ret) { char *old_cwd; ALLOCA_FLAG(use_heap) @@ -2594,7 +2585,7 @@ PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval *ret T zend_try { #ifdef PHP_WIN32 if(primary_file->filename) { - UpdateIniFromRegistry((char*)primary_file->filename TSRMLS_CC); + UpdateIniFromRegistry((char*)primary_file->filename); } #endif @@ -2604,7 +2595,7 @@ PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval *ret T php_ignore_value(VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1)); VCWD_CHDIR_FILE(primary_file->filename); } - zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, ret, 1, primary_file); + zend_execute_scripts(ZEND_REQUIRE, ret, 1, primary_file); } zend_end_try(); if (old_cwd[0] != '\0') { @@ -2620,10 +2611,9 @@ PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval *ret T */ PHPAPI void php_handle_aborted_connection(void) { - TSRMLS_FETCH(); PG(connection_status) = PHP_CONNECTION_ABORTED; - php_output_set_status(PHP_OUTPUT_DISABLED TSRMLS_CC); + php_output_set_status(PHP_OUTPUT_DISABLED); if (!PG(ignore_user_abort)) { zend_bailout(); @@ -2633,7 +2623,7 @@ PHPAPI void php_handle_aborted_connection(void) /* {{{ php_handle_auth_data */ -PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC) +PHPAPI int php_handle_auth_data(const char *auth) { int ret = -1; @@ -2675,17 +2665,17 @@ PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC) /* {{{ php_lint_script */ -PHPAPI int php_lint_script(zend_file_handle *file TSRMLS_DC) +PHPAPI int php_lint_script(zend_file_handle *file) { zend_op_array *op_array; int retval = FAILURE; zend_try { - op_array = zend_compile_file(file, ZEND_INCLUDE TSRMLS_CC); - zend_destroy_file_handle(file TSRMLS_CC); + op_array = zend_compile_file(file, ZEND_INCLUDE); + zend_destroy_file_handle(file); if (op_array) { - destroy_op_array(op_array TSRMLS_CC); + destroy_op_array(op_array); efree(op_array); retval = SUCCESS; } @@ -2698,9 +2688,9 @@ PHPAPI int php_lint_script(zend_file_handle *file TSRMLS_DC) #ifdef PHP_WIN32 /* {{{ dummy_indent just so that this symbol gets exported... */ -PHPAPI void dummy_indent(TSRMLS_D) +PHPAPI void dummy_indent(void) { - zend_indent(TSRMLS_C); + zend_indent(); } /* }}} */ #endif diff --git a/main/mergesort.c b/main/mergesort.c index b049e683a9..a482f5b0fe 100644 --- a/main/mergesort.c +++ b/main/mergesort.c @@ -66,8 +66,8 @@ static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94"; #include <winsock2.h> /* Includes definition for u_char */ #endif -static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC); -static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC); +static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void *)); +static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void *)); #define ISIZE sizeof(int) #define PSIZE sizeof(u_char *) @@ -102,7 +102,7 @@ static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const voi /* {{{ php_mergesort * Arguments are as for qsort. */ -PHPAPI int php_mergesort(void *base, size_t nmemb, size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC) +PHPAPI int php_mergesort(void *base, size_t nmemb, size_t size, int (*cmp)(const void *, const void *)) { register size_t i; register int sense; @@ -130,7 +130,7 @@ PHPAPI int php_mergesort(void *base, size_t nmemb, size_t size, int (*cmp)(const return (-1); list1 = base; - setup(list1, list2, nmemb, size, cmp TSRMLS_CC); + setup(list1, list2, nmemb, size, cmp); last = list2 + nmemb * size; i = big = 0; while (*EVAL(list2) != last) { @@ -144,7 +144,7 @@ PHPAPI int php_mergesort(void *base, size_t nmemb, size_t size, int (*cmp)(const p2 = *EVAL(p2); l2 = list1 + (p2 - list2); while (f1 < l1 && f2 < l2) { - if ((*cmp)(f1, f2 TSRMLS_CC) <= 0) { + if ((*cmp)(f1, f2) <= 0) { q = f2; b = f1, t = l1; sense = -1; @@ -154,7 +154,7 @@ PHPAPI int php_mergesort(void *base, size_t nmemb, size_t size, int (*cmp)(const sense = 0; } if (!big) { /* here i = 0 */ - while ((b += size) < t && cmp(q, b TSRMLS_CC) >sense) + while ((b += size) < t && cmp(q, b) >sense) if (++i == 6) { big = 1; goto EXPONENTIAL; @@ -163,12 +163,12 @@ PHPAPI int php_mergesort(void *base, size_t nmemb, size_t size, int (*cmp)(const EXPONENTIAL: for (i = size; ; i <<= 1) if ((p = (b + i)) >= t) { if ((p = t - size) > b && - (*cmp)(q, p TSRMLS_CC) <= sense) + (*cmp)(q, p) <= sense) t = p; else b = p; break; - } else if ((*cmp)(q, p TSRMLS_CC) <= sense) { + } else if ((*cmp)(q, p) <= sense) { t = p; if (i == size) big = 0; @@ -177,7 +177,7 @@ EXPONENTIAL: for (i = size; ; i <<= 1) b = p; while (t > b+size) { i = (((t - b) / size) >> 1) * size; - if ((*cmp)(q, p = b + i TSRMLS_CC) <= sense) + if ((*cmp)(q, p = b + i) <= sense) t = p; else b = p; @@ -185,7 +185,7 @@ EXPONENTIAL: for (i = size; ; i <<= 1) goto COPY; FASTCASE: while (i > size) if ((*cmp)(q, - p = b + (i >>= 1) TSRMLS_CC) <= sense) + p = b + (i >>= 1)) <= sense) t = p; else b = p; @@ -262,14 +262,14 @@ COPY: b = t; * when THRESHOLD/2 pairs compare with same sense. (Only used when NATURAL * is defined. Otherwise simple pairwise merging is used.) */ -static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC) +static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void *)) { size_t i, length, size2, sense; u_char *f1, *f2, *s, *l2, *last, *p2, tmp; size2 = size*2; if (n <= 5) { - insertionsort(list1, n, size, cmp TSRMLS_CC); + insertionsort(list1, n, size, cmp); *EVAL(list2) = (u_char*) list2 + n*size; return; } @@ -278,19 +278,19 @@ static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp * for simplicity. */ i = 4 + (n & 1); - insertionsort(list1 + (n - i) * size, i, size, cmp TSRMLS_CC); + insertionsort(list1 + (n - i) * size, i, size, cmp); last = list1 + size * (n - i); *EVAL(list2 + (last - list1)) = list2 + n * size; #ifdef NATURAL p2 = list2; f1 = list1; - sense = (cmp(f1, f1 + size TSRMLS_CC) > 0); + sense = (cmp(f1, f1 + size) > 0); for (; f1 < last; sense = !sense) { length = 2; /* Find pairs with same sense. */ for (f2 = f1 + size2; f2 < last; f2 += size2) { - if ((cmp(f2, f2+ size TSRMLS_CC) > 0) != sense) + if ((cmp(f2, f2+ size) > 0) != sense) break; length += 2; } @@ -303,7 +303,7 @@ static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp } else { /* Natural merge */ l2 = f2; for (f2 = f1 + size2; f2 < l2; f2 += size2) { - if ((cmp(f2-size, f2 TSRMLS_CC) > 0) != sense) { + if ((cmp(f2-size, f2) > 0) != sense) { p2 = *EVAL(p2) = f2 - list1 + list2; if (sense > 0) reverse(f1, f2-size); @@ -313,7 +313,7 @@ static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp if (sense > 0) reverse (f1, f2-size); f1 = f2; - if (f2 < last || cmp(f2 - size, f2 TSRMLS_CC) > 0) + if (f2 < last || cmp(f2 - size, f2) > 0) p2 = *EVAL(p2) = f2 - list1 + list2; else p2 = *EVAL(p2) = list2 + n*size; @@ -322,7 +322,7 @@ static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp #else /* pairwise merge only. */ for (f1 = list1, p2 = list2; f1 < last; f1 += size2) { p2 = *EVAL(p2) = p2 + size2; - if (cmp (f1, f1 + size TSRMLS_CC) > 0) + if (cmp (f1, f1 + size) > 0) swap(f1, f1 + size); } #endif /* NATURAL */ @@ -333,7 +333,7 @@ static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp * This is to avoid out-of-bounds addresses in sorting the * last 4 elements. */ -static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC) +static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void *)) { u_char *ai, *s, *t, *u, tmp; size_t i; @@ -341,7 +341,7 @@ static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const voi for (ai = a+size; --n >= 1; ai += size) for (t = ai; t > a; t -= size) { u = t - size; - if (cmp(u, t TSRMLS_CC) <= 0) + if (cmp(u, t) <= 0) break; swap(u, t); } diff --git a/main/network.c b/main/network.c index f44cad29a5..ac80f53f93 100644 --- a/main/network.c +++ b/main/network.c @@ -166,7 +166,7 @@ PHPAPI void php_network_freeaddresses(struct sockaddr **sal) /* {{{ php_network_getaddresses * Returns number of addresses, 0 for none/error */ -PHPAPI int php_network_getaddresses(const char *host, int socktype, struct sockaddr ***sal, zend_string **error_string TSRMLS_DC) +PHPAPI int php_network_getaddresses(const char *host, int socktype, struct sockaddr ***sal, zend_string **error_string) { struct sockaddr **sap; int n; @@ -213,17 +213,17 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka if ((n = getaddrinfo(host, NULL, &hints, &res))) { if (error_string) { *error_string = strpprintf(0, "php_network_getaddresses: getaddrinfo failed: %s", PHP_GAI_STRERROR(n)); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", (*error_string)->val); + php_error_docref(NULL, E_WARNING, "%s", (*error_string)->val); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_network_getaddresses: getaddrinfo failed: %s", PHP_GAI_STRERROR(n)); + php_error_docref(NULL, E_WARNING, "php_network_getaddresses: getaddrinfo failed: %s", PHP_GAI_STRERROR(n)); } return 0; } else if (res == NULL) { if (error_string) { *error_string = strpprintf(0, "php_network_getaddresses: getaddrinfo failed (null result pointer) errno=%d", errno); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", (*error_string)->val); + php_error_docref(NULL, E_WARNING, "%s", (*error_string)->val); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_network_getaddresses: getaddrinfo failed (null result pointer)"); + php_error_docref(NULL, E_WARNING, "php_network_getaddresses: getaddrinfo failed (null result pointer)"); } return 0; } @@ -250,9 +250,9 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka if (host_info == NULL) { if (error_string) { error_string = strpprintf(0, "php_network_getaddresses: gethostbyname failed. errno=%d", errno); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", (*error_string)->val); + php_error_docref(NULL, E_WARNING, "%s", (*error_string)->val); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_network_getaddresses: gethostbyname failed"); + php_error_docref(NULL, E_WARNING, "php_network_getaddresses: gethostbyname failed"); } return 0; } @@ -388,7 +388,7 @@ ok: return ret; #else if (asynchronous) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Asynchronous connect() not supported on this platform"); + php_error_docref(NULL, E_WARNING, "Asynchronous connect() not supported on this platform"); } return (connect(sockfd, addr, addrlen) == 0) ? 0 : -1; #endif @@ -417,7 +417,7 @@ static inline void sub_times(struct timeval a, struct timeval b, struct timeval /* {{{ php_network_bind_socket_to_local_addr */ php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsigned port, int socktype, long sockopts, zend_string **error_string, int *error_code - TSRMLS_DC) + ) { int num_addrs, n, err = 0; php_socket_t sock; @@ -425,7 +425,7 @@ php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsigned po socklen_t socklen; int sockoptval = 1; - num_addrs = php_network_getaddresses(host, socktype, &psal, error_string TSRMLS_CC); + num_addrs = php_network_getaddresses(host, socktype, &psal, error_string); if (num_addrs == 0) { /* could not resolve address(es) */ @@ -507,7 +507,7 @@ bound: } /* }}} */ -PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC) +PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_long addrlen, struct sockaddr *sa, socklen_t *sl) { char *colon; char *tmp; @@ -558,11 +558,11 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_lo } /* looks like we'll need to resolve it */ - n = php_network_getaddresses(tmp, SOCK_DGRAM, &psal, &errstr TSRMLS_CC); + n = php_network_getaddresses(tmp, SOCK_DGRAM, &psal, &errstr); if (n == 0) { if (errstr) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to resolve `%s': %s", tmp, errstr->val); + php_error_docref(NULL, E_WARNING, "Failed to resolve `%s': %s", tmp, errstr->val); zend_string_release(errstr); } goto out; @@ -602,7 +602,7 @@ PHPAPI void php_network_populate_name_from_sockaddr( /* output address */ struct sockaddr **addr, socklen_t *addrlen - TSRMLS_DC) + ) { if (addr) { *addr = emalloc(sl); @@ -663,7 +663,7 @@ PHPAPI int php_network_get_peer_name(php_socket_t sock, zend_string **textaddr, struct sockaddr **addr, socklen_t *addrlen - TSRMLS_DC) + ) { php_sockaddr_storage sa; socklen_t sl = sizeof(sa); @@ -673,7 +673,7 @@ PHPAPI int php_network_get_peer_name(php_socket_t sock, php_network_populate_name_from_sockaddr((struct sockaddr*)&sa, sl, textaddr, addr, addrlen - TSRMLS_CC); + ); return 0; } return -1; @@ -683,7 +683,7 @@ PHPAPI int php_network_get_sock_name(php_socket_t sock, zend_string **textaddr, struct sockaddr **addr, socklen_t *addrlen - TSRMLS_DC) + ) { php_sockaddr_storage sa; socklen_t sl = sizeof(sa); @@ -693,7 +693,7 @@ PHPAPI int php_network_get_sock_name(php_socket_t sock, php_network_populate_name_from_sockaddr((struct sockaddr*)&sa, sl, textaddr, addr, addrlen - TSRMLS_CC); + ); return 0; } return -1; @@ -717,7 +717,7 @@ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, struct timeval *timeout, zend_string **error_string, int *error_code - TSRMLS_DC) + ) { php_socket_t clisock = -1; int error = 0, n; @@ -739,7 +739,7 @@ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, php_network_populate_name_from_sockaddr((struct sockaddr*)&sa, sl, textaddr, addr, addrlen - TSRMLS_CC); + ); } else { error = php_socket_errno(); } @@ -768,7 +768,7 @@ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short port, int socktype, int asynchronous, struct timeval *timeout, zend_string **error_string, int *error_code, char *bindto, unsigned short bindport, long sockopts - TSRMLS_DC) + ) { int num_addrs, n, fatal = 0; php_socket_t sock; @@ -779,7 +779,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short struct timeval limit_time, time_now; #endif - num_addrs = php_network_getaddresses(host, socktype, &psal, error_string TSRMLS_CC); + num_addrs = php_network_getaddresses(host, socktype, &psal, error_string); if (num_addrs == 0) { /* could not resolve address(es) */ @@ -849,7 +849,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short in4->sin_family = sa->sa_family; in4->sin_port = htons(bindport); if (!inet_aton(bindto, &in4->sin_addr)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid IP Address: %s", bindto); + php_error_docref(NULL, E_WARNING, "Invalid IP Address: %s", bindto); goto skip_bind; } memset(&(in4->sin_zero), 0, sizeof(in4->sin_zero)); @@ -864,14 +864,14 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short in6->sin6_family = sa->sa_family; in6->sin6_port = htons(bindport); if (inet_pton(AF_INET6, bindto, &in6->sin6_addr) < 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid IP Address: %s", bindto); + php_error_docref(NULL, E_WARNING, "Invalid IP Address: %s", bindto); goto skip_bind; } } #endif if (!local_address || bind(sock, local_address, local_address_len)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to bind to '%s:%d', system said: %s", bindto, bindport, strerror(errno)); + php_error_docref(NULL, E_WARNING, "failed to bind to '%s:%d', system said: %s", bindto, bindport, strerror(errno)); } skip_bind: if (local_address) { @@ -1082,7 +1082,7 @@ PHPAPI zend_string *php_socket_error_str(long err) /* }}} */ /* deprecated */ -PHPAPI php_stream *_php_stream_sock_open_from_socket(php_socket_t socket, const char *persistent_id STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_sock_open_from_socket(php_socket_t socket, const char *persistent_id STREAMS_DC) { php_stream *stream; php_netstream_data_t *sock; @@ -1107,7 +1107,7 @@ PHPAPI php_stream *_php_stream_sock_open_from_socket(php_socket_t socket, const } PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short port, - int socktype, struct timeval *timeout, const char *persistent_id STREAMS_DC TSRMLS_DC) + int socktype, struct timeval *timeout, const char *persistent_id STREAMS_DC) { char *res; zend_long reslen; @@ -1123,7 +1123,7 @@ PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short p return stream; } -PHPAPI int php_set_sock_blocking(php_socket_t socketd, int block TSRMLS_DC) +PHPAPI int php_set_sock_blocking(php_socket_t socketd, int block) { int ret = SUCCESS; @@ -1158,10 +1158,9 @@ PHPAPI int php_set_sock_blocking(php_socket_t socketd, int block TSRMLS_DC) PHPAPI void _php_emit_fd_setsize_warning(int max_fd) { - TSRMLS_FETCH(); #ifdef PHP_WIN32 - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "PHP needs to be recompiled with a larger value of FD_SETSIZE.\n" "If this binary is from an official www.php.net package, file a bug report\n" "at http://bugs.php.net, including the following information:\n" @@ -1171,7 +1170,7 @@ PHPAPI void _php_emit_fd_setsize_warning(int max_fd) "one time, in order to avoid seeing this error again at a later date.", FD_SETSIZE, max_fd, (max_fd + 128) & ~127); #else - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "You MUST recompile PHP with a larger value of FD_SETSIZE.\n" "It is set to %d, but you have descriptors numbered at least as high as %d.\n" " --enable-fd-setsize=%d is recommended, but you may want to set it\n" diff --git a/main/output.c b/main/output.c index c8b41ba1eb..c287933fb1 100644 --- a/main/output.c +++ b/main/output.c @@ -52,20 +52,20 @@ static HashTable php_output_handler_reverse_conflicts; /* }}} */ /* {{{ forward declarations */ -static inline int php_output_lock_error(int op TSRMLS_DC); -static inline void php_output_op(int op, const char *str, size_t len TSRMLS_DC); +static inline int php_output_lock_error(int op); +static inline void php_output_op(int op, const char *str, size_t len); -static inline php_output_handler *php_output_handler_init(zend_string *name, size_t chunk_size, int flags TSRMLS_DC); +static inline php_output_handler *php_output_handler_init(zend_string *name, size_t chunk_size, int flags); static inline php_output_handler_status_t php_output_handler_op(php_output_handler *handler, php_output_context *context); -static inline int php_output_handler_append(php_output_handler *handler, const php_output_buffer *buf TSRMLS_DC); +static inline int php_output_handler_append(php_output_handler *handler, const php_output_buffer *buf); static inline zval *php_output_handler_status(php_output_handler *handler, zval *entry); -static inline php_output_context *php_output_context_init(php_output_context *context, int op TSRMLS_DC); +static inline php_output_context *php_output_context_init(php_output_context *context, int op); static inline void php_output_context_reset(php_output_context *context); static inline void php_output_context_swap(php_output_context *context); static inline void php_output_context_dtor(php_output_context *context); -static inline int php_output_stack_pop(int flags TSRMLS_DC); +static inline int php_output_stack_pop(int flags); static int php_output_stack_apply_op(void *h, void *c); static int php_output_stack_apply_clean(void *h, void *c); @@ -81,6 +81,7 @@ static int php_output_handler_devnull_func(void **handler_context, php_output_co * Initialize the module globals on MINIT */ static inline void php_output_init_globals(zend_output_globals *G) { + ZEND_TSRMLS_CACHE_UPDATE; memset(G, 0, sizeof(*G)); } /* }}} */ @@ -103,23 +104,23 @@ static size_t php_output_stderr(const char *str, size_t str_len) static size_t (*php_output_direct)(const char *str, size_t str_len) = php_output_stderr; /* }}} */ -/* {{{ void php_output_header(TSRMLS_D) */ -static void php_output_header(TSRMLS_D) +/* {{{ void php_output_header(void) */ +static void php_output_header(void) { if (!SG(headers_sent)) { if (!OG(output_start_filename)) { - if (zend_is_compiling(TSRMLS_C)) { - OG(output_start_filename) = zend_get_compiled_filename(TSRMLS_C)->val; - OG(output_start_lineno) = zend_get_compiled_lineno(TSRMLS_C); - } else if (zend_is_executing(TSRMLS_C)) { - OG(output_start_filename) = zend_get_executed_filename(TSRMLS_C); - OG(output_start_lineno) = zend_get_executed_lineno(TSRMLS_C); + if (zend_is_compiling()) { + OG(output_start_filename) = zend_get_compiled_filename()->val; + OG(output_start_lineno) = zend_get_compiled_lineno(); + } else if (zend_is_executing()) { + OG(output_start_filename) = zend_get_executed_filename(); + OG(output_start_lineno) = zend_get_executed_lineno(); } #if PHP_OUTPUT_DEBUG fprintf(stderr, "!!! output started at: %s (%d)\n", OG(output_start_filename), OG(output_start_lineno)); #endif } - if (!php_header(TSRMLS_C)) { + if (!php_header()) { OG(flags) |= PHP_OUTPUT_DISABLED; } } @@ -155,12 +156,12 @@ PHPAPI void php_output_shutdown(void) } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_activate(TSRMLS_D) +/* {{{ SUCCESS|FAILURE php_output_activate(void) * Reset output globals and setup the output handler stack */ -PHPAPI int php_output_activate(TSRMLS_D) +PHPAPI int php_output_activate(void) { #ifdef ZTS - memset((*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(output_globals_id)], 0, sizeof(zend_output_globals)); + memset((*((void ***) ZEND_TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(output_globals_id)], 0, sizeof(zend_output_globals)); #else memset(&output_globals, 0, sizeof(zend_output_globals)); #endif @@ -172,13 +173,13 @@ PHPAPI int php_output_activate(TSRMLS_D) } /* }}} */ -/* {{{ void php_output_deactivate(TSRMLS_D) +/* {{{ void php_output_deactivate(void) * Destroy the output handler stack */ -PHPAPI void php_output_deactivate(TSRMLS_D) +PHPAPI void php_output_deactivate(void) { php_output_handler **handler = NULL; - php_output_header(TSRMLS_C); + php_output_header(); OG(flags) ^= PHP_OUTPUT_ACTIVATED; OG(active) = NULL; @@ -187,7 +188,7 @@ PHPAPI void php_output_deactivate(TSRMLS_D) /* release all output handlers */ if (OG(handlers).elements) { while ((handler = zend_stack_top(&OG(handlers)))) { - php_output_handler_free(handler TSRMLS_CC); + php_output_handler_free(handler); zend_stack_del_top(&OG(handlers)); } zend_stack_destroy(&OG(handlers)); @@ -197,7 +198,7 @@ PHPAPI void php_output_deactivate(TSRMLS_D) /* }}} */ /* {{{ void php_output_register_constants() */ -PHPAPI void php_output_register_constants(TSRMLS_D) +PHPAPI void php_output_register_constants(void) { REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_START", PHP_OUTPUT_HANDLER_START, CONST_CS | CONST_PERSISTENT); REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_WRITE", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT); @@ -216,17 +217,17 @@ PHPAPI void php_output_register_constants(TSRMLS_D) } /* }}} */ -/* {{{ void php_output_set_status(int status TSRMLS_DC) +/* {{{ void php_output_set_status(int status) * Used by SAPIs to disable output */ -PHPAPI void php_output_set_status(int status TSRMLS_DC) +PHPAPI void php_output_set_status(int status) { OG(flags) = (OG(flags) & ~0xf) | (status & 0xf); } /* }}} */ -/* {{{ int php_output_get_status(TSRMLS_C) +/* {{{ int php_output_get_status() * Get output control status */ -PHPAPI int php_output_get_status(TSRMLS_D) +PHPAPI int php_output_get_status(void) { return ( OG(flags) @@ -236,47 +237,47 @@ PHPAPI int php_output_get_status(TSRMLS_D) } /* }}} */ -/* {{{ int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC) +/* {{{ int php_output_write_unbuffered(const char *str, size_t len) * Unbuffered write */ -PHPAPI size_t php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC) +PHPAPI size_t php_output_write_unbuffered(const char *str, size_t len) { if (OG(flags) & PHP_OUTPUT_DISABLED) { return 0; } if (OG(flags) & PHP_OUTPUT_ACTIVATED) { - return sapi_module.ub_write(str, len TSRMLS_CC); + return sapi_module.ub_write(str, len); } return php_output_direct(str, len); } /* }}} */ -/* {{{ int php_output_write(const char *str, size_t len TSRMLS_DC) +/* {{{ int php_output_write(const char *str, size_t len) * Buffered write */ -PHPAPI size_t php_output_write(const char *str, size_t len TSRMLS_DC) +PHPAPI size_t php_output_write(const char *str, size_t len) { if (OG(flags) & PHP_OUTPUT_DISABLED) { return 0; } if (OG(flags) & PHP_OUTPUT_ACTIVATED) { - php_output_op(PHP_OUTPUT_HANDLER_WRITE, str, len TSRMLS_CC); + php_output_op(PHP_OUTPUT_HANDLER_WRITE, str, len); return len; } return php_output_direct(str, len); } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_flush(TSRMLS_D) +/* {{{ SUCCESS|FAILURE php_output_flush(void) * Flush the most recent output handlers buffer */ -PHPAPI int php_output_flush(TSRMLS_D) +PHPAPI int php_output_flush(void) { php_output_context context; if (OG(active) && (OG(active)->flags & PHP_OUTPUT_HANDLER_FLUSHABLE)) { - php_output_context_init(&context, PHP_OUTPUT_HANDLER_FLUSH TSRMLS_CC); + php_output_context_init(&context, PHP_OUTPUT_HANDLER_FLUSH); php_output_handler_op(OG(active), &context); if (context.out.data && context.out.used) { zend_stack_del_top(&OG(handlers)); - php_output_write(context.out.data, context.out.used TSRMLS_CC); + php_output_write(context.out.data, context.out.used); zend_stack_push(&OG(handlers), &OG(active)); } php_output_context_dtor(&context); @@ -286,24 +287,24 @@ PHPAPI int php_output_flush(TSRMLS_D) } /* }}} */ -/* {{{ void php_output_flush_all(TSRMLS_C) +/* {{{ void php_output_flush_all() * Flush all output buffers subsequently */ -PHPAPI void php_output_flush_all(TSRMLS_D) +PHPAPI void php_output_flush_all(void) { if (OG(active)) { - php_output_op(PHP_OUTPUT_HANDLER_FLUSH, NULL, 0 TSRMLS_CC); + php_output_op(PHP_OUTPUT_HANDLER_FLUSH, NULL, 0); } } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_clean(TSRMLS_D) +/* {{{ SUCCESS|FAILURE php_output_clean(void) * Cleans the most recent output handlers buffer if the handler is cleanable */ -PHPAPI int php_output_clean(TSRMLS_D) +PHPAPI int php_output_clean(void) { php_output_context context; if (OG(active) && (OG(active)->flags & PHP_OUTPUT_HANDLER_CLEANABLE)) { - php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN TSRMLS_CC); + php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN); php_output_handler_op(OG(active), &context); php_output_context_dtor(&context); return SUCCESS; @@ -312,69 +313,69 @@ PHPAPI int php_output_clean(TSRMLS_D) } /* }}} */ -/* {{{ void php_output_clean_all(TSRMLS_D) +/* {{{ void php_output_clean_all(void) * Cleans all output handler buffers, without regard whether the handler is cleanable */ -PHPAPI void php_output_clean_all(TSRMLS_D) +PHPAPI void php_output_clean_all(void) { php_output_context context; if (OG(active)) { - php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN TSRMLS_CC); + php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN); zend_stack_apply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_clean, &context); } } -/* {{{ SUCCESS|FAILURE php_output_end(TSRMLS_D) +/* {{{ SUCCESS|FAILURE php_output_end(void) * Finalizes the most recent output handler at pops it off the stack if the handler is removable */ -PHPAPI int php_output_end(TSRMLS_D) +PHPAPI int php_output_end(void) { - if (php_output_stack_pop(PHP_OUTPUT_POP_TRY TSRMLS_CC)) { + if (php_output_stack_pop(PHP_OUTPUT_POP_TRY)) { return SUCCESS; } return FAILURE; } /* }}} */ -/* {{{ void php_output_end_all(TSRMLS_D) +/* {{{ void php_output_end_all(void) * Finalizes all output handlers and ends output buffering without regard whether a handler is removable */ -PHPAPI void php_output_end_all(TSRMLS_D) +PHPAPI void php_output_end_all(void) { - while (OG(active) && php_output_stack_pop(PHP_OUTPUT_POP_FORCE TSRMLS_CC)); + while (OG(active) && php_output_stack_pop(PHP_OUTPUT_POP_FORCE)); } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_discard(TSRMLS_D) +/* {{{ SUCCESS|FAILURE php_output_discard(void) * Discards the most recent output handlers buffer and pops it off the stack if the handler is removable */ -PHPAPI int php_output_discard(TSRMLS_D) +PHPAPI int php_output_discard(void) { - if (php_output_stack_pop(PHP_OUTPUT_POP_DISCARD|PHP_OUTPUT_POP_TRY TSRMLS_CC)) { + if (php_output_stack_pop(PHP_OUTPUT_POP_DISCARD|PHP_OUTPUT_POP_TRY)) { return SUCCESS; } return FAILURE; } /* }}} */ -/* {{{ void php_output_discard_all(TSRMLS_D) +/* {{{ void php_output_discard_all(void) * Discard all output handlers and buffers without regard whether a handler is removable */ -PHPAPI void php_output_discard_all(TSRMLS_D) +PHPAPI void php_output_discard_all(void) { while (OG(active)) { - php_output_stack_pop(PHP_OUTPUT_POP_DISCARD|PHP_OUTPUT_POP_FORCE TSRMLS_CC); + php_output_stack_pop(PHP_OUTPUT_POP_DISCARD|PHP_OUTPUT_POP_FORCE); } } /* }}} */ -/* {{{ int php_output_get_level(TSRMLS_D) +/* {{{ int php_output_get_level(void) * Get output buffering level, ie. how many output handlers the stack contains */ -PHPAPI int php_output_get_level(TSRMLS_D) +PHPAPI int php_output_get_level(void) { return OG(active) ? zend_stack_count(&OG(handlers)) : 0; } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_get_contents(zval *z TSRMLS_DC) +/* {{{ SUCCESS|FAILURE php_output_get_contents(zval *z) * Get the contents of the active output handlers buffer */ -PHPAPI int php_output_get_contents(zval *p TSRMLS_DC) +PHPAPI int php_output_get_contents(zval *p) { if (OG(active)) { ZVAL_STRINGL(p, OG(active)->buffer.data, OG(active)->buffer.used); @@ -385,9 +386,9 @@ PHPAPI int php_output_get_contents(zval *p TSRMLS_DC) } } -/* {{{ SUCCESS|FAILURE php_output_get_length(zval *z TSRMLS_DC) +/* {{{ SUCCESS|FAILURE php_output_get_length(zval *z) * Get the length of the active output handlers buffer */ -PHPAPI int php_output_get_length(zval *p TSRMLS_DC) +PHPAPI int php_output_get_length(zval *p) { if (OG(active)) { ZVAL_LONG(p, OG(active)->buffer.used); @@ -399,82 +400,82 @@ PHPAPI int php_output_get_length(zval *p TSRMLS_DC) } /* }}} */ -/* {{{ php_output_handler* php_output_get_active_handler(TSRMLS_D) +/* {{{ php_output_handler* php_output_get_active_handler(void) * Get active output handler */ -PHPAPI php_output_handler* php_output_get_active_handler(TSRMLS_D) +PHPAPI php_output_handler* php_output_get_active_handler(void) { return OG(active); } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_handler_start_default(TSRMLS_D) +/* {{{ SUCCESS|FAILURE php_output_handler_start_default(void) * Start a "default output handler" */ -PHPAPI int php_output_start_default(TSRMLS_D) +PHPAPI int php_output_start_default(void) { php_output_handler *handler; - handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_output_handler_default_func, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC); - if (SUCCESS == php_output_handler_start(handler TSRMLS_CC)) { + handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_output_handler_default_func, 0, PHP_OUTPUT_HANDLER_STDFLAGS); + if (SUCCESS == php_output_handler_start(handler)) { return SUCCESS; } - php_output_handler_free(&handler TSRMLS_CC); + php_output_handler_free(&handler); return FAILURE; } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_handler_start_devnull(TSRMLS_D) +/* {{{ SUCCESS|FAILURE php_output_handler_start_devnull(void) * Start a "null output handler" */ -PHPAPI int php_output_start_devnull(TSRMLS_D) +PHPAPI int php_output_start_devnull(void) { php_output_handler *handler; - handler = php_output_handler_create_internal(ZEND_STRL(php_output_devnull_handler_name), php_output_handler_devnull_func, PHP_OUTPUT_HANDLER_DEFAULT_SIZE, 0 TSRMLS_CC); - if (SUCCESS == php_output_handler_start(handler TSRMLS_CC)) { + handler = php_output_handler_create_internal(ZEND_STRL(php_output_devnull_handler_name), php_output_handler_devnull_func, PHP_OUTPUT_HANDLER_DEFAULT_SIZE, 0); + if (SUCCESS == php_output_handler_start(handler)) { return SUCCESS; } - php_output_handler_free(&handler TSRMLS_CC); + php_output_handler_free(&handler); return FAILURE; } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_start_user(zval *handler, size_t chunk_size, int flags TSRMLS_DC) +/* {{{ SUCCESS|FAILURE php_output_start_user(zval *handler, size_t chunk_size, int flags) * Start a user level output handler */ -PHPAPI int php_output_start_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC) +PHPAPI int php_output_start_user(zval *output_handler, size_t chunk_size, int flags) { php_output_handler *handler; if (output_handler) { - handler = php_output_handler_create_user(output_handler, chunk_size, flags TSRMLS_CC); + handler = php_output_handler_create_user(output_handler, chunk_size, flags); } else { - handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_output_handler_default_func, chunk_size, flags TSRMLS_CC); + handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_output_handler_default_func, chunk_size, flags); } - if (SUCCESS == php_output_handler_start(handler TSRMLS_CC)) { + if (SUCCESS == php_output_handler_start(handler)) { return SUCCESS; } - php_output_handler_free(&handler TSRMLS_CC); + php_output_handler_free(&handler); return FAILURE; } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_start_internal(zval *name, php_output_handler_func_t handler, size_t chunk_size, int flags TSRMLS_DC) +/* {{{ SUCCESS|FAILURE php_output_start_internal(zval *name, php_output_handler_func_t handler, size_t chunk_size, int flags) * Start an internal output handler that does not have to maintain a non-global state */ -PHPAPI int php_output_start_internal(const char *name, size_t name_len, php_output_handler_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC) +PHPAPI int php_output_start_internal(const char *name, size_t name_len, php_output_handler_func_t output_handler, size_t chunk_size, int flags) { php_output_handler *handler; - handler = php_output_handler_create_internal(name, name_len, php_output_handler_compat_func, chunk_size, flags TSRMLS_CC); - php_output_handler_set_context(handler, output_handler, NULL TSRMLS_CC); - if (SUCCESS == php_output_handler_start(handler TSRMLS_CC)) { + handler = php_output_handler_create_internal(name, name_len, php_output_handler_compat_func, chunk_size, flags); + php_output_handler_set_context(handler, output_handler, NULL); + if (SUCCESS == php_output_handler_start(handler)) { return SUCCESS; } - php_output_handler_free(&handler TSRMLS_CC); + php_output_handler_free(&handler); return FAILURE; } /* }}} */ -/* {{{ php_output_handler *php_output_handler_create_user(zval *handler, size_t chunk_size, int flags TSRMLS_DC) +/* {{{ php_output_handler *php_output_handler_create_user(zval *handler, size_t chunk_size, int flags) * Create a user level output handler */ -PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC) +PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, size_t chunk_size, int flags) { zend_string *handler_name = NULL; char *error = NULL; @@ -484,24 +485,24 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, switch (Z_TYPE_P(output_handler)) { case IS_NULL: - handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_output_handler_default_func, chunk_size, flags TSRMLS_CC); + handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_output_handler_default_func, chunk_size, flags); break; case IS_STRING: - if (Z_STRLEN_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler) TSRMLS_CC))) { - handler = alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler), chunk_size, flags TSRMLS_CC); + if (Z_STRLEN_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler)))) { + handler = alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler), chunk_size, flags); break; } default: user = ecalloc(1, sizeof(php_output_handler_user_func_t)); - if (SUCCESS == zend_fcall_info_init(output_handler, 0, &user->fci, &user->fcc, &handler_name, &error TSRMLS_CC)) { - handler = php_output_handler_init(handler_name, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_USER TSRMLS_CC); + if (SUCCESS == zend_fcall_info_init(output_handler, 0, &user->fci, &user->fcc, &handler_name, &error)) { + handler = php_output_handler_init(handler_name, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_USER); ZVAL_COPY(&user->zoh, output_handler); handler->func.user = user; } else { efree(user); } if (error) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "%s", error); + php_error_docref("ref.outcontrol", E_WARNING, "%s", error); efree(error); } if (handler_name) { @@ -513,14 +514,14 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, } /* }}} */ -/* {{{ php_output_handler *php_output_handler_create_internal(zval *name, php_output_handler_context_func_t handler, size_t chunk_size, int flags TSRMLS_DC) +/* {{{ php_output_handler *php_output_handler_create_internal(zval *name, php_output_handler_context_func_t handler, size_t chunk_size, int flags) * Create an internal output handler that can maintain a non-global state */ -PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, size_t name_len, php_output_handler_context_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC) +PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, size_t name_len, php_output_handler_context_func_t output_handler, size_t chunk_size, int flags) { php_output_handler *handler; zend_string *str = zend_string_init(name, name_len, 1); - handler = php_output_handler_init(str, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_INTERNAL TSRMLS_CC); + handler = php_output_handler_init(str, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_INTERNAL); handler->func.internal = output_handler; zend_string_release(str); @@ -528,31 +529,31 @@ PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, } /* }}} */ -/* {{{ void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void* TSRMLS_DC) TSRMLS_DC) +/* {{{ void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void*)) * Set the context/state of an output handler. Calls the dtor of the previous context if there is one */ -PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void* TSRMLS_DC) TSRMLS_DC) +PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void*)) { if (handler->dtor && handler->opaq) { - handler->dtor(handler->opaq TSRMLS_CC); + handler->dtor(handler->opaq); } handler->dtor = dtor; handler->opaq = opaq; } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_handler_start(php_output_handler *handler TSRMLS_DC) +/* {{{ SUCCESS|FAILURE php_output_handler_start(php_output_handler *handler) * Starts the set up output handler and pushes it on top of the stack. Checks for any conflicts regarding the output handler to start */ -PHPAPI int php_output_handler_start(php_output_handler *handler TSRMLS_DC) +PHPAPI int php_output_handler_start(php_output_handler *handler) { HashPosition pos; HashTable *rconflicts; php_output_handler_conflict_check_t conflict; - if (php_output_lock_error(PHP_OUTPUT_HANDLER_START TSRMLS_CC) || !handler) { + if (php_output_lock_error(PHP_OUTPUT_HANDLER_START) || !handler) { return FAILURE; } if (NULL != (conflict = zend_hash_find_ptr(&php_output_handler_conflicts, handler->name))) { - if (SUCCESS != conflict(handler->name->val, handler->name->len TSRMLS_CC)) { + if (SUCCESS != conflict(handler->name->val, handler->name->len)) { return FAILURE; } } @@ -561,7 +562,7 @@ PHPAPI int php_output_handler_start(php_output_handler *handler TSRMLS_DC) (conflict = zend_hash_get_current_data_ptr_ex(rconflicts, &pos)) != NULL; zend_hash_move_forward_ex(rconflicts, &pos) ) { - if (SUCCESS != conflict(handler->name->val, handler->name->len TSRMLS_CC)) { + if (SUCCESS != conflict(handler->name->val, handler->name->len)) { return FAILURE; } } @@ -573,12 +574,12 @@ PHPAPI int php_output_handler_start(php_output_handler *handler TSRMLS_DC) } /* }}} */ -/* {{{ int php_output_handler_started(zval *name TSRMLS_DC) +/* {{{ int php_output_handler_started(zval *name) * Check whether a certain output handler is in use */ -PHPAPI int php_output_handler_started(const char *name, size_t name_len TSRMLS_DC) +PHPAPI int php_output_handler_started(const char *name, size_t name_len) { php_output_handler **handlers; - int i, count = php_output_get_level(TSRMLS_C); + int i, count = php_output_get_level(); if (count) { handlers = (php_output_handler **) zend_stack_base(&OG(handlers)); @@ -594,15 +595,15 @@ PHPAPI int php_output_handler_started(const char *name, size_t name_len TSRMLS_D } /* }}} */ -/* {{{ int php_output_handler_conflict(zval *handler_new, zval *handler_old TSRMLS_DC) +/* {{{ int php_output_handler_conflict(zval *handler_new, zval *handler_old) * Check whether a certain handler is in use and issue a warning that the new handler would conflict with the already used one */ -PHPAPI int php_output_handler_conflict(const char *handler_new, size_t handler_new_len, const char *handler_set, size_t handler_set_len TSRMLS_DC) +PHPAPI int php_output_handler_conflict(const char *handler_new, size_t handler_new_len, const char *handler_set, size_t handler_set_len) { - if (php_output_handler_started(handler_set, handler_set_len TSRMLS_CC)) { + if (php_output_handler_started(handler_set, handler_set_len)) { if (handler_new_len != handler_set_len || memcmp(handler_new, handler_set, handler_set_len)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler '%s' conflicts with '%s'", handler_new, handler_set); + php_error_docref("ref.outcontrol", E_WARNING, "output handler '%s' conflicts with '%s'", handler_new, handler_set); } else { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler '%s' cannot be used twice", handler_new); + php_error_docref("ref.outcontrol", E_WARNING, "output handler '%s' cannot be used twice", handler_new); } return 1; } @@ -610,9 +611,9 @@ PHPAPI int php_output_handler_conflict(const char *handler_new, size_t handler_n } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_handler_conflict_register(zval *name, php_output_handler_conflict_check_t check_func TSRMLS_DC) +/* {{{ SUCCESS|FAILURE php_output_handler_conflict_register(zval *name, php_output_handler_conflict_check_t check_func) * Register a conflict checking function on MINIT */ -PHPAPI int php_output_handler_conflict_register(const char *name, size_t name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC) +PHPAPI int php_output_handler_conflict_register(const char *name, size_t name_len, php_output_handler_conflict_check_t check_func) { if (!EG(current_module)) { zend_error(E_ERROR, "Cannot register an output handler conflict outside of MINIT"); @@ -622,9 +623,9 @@ PHPAPI int php_output_handler_conflict_register(const char *name, size_t name_le } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_handler_reverse_conflict_register(zval *name, php_output_handler_conflict_check_t check_func TSRMLS_DC) +/* {{{ SUCCESS|FAILURE php_output_handler_reverse_conflict_register(zval *name, php_output_handler_conflict_check_t check_func) * Register a reverse conflict checking function on MINIT */ -PHPAPI int php_output_handler_reverse_conflict_register(const char *name, size_t name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC) +PHPAPI int php_output_handler_reverse_conflict_register(const char *name, size_t name_len, php_output_handler_conflict_check_t check_func) { HashTable rev, *rev_ptr = NULL; @@ -650,17 +651,17 @@ PHPAPI int php_output_handler_reverse_conflict_register(const char *name, size_t } /* }}} */ -/* {{{ php_output_handler_alias_ctor_t php_output_handler_alias(zval *name TSRMLS_DC) +/* {{{ php_output_handler_alias_ctor_t php_output_handler_alias(zval *name) * Get an internal output handler for a user handler if it exists */ -PHPAPI php_output_handler_alias_ctor_t php_output_handler_alias(const char *name, size_t name_len TSRMLS_DC) +PHPAPI php_output_handler_alias_ctor_t php_output_handler_alias(const char *name, size_t name_len) { return zend_hash_str_find_ptr(&php_output_handler_aliases, name, name_len); } /* }}} */ -/* {{{ SUCCESS|FAILURE php_output_handler_alias_register(zval *name, php_output_handler_alias_ctor_t func TSRMLS_DC) +/* {{{ SUCCESS|FAILURE php_output_handler_alias_register(zval *name, php_output_handler_alias_ctor_t func) * Registers an internal output handler as alias for a user handler */ -PHPAPI int php_output_handler_alias_register(const char *name, size_t name_len, php_output_handler_alias_ctor_t func TSRMLS_DC) +PHPAPI int php_output_handler_alias_register(const char *name, size_t name_len, php_output_handler_alias_ctor_t func) { if (!EG(current_module)) { zend_error(E_ERROR, "Cannot register an output handler alias outside of MINIT"); @@ -672,7 +673,7 @@ PHPAPI int php_output_handler_alias_register(const char *name, size_t name_len, /* {{{ SUCCESS|FAILURE php_output_handler_hook(php_output_handler_hook_t type, void *arg TSMRLS_DC) * Output handler hook for output handler functions to check/modify the current handlers abilities */ -PHPAPI int php_output_handler_hook(php_output_handler_hook_t type, void *arg TSRMLS_DC) +PHPAPI int php_output_handler_hook(php_output_handler_hook_t type, void *arg) { if (OG(running)) { switch (type) { @@ -699,9 +700,9 @@ PHPAPI int php_output_handler_hook(php_output_handler_hook_t type, void *arg TSR } /* }}} */ -/* {{{ void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC) +/* {{{ void php_output_handler_dtor(php_output_handler *handler) * Destroy an output handler */ -PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC) +PHPAPI void php_output_handler_dtor(php_output_handler *handler) { if (handler->name) { zend_string_release(handler->name); @@ -714,7 +715,7 @@ PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC) efree(handler->func.user); } if (handler->dtor && handler->opaq) { - handler->dtor(handler->opaq TSRMLS_CC); + handler->dtor(handler->opaq); } memset(handler, 0, sizeof(*handler)); } @@ -722,19 +723,19 @@ PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC) /* {{{ void php_output_handler_free(php_output_handler **handler TSMRLS_DC) * Destroy and free an output handler */ -PHPAPI void php_output_handler_free(php_output_handler **h TSRMLS_DC) +PHPAPI void php_output_handler_free(php_output_handler **h) { if (*h) { - php_output_handler_dtor(*h TSRMLS_CC); + php_output_handler_dtor(*h); efree(*h); *h = NULL; } } /* }}} */ -/* void php_output_set_implicit_flush(int enabled TSRMLS_DC) +/* void php_output_set_implicit_flush(int enabled) * Enable or disable implicit flush */ -PHPAPI void php_output_set_implicit_flush(int flush TSRMLS_DC) +PHPAPI void php_output_set_implicit_flush(int flush) { if (flush) { OG(flags) |= PHP_OUTPUT_IMPLICITFLUSH; @@ -744,47 +745,46 @@ PHPAPI void php_output_set_implicit_flush(int flush TSRMLS_DC) } /* }}} */ -/* {{{ char *php_output_get_start_filename(TSRMLS_D) +/* {{{ char *php_output_get_start_filename(void) * Get the file name where output has started */ -PHPAPI const char *php_output_get_start_filename(TSRMLS_D) +PHPAPI const char *php_output_get_start_filename(void) { return OG(output_start_filename); } /* }}} */ -/* {{{ int php_output_get_start_lineno(TSRMLS_D) +/* {{{ int php_output_get_start_lineno(void) * Get the line number where output has started */ -PHPAPI int php_output_get_start_lineno(TSRMLS_D) +PHPAPI int php_output_get_start_lineno(void) { return OG(output_start_lineno); } /* }}} */ -/* {{{ static int php_output_lock_error(int op TSRMLS_DC) +/* {{{ static int php_output_lock_error(int op) * Checks whether an unallowed operation is attempted from within the output handler and issues a fatal error */ -static inline int php_output_lock_error(int op TSRMLS_DC) +static inline int php_output_lock_error(int op) { /* if there's no ob active, ob has been stopped */ if (op && OG(active) && OG(running)) { /* fatal error */ - php_output_deactivate(TSRMLS_C); - php_error_docref("ref.outcontrol" TSRMLS_CC, E_ERROR, "Cannot use output buffering in output buffering display handlers"); + php_output_deactivate(); + php_error_docref("ref.outcontrol", E_ERROR, "Cannot use output buffering in output buffering display handlers"); return 1; } return 0; } /* }}} */ -/* {{{ static php_output_context *php_output_context_init(php_output_context *context, int op TSRMLS_DC) +/* {{{ static php_output_context *php_output_context_init(php_output_context *context, int op) * Initialize a new output context */ -static inline php_output_context *php_output_context_init(php_output_context *context, int op TSRMLS_DC) +static inline php_output_context *php_output_context_init(php_output_context *context, int op) { if (!context) { context = emalloc(sizeof(php_output_context)); } memset(context, 0, sizeof(php_output_context)); - TSRMLS_SET_CTX(context->tsrm_ls); context->op = op; return context; @@ -864,9 +864,9 @@ static inline void php_output_context_dtor(php_output_context *context) } /* }}} */ -/* {{{ static php_output_handler *php_output_handler_init(zval *name, size_t chunk_size, int flags TSRMLS_DC) +/* {{{ static php_output_handler *php_output_handler_init(zval *name, size_t chunk_size, int flags) * Allocates and initializes a php_output_handler structure */ -static inline php_output_handler *php_output_handler_init(zend_string *name, size_t chunk_size, int flags TSRMLS_DC) +static inline php_output_handler *php_output_handler_init(zend_string *name, size_t chunk_size, int flags) { php_output_handler *handler; @@ -881,9 +881,9 @@ static inline php_output_handler *php_output_handler_init(zend_string *name, siz } /* }}} */ -/* {{{ static int php_output_handler_appen(php_output_handler *handler, const php_output_buffer *buf TSRMLS_DC) +/* {{{ static int php_output_handler_appen(php_output_handler *handler, const php_output_buffer *buf) * Appends input to the output handlers buffer and indicates whether the buffer does not have to be processed by the output handler */ -static inline int php_output_handler_append(php_output_handler *handler, const php_output_buffer *buf TSRMLS_DC) +static inline int php_output_handler_append(php_output_handler *handler, const php_output_buffer *buf) { if (buf->used) { OG(flags) |= PHP_OUTPUT_WRITTEN; @@ -939,13 +939,13 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl ); #endif - if (php_output_lock_error(context->op TSRMLS_CC)) { + if (php_output_lock_error(context->op)) { /* fatal error */ return PHP_OUTPUT_HANDLER_FAILURE; } /* storable? */ - if (php_output_handler_append(handler, &context->in TSRMLS_CC) && !context->op) { + if (php_output_handler_append(handler, &context->in) && !context->op) { context->op = original_op; return PHP_OUTPUT_HANDLER_NO_DATA; } else { @@ -960,11 +960,11 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl ZVAL_STRINGL(&ob_data, handler->buffer.data, handler->buffer.used); ZVAL_LONG(&ob_mode, (zend_long) context->op); - zend_fcall_info_argn(&handler->func.user->fci TSRMLS_CC, 2, &ob_data, &ob_mode); + zend_fcall_info_argn(&handler->func.user->fci, 2, &ob_data, &ob_mode); zval_ptr_dtor(&ob_data); #define PHP_OUTPUT_USER_SUCCESS(retval) ((Z_TYPE(retval) != IS_UNDEF) && !(Z_TYPE(retval) == IS_FALSE)) - if (SUCCESS == zend_fcall_info_call(&handler->func.user->fci, &handler->func.user->fcc, &retval, NULL TSRMLS_CC) && PHP_OUTPUT_USER_SUCCESS(retval)) { + if (SUCCESS == zend_fcall_info_call(&handler->func.user->fci, &handler->func.user->fcc, &retval, NULL) && PHP_OUTPUT_USER_SUCCESS(retval)) { /* user handler may have returned TRUE */ status = PHP_OUTPUT_HANDLER_NO_DATA; if (Z_TYPE(retval) != IS_FALSE && Z_TYPE(retval) != IS_TRUE) { @@ -981,7 +981,7 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl status = PHP_OUTPUT_HANDLER_FAILURE; } - zend_fcall_info_argn(&handler->func.user->fci TSRMLS_CC, 0); + zend_fcall_info_argn(&handler->func.user->fci, 0); zval_ptr_dtor(&retval); } else { @@ -1035,19 +1035,19 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl /* }}} */ -/* {{{ static void php_output_op(int op, const char *str, size_t len TSRMLS_DC) +/* {{{ static void php_output_op(int op, const char *str, size_t len) * Output op dispatcher, passes input and output handlers output through the output handler stack until it gets written to the SAPI */ -static inline void php_output_op(int op, const char *str, size_t len TSRMLS_DC) +static inline void php_output_op(int op, const char *str, size_t len) { php_output_context context; php_output_handler **active; int obh_cnt; - if (php_output_lock_error(op TSRMLS_CC)) { + if (php_output_lock_error(op)) { return; } - php_output_context_init(&context, op TSRMLS_CC); + php_output_context_init(&context, op); /* * broken up for better performance: @@ -1071,16 +1071,16 @@ static inline void php_output_op(int op, const char *str, size_t len TSRMLS_DC) } if (context.out.data && context.out.used) { - php_output_header(TSRMLS_C); + php_output_header(); if (!(OG(flags) & PHP_OUTPUT_DISABLED)) { #if PHP_OUTPUT_DEBUG fprintf(stderr, "::: sapi_write('%s', %zu)\n", context.out.data, context.out.used); #endif - sapi_module.ub_write(context.out.data, context.out.used TSRMLS_CC); + sapi_module.ub_write(context.out.data, context.out.used); if (OG(flags) & PHP_OUTPUT_IMPLICITFLUSH) { - sapi_flush(TSRMLS_C); + sapi_flush(); } OG(flags) |= PHP_OUTPUT_SENT; @@ -1195,25 +1195,25 @@ static inline zval *php_output_handler_status(php_output_handler *handler, zval } /* }}} */ -/* {{{ static int php_output_stack_pop(int flags TSRMLS_DC) +/* {{{ static int php_output_stack_pop(int flags) * Pops an output handler off the stack */ -static inline int php_output_stack_pop(int flags TSRMLS_DC) +static inline int php_output_stack_pop(int flags) { php_output_context context; php_output_handler **current, *orphan = OG(active); if (!orphan) { if (!(flags & PHP_OUTPUT_POP_SILENT)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to %s buffer. No buffer to %s", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send"); + php_error_docref("ref.outcontrol", E_NOTICE, "failed to %s buffer. No buffer to %s", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send"); } return 0; } else if (!(flags & PHP_OUTPUT_POP_FORCE) && !(orphan->flags & PHP_OUTPUT_HANDLER_REMOVABLE)) { if (!(flags & PHP_OUTPUT_POP_SILENT)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to %s buffer of %s (%d)", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send", orphan->name->val, orphan->level); + php_error_docref("ref.outcontrol", E_NOTICE, "failed to %s buffer of %s (%d)", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send", orphan->name->val, orphan->level); } return 0; } else { - php_output_context_init(&context, PHP_OUTPUT_HANDLER_FINAL TSRMLS_CC); + php_output_context_init(&context, PHP_OUTPUT_HANDLER_FINAL); /* don't run the output handler if it's disabled */ if (!(orphan->flags & PHP_OUTPUT_HANDLER_DISABLED)) { @@ -1238,11 +1238,11 @@ static inline int php_output_stack_pop(int flags TSRMLS_DC) /* pass output along */ if (context.out.data && context.out.used && !(flags & PHP_OUTPUT_POP_DISCARD)) { - php_output_write(context.out.data, context.out.used TSRMLS_CC); + php_output_write(context.out.data, context.out.used); } /* destroy the handler (after write!) */ - php_output_handler_free(&orphan TSRMLS_CC); + php_output_handler_free(&orphan); php_output_context_dtor(&context); return 1; @@ -1261,7 +1261,7 @@ static int php_output_handler_compat_func(void **handler_context, php_output_con char *out_str = NULL; size_t out_len = 0; - func(output_context->in.data, output_context->in.used, &out_str, &out_len, output_context->op TSRMLS_CC); + func(output_context->in.data, output_context->in.used, &out_str, &out_len, output_context->op); if (out_str) { output_context->out.data = out_str; @@ -1306,7 +1306,7 @@ PHP_FUNCTION(ob_start) zend_long chunk_size = 0; zend_long flags = PHP_OUTPUT_HANDLER_STDFLAGS; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z/ll", &output_handler, &chunk_size, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z/ll", &output_handler, &chunk_size, &flags) == FAILURE) { return; } @@ -1314,8 +1314,8 @@ PHP_FUNCTION(ob_start) chunk_size = 0; } - if (php_output_start_user(output_handler, chunk_size, flags TSRMLS_CC) == FAILURE) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to create buffer"); + if (php_output_start_user(output_handler, chunk_size, flags) == FAILURE) { + php_error_docref("ref.outcontrol", E_NOTICE, "failed to create buffer"); RETURN_FALSE; } RETURN_TRUE; @@ -1331,12 +1331,12 @@ PHP_FUNCTION(ob_flush) } if (!OG(active)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to flush buffer. No buffer to flush"); + php_error_docref("ref.outcontrol", E_NOTICE, "failed to flush buffer. No buffer to flush"); RETURN_FALSE; } - if (SUCCESS != php_output_flush(TSRMLS_C)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to flush buffer of %s (%d)", OG(active)->name->val, OG(active)->level); + if (SUCCESS != php_output_flush()) { + php_error_docref("ref.outcontrol", E_NOTICE, "failed to flush buffer of %s (%d)", OG(active)->name->val, OG(active)->level); RETURN_FALSE; } RETURN_TRUE; @@ -1352,12 +1352,12 @@ PHP_FUNCTION(ob_clean) } if (!OG(active)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer. No buffer to delete"); + php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer. No buffer to delete"); RETURN_FALSE; } - if (SUCCESS != php_output_clean(TSRMLS_C)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer of %s (%d)", OG(active)->name->val, OG(active)->level); + if (SUCCESS != php_output_clean()) { + php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer of %s (%d)", OG(active)->name->val, OG(active)->level); RETURN_FALSE; } RETURN_TRUE; @@ -1373,11 +1373,11 @@ PHP_FUNCTION(ob_end_flush) } if (!OG(active)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete and flush buffer. No buffer to delete or flush"); + php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete and flush buffer. No buffer to delete or flush"); RETURN_FALSE; } - RETURN_BOOL(SUCCESS == php_output_end(TSRMLS_C)); + RETURN_BOOL(SUCCESS == php_output_end()); } /* }}} */ @@ -1390,11 +1390,11 @@ PHP_FUNCTION(ob_end_clean) } if (!OG(active)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer. No buffer to delete"); + php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer. No buffer to delete"); RETURN_FALSE; } - RETURN_BOOL(SUCCESS == php_output_discard(TSRMLS_C)); + RETURN_BOOL(SUCCESS == php_output_discard()); } /* }}} */ @@ -1406,13 +1406,13 @@ PHP_FUNCTION(ob_get_flush) return; } - if (php_output_get_contents(return_value TSRMLS_CC) == FAILURE) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete and flush buffer. No buffer to delete or flush"); + if (php_output_get_contents(return_value) == FAILURE) { + php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete and flush buffer. No buffer to delete or flush"); RETURN_FALSE; } - if (SUCCESS != php_output_end(TSRMLS_C)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer of %s (%d)", OG(active)->name->val, OG(active)->level); + if (SUCCESS != php_output_end()) { + php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer of %s (%d)", OG(active)->name->val, OG(active)->level); } } /* }}} */ @@ -1429,13 +1429,13 @@ PHP_FUNCTION(ob_get_clean) RETURN_FALSE; } - if (php_output_get_contents(return_value TSRMLS_CC) == FAILURE) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer. No buffer to delete"); + if (php_output_get_contents(return_value) == FAILURE) { + php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer. No buffer to delete"); RETURN_FALSE; } - if (SUCCESS != php_output_discard(TSRMLS_C)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer of %s (%d)", OG(active)->name->val, OG(active)->level); + if (SUCCESS != php_output_discard()) { + php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer of %s (%d)", OG(active)->name->val, OG(active)->level); } } /* }}} */ @@ -1448,7 +1448,7 @@ PHP_FUNCTION(ob_get_contents) return; } - if (php_output_get_contents(return_value TSRMLS_CC) == FAILURE) { + if (php_output_get_contents(return_value) == FAILURE) { RETURN_FALSE; } } @@ -1462,7 +1462,7 @@ PHP_FUNCTION(ob_get_level) return; } - RETURN_LONG(php_output_get_level(TSRMLS_C)); + RETURN_LONG(php_output_get_level()); } /* }}} */ @@ -1474,7 +1474,7 @@ PHP_FUNCTION(ob_get_length) return; } - if (php_output_get_length(return_value TSRMLS_CC) == FAILURE) { + if (php_output_get_length(return_value) == FAILURE) { RETURN_FALSE; } } @@ -1504,7 +1504,7 @@ PHP_FUNCTION(ob_get_status) { zend_bool full_status = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &full_status) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &full_status) == FAILURE) { return; } @@ -1528,11 +1528,11 @@ PHP_FUNCTION(ob_implicit_flush) { zend_long flag = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flag) == FAILURE) { return; } - php_output_set_implicit_flush(flag TSRMLS_CC); + php_output_set_implicit_flush(flag); } /* }}} */ @@ -1540,7 +1540,7 @@ PHP_FUNCTION(ob_implicit_flush) Reset(clear) URL rewriter values */ PHP_FUNCTION(output_reset_rewrite_vars) { - if (php_url_scanner_reset_vars(TSRMLS_C) == SUCCESS) { + if (php_url_scanner_reset_vars() == SUCCESS) { RETURN_TRUE; } else { RETURN_FALSE; @@ -1555,11 +1555,11 @@ PHP_FUNCTION(output_add_rewrite_var) char *name, *value; size_t name_len, value_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &value, &value_len) == FAILURE) { return; } - if (php_url_scanner_add_var(name, name_len, value, value_len, 1 TSRMLS_CC) == SUCCESS) { + if (php_url_scanner_add_var(name, name_len, value, value_len, 1) == SUCCESS) { RETURN_TRUE; } else { RETURN_FALSE; diff --git a/main/php.h b/main/php.h index 2a683e1924..515d1bb9c1 100644 --- a/main/php.h +++ b/main/php.h @@ -280,11 +280,11 @@ ssize_t pread(int, void *, size_t, off64_t); BEGIN_EXTERN_C() void phperror(char *error); -PHPAPI size_t php_write(void *buf, size_t size TSRMLS_DC); +PHPAPI size_t php_write(void *buf, size_t size); PHPAPI size_t php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2); PHPAPI int php_get_module_initialized(void); -PHPAPI void php_log_err(char *log_message TSRMLS_DC); +PHPAPI void php_log_err(char *log_message); int Debug(char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2); int cfgparse(void); END_EXTERN_C() @@ -293,13 +293,13 @@ END_EXTERN_C() #define error_handling_t zend_error_handling_t BEGIN_EXTERN_C() -static inline ZEND_ATTRIBUTE_DEPRECATED void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class TSRMLS_DC) +static inline ZEND_ATTRIBUTE_DEPRECATED void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class) { - zend_replace_error_handling(error_handling, exception_class, NULL TSRMLS_CC); + zend_replace_error_handling(error_handling, exception_class, NULL); } static inline ZEND_ATTRIBUTE_DEPRECATED void php_std_error_handling() {} -PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC) PHP_ATTRIBUTE_FORMAT(printf, 4, 0); +PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args) PHP_ATTRIBUTE_FORMAT(printf, 4, 0); #ifdef ZTS #define PHP_ATTR_FMT_OFFSET 1 @@ -308,14 +308,14 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c #endif /* PHPAPI void php_error(int type, const char *format, ...); */ -PHPAPI void php_error_docref0(const char *docref TSRMLS_DC, int type, const char *format, ...) +PHPAPI void php_error_docref0(const char *docref, int type, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 3, PHP_ATTR_FMT_OFFSET + 4); -PHPAPI void php_error_docref1(const char *docref TSRMLS_DC, const char *param1, int type, const char *format, ...) +PHPAPI void php_error_docref1(const char *docref, const char *param1, int type, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 4, PHP_ATTR_FMT_OFFSET + 5); -PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char *format, ...) +PHPAPI void php_error_docref2(const char *docref, const char *param1, const char *param2, int type, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 5, PHP_ATTR_FMT_OFFSET + 6); #ifdef PHP_WIN32 -PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2 TSRMLS_DC); +PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2); #endif END_EXTERN_C() @@ -332,12 +332,12 @@ END_EXTERN_C() /* functions */ BEGIN_EXTERN_C() -PHPAPI extern int (*php_register_internal_extensions_func)(TSRMLS_D); -PHPAPI int php_register_internal_extensions(TSRMLS_D); -PHPAPI int php_mergesort(void *base, size_t nmemb, register size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC); +PHPAPI extern int (*php_register_internal_extensions_func)(void); +PHPAPI int php_register_internal_extensions(void); +PHPAPI int php_mergesort(void *base, size_t nmemb, register size_t size, int (*cmp)(const void *, const void *)); PHPAPI void php_register_pre_request_shutdown(void (*func)(void *), void *userdata); -PHPAPI void php_com_initialize(TSRMLS_D); -PHPAPI char *php_get_current_user(TSRMLS_D); +PHPAPI void php_com_initialize(void); +PHPAPI char *php_get_current_user(void); END_EXTERN_C() /* PHP-named Zend macro wrappers */ diff --git a/main/php_content_types.c b/main/php_content_types.c index 8765a507bc..9be3a0eb45 100644 --- a/main/php_content_types.c +++ b/main/php_content_types.c @@ -40,7 +40,7 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader) if (!strcmp(SG(request_info).request_method, "POST")) { if (NULL == SG(request_info).post_entry) { /* no post handler registered, so we just swallow the data */ - sapi_read_standard_form_data(TSRMLS_C); + sapi_read_standard_form_data(); } } } @@ -48,20 +48,20 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader) /* {{{ php_startup_sapi_content_types */ -int php_startup_sapi_content_types(TSRMLS_D) +int php_startup_sapi_content_types(void) { - sapi_register_default_post_reader(php_default_post_reader TSRMLS_CC); - sapi_register_treat_data(php_default_treat_data TSRMLS_CC); - sapi_register_input_filter(php_default_input_filter, NULL TSRMLS_CC); + sapi_register_default_post_reader(php_default_post_reader); + sapi_register_treat_data(php_default_treat_data); + sapi_register_input_filter(php_default_input_filter, NULL); return SUCCESS; } /* }}} */ /* {{{ php_setup_sapi_content_types */ -int php_setup_sapi_content_types(TSRMLS_D) +int php_setup_sapi_content_types(void) { - sapi_register_post_entries(php_post_entries TSRMLS_CC); + sapi_register_post_entries(php_post_entries); return SUCCESS; } diff --git a/main/php_content_types.h b/main/php_content_types.h index 0a49d1e2cd..ab364e2c17 100644 --- a/main/php_content_types.h +++ b/main/php_content_types.h @@ -25,7 +25,7 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader); SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler); -int php_startup_sapi_content_types(TSRMLS_D); -int php_setup_sapi_content_types(TSRMLS_D); +int php_startup_sapi_content_types(void); +int php_setup_sapi_content_types(void); #endif /* PHP_CONTENT_TYPES_H */ diff --git a/main/php_globals.h b/main/php_globals.h index a60efe69de..76933d8f07 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -26,7 +26,7 @@ typedef struct _php_core_globals php_core_globals; #ifdef ZTS -# define PG(v) TSRMG(core_globals_id, php_core_globals *, v) +# define PG(v) ZEND_TSRMG(core_globals_id, php_core_globals *, v) extern PHPAPI int core_globals_id; #else # define PG(v) (core_globals.v) diff --git a/main/php_ini.c b/main/php_ini.c index 5303bf77ec..93b55ded33 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -74,7 +74,7 @@ PHPAPI char *php_ini_scanned_files=NULL; /* {{{ php_ini_displayer_cb */ -static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type TSRMLS_DC) +static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type) { if (ini_entry->displayer) { ini_entry->displayer(ini_entry, type); @@ -112,7 +112,7 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type TSRMLS_DC) } if (esc_html) { - php_html_puts(display_string, display_string_length TSRMLS_CC); + php_html_puts(display_string, display_string_length); } else { PHPWRITE(display_string, display_string_length); } @@ -122,7 +122,7 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type TSRMLS_DC) /* {{{ php_ini_displayer */ -static int php_ini_displayer(zval *el, void *arg TSRMLS_DC) +static int php_ini_displayer(zval *el, void *arg) { zend_ini_entry *ini_entry = (zend_ini_entry*)Z_PTR_P(el); int module_number = *(int *)arg; @@ -135,16 +135,16 @@ static int php_ini_displayer(zval *el, void *arg TSRMLS_DC) PUTS("<td class=\"e\">"); PHPWRITE(ini_entry->name->val, ini_entry->name->len); PUTS("</td><td class=\"v\">"); - php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE TSRMLS_CC); + php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE); PUTS("</td><td class=\"v\">"); - php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG TSRMLS_CC); + php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG); PUTS("</td></tr>\n"); } else { PHPWRITE(ini_entry->name->val, ini_entry->name->len); PUTS(" => "); - php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE TSRMLS_CC); + php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE); PUTS(" => "); - php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG TSRMLS_CC); + php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG); PUTS("\n"); } return 0; @@ -153,7 +153,7 @@ static int php_ini_displayer(zval *el, void *arg TSRMLS_DC) /* {{{ php_ini_available */ -static int php_ini_available(zval *el, void *arg TSRMLS_DC) +static int php_ini_available(zval *el, void *arg) { zend_ini_entry *ini_entry = (zend_ini_entry *)Z_PTR_P(el); int *module_number_available = (int *)arg; @@ -171,7 +171,6 @@ static int php_ini_available(zval *el, void *arg TSRMLS_DC) PHPAPI void display_ini_entries(zend_module_entry *module) { int module_number, module_number_available; - TSRMLS_FETCH(); if (module) { module_number = module->module_number; @@ -179,11 +178,11 @@ PHPAPI void display_ini_entries(zend_module_entry *module) module_number = 0; } module_number_available = module_number; - zend_hash_apply_with_argument(EG(ini_directives), php_ini_available, &module_number_available TSRMLS_CC); + zend_hash_apply_with_argument(EG(ini_directives), php_ini_available, &module_number_available); if (module_number_available == -1) { php_info_print_table_start(); php_info_print_table_header(3, "Directive", "Local Value", "Master Value"); - zend_hash_apply_with_argument(EG(ini_directives), php_ini_displayer, (void *)&module_number TSRMLS_CC); + zend_hash_apply_with_argument(EG(ini_directives), php_ini_displayer, (void *)&module_number); php_info_print_table_end(); } } @@ -343,23 +342,23 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* {{{ php_load_php_extension_cb */ -static void php_load_php_extension_cb(void *arg TSRMLS_DC) +static void php_load_php_extension_cb(void *arg) { #ifdef HAVE_LIBDL - php_load_extension(*((char **) arg), MODULE_PERSISTENT, 0 TSRMLS_CC); + php_load_extension(*((char **) arg), MODULE_PERSISTENT, 0); #endif } /* }}} */ /* {{{ php_load_zend_extension_cb */ -static void php_load_zend_extension_cb(void *arg TSRMLS_DC) +static void php_load_zend_extension_cb(void *arg) { char *filename = *((char **) arg); const int length = (int)strlen(filename); if (IS_ABSOLUTE_PATH(filename, length)) { - zend_load_extension(filename TSRMLS_CC); + zend_load_extension(filename); } else { char *libpath; char *extension_dir = INI_STR("extension_dir"); @@ -370,7 +369,7 @@ static void php_load_zend_extension_cb(void *arg TSRMLS_DC) } else { spprintf(&libpath, 0, "%s%c%s", extension_dir, DEFAULT_SLASH, filename); } - zend_load_extension(libpath TSRMLS_CC); + zend_load_extension(libpath); efree(libpath); } } @@ -378,7 +377,7 @@ static void php_load_zend_extension_cb(void *arg TSRMLS_DC) /* {{{ php_init_config */ -int php_init_config(TSRMLS_D) +int php_init_config(void) { char *php_ini_file_name = NULL; char *php_ini_search_path = NULL; @@ -552,7 +551,7 @@ int php_init_config(TSRMLS_D) if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) { fh.handle.fp = VCWD_FOPEN(php_ini_file_name, "r"); if (fh.handle.fp) { - fh.filename = php_ini_opened_path = expand_filepath(php_ini_file_name, NULL TSRMLS_CC); + fh.filename = php_ini_opened_path = expand_filepath(php_ini_file_name, NULL); } } } @@ -563,7 +562,7 @@ int php_init_config(TSRMLS_D) const char *fmt = "php-%s.ini"; char *ini_fname; spprintf(&ini_fname, 0, fmt, sapi_module.name); - fh.handle.fp = php_fopen_with_path(ini_fname, "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC); + fh.handle.fp = php_fopen_with_path(ini_fname, "r", php_ini_search_path, &php_ini_opened_path); efree(ini_fname); if (fh.handle.fp) { fh.filename = php_ini_opened_path; @@ -572,7 +571,7 @@ int php_init_config(TSRMLS_D) /* If still no ini file found, search for php.ini file in search path */ if (!fh.handle.fp) { - fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC); + fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path); if (fh.handle.fp) { fh.filename = php_ini_opened_path; } @@ -589,7 +588,7 @@ int php_init_config(TSRMLS_D) fh.type = ZEND_HANDLE_FP; RESET_ACTIVE_INI_HASH(); - zend_parse_ini_file(&fh, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash TSRMLS_CC); + zend_parse_ini_file(&fh, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash); { zval tmp; @@ -664,7 +663,7 @@ int php_init_config(TSRMLS_D) fh2.filename = ini_file; fh2.type = ZEND_HANDLE_FP; - if (zend_parse_ini_file(&fh2, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash TSRMLS_CC) == SUCCESS) { + if (zend_parse_ini_file(&fh2, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash) == SUCCESS) { /* Here, add it to the list of ini files read */ l = (int)strlen(ini_file); total_l += l + 2; @@ -705,7 +704,7 @@ int php_init_config(TSRMLS_D) if (sapi_module.ini_entries) { /* Reset active ini section */ RESET_ACTIVE_INI_HASH(); - zend_parse_ini_string(sapi_module.ini_entries, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash TSRMLS_CC); + zend_parse_ini_string(sapi_module.ini_entries, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash); } return SUCCESS; @@ -731,10 +730,10 @@ int php_shutdown_config(void) /* {{{ php_ini_register_extensions */ -void php_ini_register_extensions(TSRMLS_D) +void php_ini_register_extensions(void) { - zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb TSRMLS_CC); - zend_llist_apply(&extension_lists.functions, php_load_php_extension_cb TSRMLS_CC); + zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb); + zend_llist_apply(&extension_lists.functions, php_load_php_extension_cb); zend_llist_destroy(&extension_lists.engine); zend_llist_destroy(&extension_lists.functions); @@ -743,7 +742,7 @@ void php_ini_register_extensions(TSRMLS_D) /* {{{ php_parse_user_ini_file */ -PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, HashTable *target_hash TSRMLS_DC) +PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, HashTable *target_hash) { zend_stat_t sb; char ini_file[MAXPATHLEN]; @@ -761,7 +760,7 @@ PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, Hash /* Reset active ini section */ RESET_ACTIVE_INI_HASH(); - if (zend_parse_ini_file(&fh, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, target_hash TSRMLS_CC) == SUCCESS) { + if (zend_parse_ini_file(&fh, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, target_hash) == SUCCESS) { /* FIXME: Add parsed file to the list of user files read? */ return SUCCESS; } @@ -775,7 +774,7 @@ PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, Hash /* {{{ php_ini_activate_config */ -PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int stage TSRMLS_DC) +PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int stage) { zend_string *str; zval *data; @@ -787,7 +786,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int zend_hash_move_forward(source_hash) ) { data = zend_hash_get_current_data(source_hash); - zend_alter_ini_entry_ex(str, Z_STR_P(data), modify_type, stage, 0 TSRMLS_CC); + zend_alter_ini_entry_ex(str, Z_STR_P(data), modify_type, stage, 0); } } /* }}} */ @@ -802,7 +801,7 @@ PHPAPI int php_ini_has_per_dir_config(void) /* {{{ php_ini_activate_per_dir_config */ -PHPAPI void php_ini_activate_per_dir_config(char *path, size_t path_len TSRMLS_DC) +PHPAPI void php_ini_activate_per_dir_config(char *path, size_t path_len) { zval *tmp2; char *ptr; @@ -834,7 +833,7 @@ PHPAPI void php_ini_activate_per_dir_config(char *path, size_t path_len TSRMLS_D *ptr = 0; /* Search for source array matching the path from configuration_hash */ if ((tmp2 = zend_hash_str_find(&configuration_hash, path, strlen(path))) != NULL) { - php_ini_activate_config(Z_ARRVAL_P(tmp2), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE TSRMLS_CC); + php_ini_activate_config(Z_ARRVAL_P(tmp2), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); } *ptr = '/'; ptr++; @@ -853,14 +852,14 @@ PHPAPI int php_ini_has_per_host_config(void) /* {{{ php_ini_activate_per_host_config */ -PHPAPI void php_ini_activate_per_host_config(const char *host, size_t host_len TSRMLS_DC) +PHPAPI void php_ini_activate_per_host_config(const char *host, size_t host_len) { zval *tmp; if (has_per_host_config && host && host_len) { /* Search for source array matching the host from configuration_hash */ if ((tmp = zend_hash_str_find(&configuration_hash, host, host_len)) != NULL) { - php_ini_activate_config(Z_ARRVAL_P(tmp), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE TSRMLS_CC); + php_ini_activate_config(Z_ARRVAL_P(tmp), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); } } } diff --git a/main/php_ini.h b/main/php_ini.h index 7022507f51..235cc68888 100644 --- a/main/php_ini.h +++ b/main/php_ini.h @@ -25,20 +25,20 @@ BEGIN_EXTERN_C() PHPAPI void config_zval_dtor(zval *zvalue); -int php_init_config(TSRMLS_D); +int php_init_config(void); int php_shutdown_config(void); -void php_ini_register_extensions(TSRMLS_D); +void php_ini_register_extensions(void); PHPAPI zval *cfg_get_entry_ex(zend_string *name); PHPAPI zval *cfg_get_entry(const char *name, size_t name_length); PHPAPI int cfg_get_long(const char *varname, zend_long *result); PHPAPI int cfg_get_double(const char *varname, double *result); PHPAPI int cfg_get_string(const char *varname, char **result); -PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, HashTable *target_hash TSRMLS_DC); -PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int stage TSRMLS_DC); +PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, HashTable *target_hash); +PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int stage); PHPAPI int php_ini_has_per_dir_config(void); PHPAPI int php_ini_has_per_host_config(void); -PHPAPI void php_ini_activate_per_dir_config(char *path, size_t path_len TSRMLS_DC); -PHPAPI void php_ini_activate_per_host_config(const char *host, size_t host_len TSRMLS_DC); +PHPAPI void php_ini_activate_per_dir_config(char *path, size_t path_len); +PHPAPI void php_ini_activate_per_host_config(const char *host, size_t host_len); PHPAPI HashTable* php_ini_get_configuration_hash(void); END_EXTERN_C() diff --git a/main/php_main.h b/main/php_main.h index 94a6299fc3..d821710acc 100644 --- a/main/php_main.h +++ b/main/php_main.h @@ -27,28 +27,28 @@ #include "SAPI.h" BEGIN_EXTERN_C() -PHPAPI int php_request_startup(TSRMLS_D); +PHPAPI int php_request_startup(void); 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, zend_module_entry *additional_modules, uint num_additional_modules); -PHPAPI void php_module_shutdown(TSRMLS_D); +PHPAPI void php_module_shutdown(void); PHPAPI void php_module_shutdown_for_exec(void); PHPAPI int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals); -PHPAPI int php_request_startup_for_hook(TSRMLS_D); +PHPAPI int php_request_startup_for_hook(void); PHPAPI void php_request_shutdown_for_hook(void *dummy); -PHPAPI int php_register_extensions(zend_module_entry **ptr, int count TSRMLS_DC); +PHPAPI int php_register_extensions(zend_module_entry **ptr, int count); -PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC); -PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval *ret TSRMLS_DC); -PHPAPI int php_handle_special_queries(TSRMLS_D); -PHPAPI int php_lint_script(zend_file_handle *file TSRMLS_DC); +PHPAPI int php_execute_script(zend_file_handle *primary_file); +PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval *ret); +PHPAPI int php_handle_special_queries(void); +PHPAPI int php_lint_script(zend_file_handle *file); PHPAPI void php_handle_aborted_connection(void); -PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC); +PHPAPI int php_handle_auth_data(const char *auth); -PHPAPI void php_html_puts(const char *str, size_t siz TSRMLS_DC); -PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode TSRMLS_DC); +PHPAPI void php_html_puts(const char *str, size_t siz); +PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode); /* environment module */ extern int php_init_environ(void); diff --git a/main/php_memory_streams.h b/main/php_memory_streams.h index a7823817bc..5b9be3813e 100644 --- a/main/php_memory_streams.h +++ b/main/php_memory_streams.h @@ -29,25 +29,25 @@ #define TEMP_STREAM_READONLY 1 #define TEMP_STREAM_TAKE_BUFFER 2 -#define php_stream_memory_create(mode) _php_stream_memory_create((mode) STREAMS_CC TSRMLS_CC) -#define php_stream_memory_create_rel(mode) _php_stream_memory_create((mode) STREAMS_REL_CC TSRMLS_CC) -#define php_stream_memory_open(mode, buf, length) _php_stream_memory_open((mode), (buf), (length) STREAMS_CC TSRMLS_CC) -#define php_stream_memory_get_buffer(stream, length) _php_stream_memory_get_buffer((stream), (length) STREAMS_CC TSRMLS_CC) +#define php_stream_memory_create(mode) _php_stream_memory_create((mode) STREAMS_CC) +#define php_stream_memory_create_rel(mode) _php_stream_memory_create((mode) STREAMS_REL_CC) +#define php_stream_memory_open(mode, buf, length) _php_stream_memory_open((mode), (buf), (length) STREAMS_CC) +#define php_stream_memory_get_buffer(stream, length) _php_stream_memory_get_buffer((stream), (length) STREAMS_CC) #define php_stream_temp_new() php_stream_temp_create(TEMP_STREAM_DEFAULT, PHP_STREAM_MAX_MEM) -#define php_stream_temp_create(mode, max_memory_usage) _php_stream_temp_create((mode), (max_memory_usage) STREAMS_CC TSRMLS_CC) -#define php_stream_temp_create_ex(mode, max_memory_usage, tmpdir) _php_stream_temp_create_ex((mode), (max_memory_usage), (tmpdir) STREAMS_CC TSRMLS_CC) -#define php_stream_temp_create_rel(mode, max_memory_usage) _php_stream_temp_create((mode), (max_memory_usage) STREAMS_REL_CC TSRMLS_CC) -#define php_stream_temp_open(mode, max_memory_usage, buf, length) _php_stream_temp_open((mode), (max_memory_usage), (buf), (length) STREAMS_CC TSRMLS_CC) +#define php_stream_temp_create(mode, max_memory_usage) _php_stream_temp_create((mode), (max_memory_usage) STREAMS_CC) +#define php_stream_temp_create_ex(mode, max_memory_usage, tmpdir) _php_stream_temp_create_ex((mode), (max_memory_usage), (tmpdir) STREAMS_CC) +#define php_stream_temp_create_rel(mode, max_memory_usage) _php_stream_temp_create((mode), (max_memory_usage) STREAMS_REL_CC) +#define php_stream_temp_open(mode, max_memory_usage, buf, length) _php_stream_temp_open((mode), (max_memory_usage), (buf), (length) STREAMS_CC) BEGIN_EXTERN_C() -PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC TSRMLS_DC); -PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC TSRMLS_DC); -PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC TSRMLS_DC); +PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC); +PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC); +PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC); -PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC TSRMLS_DC); -PHPAPI php_stream *_php_stream_temp_create_ex(int mode, size_t max_memory_usage, const char *tmpdir STREAMS_DC TSRMLS_DC); -PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC TSRMLS_DC); +PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC); +PHPAPI php_stream *_php_stream_temp_create_ex(int mode, size_t max_memory_usage, const char *tmpdir STREAMS_DC); +PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC); END_EXTERN_C() extern PHPAPI php_stream_ops php_stream_memory_ops; diff --git a/main/php_network.h b/main/php_network.h index b0b1787ea5..5a168cb0f9 100644 --- a/main/php_network.h +++ b/main/php_network.h @@ -230,13 +230,13 @@ typedef struct { #endif BEGIN_EXTERN_C() -PHPAPI int php_network_getaddresses(const char *host, int socktype, struct sockaddr ***sal, zend_string **error_string TSRMLS_DC); +PHPAPI int php_network_getaddresses(const char *host, int socktype, struct sockaddr ***sal, zend_string **error_string); PHPAPI void php_network_freeaddresses(struct sockaddr **sal); PHPAPI php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short port, int socktype, int asynchronous, struct timeval *timeout, zend_string **error_string, int *error_code, char *bindto, unsigned short bindport, long sockopts - TSRMLS_DC); + ); PHPAPI int php_network_connect_socket(php_socket_t sockfd, const struct sockaddr *addr, @@ -251,7 +251,7 @@ PHPAPI int php_network_connect_socket(php_socket_t sockfd, PHPAPI php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsigned port, int socktype, long sockopts, zend_string **error_string, int *error_code - TSRMLS_DC); + ); PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, zend_string **textaddr, @@ -260,19 +260,19 @@ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, struct timeval *timeout, zend_string **error_string, int *error_code - TSRMLS_DC); + ); PHPAPI int php_network_get_sock_name(php_socket_t sock, zend_string **textaddr, struct sockaddr **addr, socklen_t *addrlen - TSRMLS_DC); + ); PHPAPI int php_network_get_peer_name(php_socket_t sock, zend_string **textaddr, struct sockaddr **addr, socklen_t *addrlen - TSRMLS_DC); + ); PHPAPI void php_any_addr(int family, php_sockaddr_storage *addr, unsigned short port); PHPAPI int php_sockaddr_size(php_sockaddr_storage *addr); @@ -291,10 +291,10 @@ extern php_stream_ops php_stream_generic_socket_ops; #define PHP_STREAM_IS_SOCKET (&php_stream_socket_ops) BEGIN_EXTERN_C() -PHPAPI php_stream *_php_stream_sock_open_from_socket(php_socket_t socket, const char *persistent_id STREAMS_DC TSRMLS_DC ); +PHPAPI php_stream *_php_stream_sock_open_from_socket(php_socket_t socket, const char *persistent_id STREAMS_DC ); /* open a connection to a host using php_hostconnect and return a stream */ PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short port, - int socktype, struct timeval *timeout, const char *persistent_id STREAMS_DC TSRMLS_DC); + int socktype, struct timeval *timeout, const char *persistent_id STREAMS_DC); PHPAPI void php_network_populate_name_from_sockaddr( /* input address */ struct sockaddr *sa, socklen_t sl, @@ -303,19 +303,19 @@ PHPAPI void php_network_populate_name_from_sockaddr( /* output address */ struct sockaddr **addr, socklen_t *addrlen - TSRMLS_DC); + ); PHPAPI int php_network_parse_network_address_with_port(const char *addr, - zend_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC); + zend_long addrlen, struct sockaddr *sa, socklen_t *sl); END_EXTERN_C() -#define php_stream_sock_open_from_socket(socket, persistent) _php_stream_sock_open_from_socket((socket), (persistent) STREAMS_CC TSRMLS_CC) -#define php_stream_sock_open_host(host, port, socktype, timeout, persistent) _php_stream_sock_open_host((host), (port), (socktype), (timeout), (persistent) STREAMS_CC TSRMLS_CC) +#define php_stream_sock_open_from_socket(socket, persistent) _php_stream_sock_open_from_socket((socket), (persistent) STREAMS_CC) +#define php_stream_sock_open_host(host, port, socktype, timeout, persistent) _php_stream_sock_open_host((host), (port), (socktype), (timeout), (persistent) STREAMS_CC) /* {{{ memory debug */ -#define php_stream_sock_open_from_socket_rel(socket, persistent) _php_stream_sock_open_from_socket((socket), (persistent) STREAMS_REL_CC TSRMLS_CC) -#define php_stream_sock_open_host_rel(host, port, socktype, timeout, persistent) _php_stream_sock_open_host((host), (port), (socktype), (timeout), (persistent) STREAMS_REL_CC TSRMLS_CC) -#define php_stream_sock_open_unix_rel(path, pathlen, persistent, timeval) _php_stream_sock_open_unix((path), (pathlen), (persistent), (timeval) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_sock_open_from_socket_rel(socket, persistent) _php_stream_sock_open_from_socket((socket), (persistent) STREAMS_REL_CC) +#define php_stream_sock_open_host_rel(host, port, socktype, timeout, persistent) _php_stream_sock_open_host((host), (port), (socktype), (timeout), (persistent) STREAMS_REL_CC) +#define php_stream_sock_open_unix_rel(path, pathlen, persistent, timeval) _php_stream_sock_open_unix((path), (pathlen), (persistent), (timeval) STREAMS_REL_CC) /* }}} */ diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c index 955f0d26e1..eca5da7754 100644 --- a/main/php_open_temporary_file.c +++ b/main/php_open_temporary_file.c @@ -94,7 +94,7 @@ * SUCH DAMAGE. */ -static int php_do_open_temporary_file(const char *path, const char *pfx, char **opened_path_p TSRMLS_DC) +static int php_do_open_temporary_file(const char *path, const char *pfx, char **opened_path_p) { char *trailing_slash; char *opened_path; @@ -127,7 +127,7 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char ** new_state.cwd = estrdup(cwd); new_state.cwd_length = (int)strlen(cwd); - if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) { + if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) { efree(new_state.cwd); return -1; } @@ -189,7 +189,7 @@ PHPAPI void php_shutdown_temporary_directory(void) /* * Determine where to place temporary files. */ -PHPAPI const char* php_get_temporary_directory(TSRMLS_D) +PHPAPI const char* php_get_temporary_directory(void) { /* Did we determine the temporary directory already? */ if (temporary_directory) { @@ -264,7 +264,7 @@ PHPAPI const char* php_get_temporary_directory(TSRMLS_D) * This function should do its best to return a file pointer to a newly created * unique file, on every platform. */ -PHPAPI int php_open_temporary_fd_ex(const char *dir, const char *pfx, char **opened_path_p, zend_bool open_basedir_check TSRMLS_DC) +PHPAPI int php_open_temporary_fd_ex(const char *dir, const char *pfx, char **opened_path_p, zend_bool open_basedir_check) { int fd; const char *temp_dir; @@ -278,17 +278,17 @@ PHPAPI int php_open_temporary_fd_ex(const char *dir, const char *pfx, char **ope if (!dir || *dir == '\0') { def_tmp: - temp_dir = php_get_temporary_directory(TSRMLS_C); + temp_dir = php_get_temporary_directory(); - if (temp_dir && *temp_dir != '\0' && (!open_basedir_check || !php_check_open_basedir(temp_dir TSRMLS_CC))) { - return php_do_open_temporary_file(temp_dir, pfx, opened_path_p TSRMLS_CC); + if (temp_dir && *temp_dir != '\0' && (!open_basedir_check || !php_check_open_basedir(temp_dir))) { + return php_do_open_temporary_file(temp_dir, pfx, opened_path_p); } else { return -1; } } /* Try the directory given as parameter. */ - fd = php_do_open_temporary_file(dir, pfx, opened_path_p TSRMLS_CC); + fd = php_do_open_temporary_file(dir, pfx, opened_path_p); if (fd == -1) { /* Use default temporary directory. */ goto def_tmp; @@ -296,15 +296,15 @@ def_tmp: return fd; } -PHPAPI int php_open_temporary_fd(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC) +PHPAPI int php_open_temporary_fd(const char *dir, const char *pfx, char **opened_path_p) { - return php_open_temporary_fd_ex(dir, pfx, opened_path_p, 0 TSRMLS_CC); + return php_open_temporary_fd_ex(dir, pfx, opened_path_p, 0); } -PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC) +PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **opened_path_p) { FILE *fp; - int fd = php_open_temporary_fd(dir, pfx, opened_path_p TSRMLS_CC); + int fd = php_open_temporary_fd(dir, pfx, opened_path_p); if (fd == -1) { return NULL; diff --git a/main/php_open_temporary_file.h b/main/php_open_temporary_file.h index a11cb79014..1ed9a2bc32 100644 --- a/main/php_open_temporary_file.h +++ b/main/php_open_temporary_file.h @@ -22,10 +22,10 @@ #define PHP_OPEN_TEMPORARY_FILE_H BEGIN_EXTERN_C() -PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC); -PHPAPI int php_open_temporary_fd_ex(const char *dir, const char *pfx, char **opened_path_p, zend_bool open_basedir_check TSRMLS_DC); -PHPAPI int php_open_temporary_fd(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC); -PHPAPI const char *php_get_temporary_directory(TSRMLS_D); +PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **opened_path_p); +PHPAPI int php_open_temporary_fd_ex(const char *dir, const char *pfx, char **opened_path_p, zend_bool open_basedir_check); +PHPAPI int php_open_temporary_fd(const char *dir, const char *pfx, char **opened_path_p); +PHPAPI const char *php_get_temporary_directory(void); PHPAPI void php_shutdown_temporary_directory(void); END_EXTERN_C() diff --git a/main/php_output.h b/main/php_output.h index 535b09b46c..f2f5848280 100644 --- a/main/php_output.h +++ b/main/php_output.h @@ -102,23 +102,21 @@ typedef struct _php_output_context { int op; php_output_buffer in; php_output_buffer out; -#ifdef ZTS - void ***tsrm_ls; -#endif } php_output_context; -#define PHP_OUTPUT_TSRMLS(ctx) TSRMLS_FETCH_FROM_CTX((ctx)->tsrm_ls) +/* XXX remove this after TLS branch merge */ +#define PHP_OUTPUT_TSRMLS(ctx) /* old-style, stateless callback */ -typedef void (*php_output_handler_func_t)(char *output, size_t output_len, char **handled_output, size_t *handled_output_len, int mode TSRMLS_DC); +typedef void (*php_output_handler_func_t)(char *output, size_t output_len, char **handled_output, size_t *handled_output_len, int mode); /* new-style, opaque context callback */ typedef int (*php_output_handler_context_func_t)(void **handler_context, php_output_context *output_context); /* output handler context dtor */ -typedef void (*php_output_handler_context_dtor_t)(void *opaq TSRMLS_DC); +typedef void (*php_output_handler_context_dtor_t)(void *opaq); /* conflict check callback */ -typedef int (*php_output_handler_conflict_check_t)(const char *handler_name, size_t handler_name_len TSRMLS_DC); +typedef int (*php_output_handler_conflict_check_t)(const char *handler_name, size_t handler_name_len); /* ctor for aliases */ -typedef struct _php_output_handler *(*php_output_handler_alias_ctor_t)(const char *handler_name, size_t handler_name_len, size_t chunk_size, int flags TSRMLS_DC); +typedef struct _php_output_handler *(*php_output_handler_alias_ctor_t)(const char *handler_name, size_t handler_name_len, size_t chunk_size, int flags); typedef struct _php_output_handler_user_func_t { zend_fcall_info fci; @@ -134,7 +132,7 @@ typedef struct _php_output_handler { php_output_buffer buffer; void *opaq; - void (*dtor)(void *opaq TSRMLS_DC); + void (*dtor)(void *opaq); union { php_output_handler_user_func_t *user; @@ -155,25 +153,25 @@ PHPAPI ZEND_EXTERN_MODULE_GLOBALS(output); /* there should not be a need to use OG() from outside of output.c */ #ifdef ZTS -# define OG(v) TSRMG(output_globals_id, zend_output_globals *, v) +# define OG(v) ZEND_TSRMG(output_globals_id, zend_output_globals *, v) #else # define OG(v) (output_globals.v) #endif /* convenience macros */ -#define PHPWRITE(str, str_len) php_output_write((str), (str_len) TSRMLS_CC) -#define PHPWRITE_H(str, str_len) php_output_write_unbuffered((str), (str_len) TSRMLS_CC) +#define PHPWRITE(str, str_len) php_output_write((str), (str_len)) +#define PHPWRITE_H(str, str_len) php_output_write_unbuffered((str), (str_len)) -#define PUTC(c) (php_output_write(&(c), 1 TSRMLS_CC), (c)) -#define PUTC_H(c) (php_output_write_unbuffered(&(c), 1 TSRMLS_CC), (c)) +#define PUTC(c) (php_output_write(&(c), 1), (c)) +#define PUTC_H(c) (php_output_write_unbuffered(&(c), 1), (c)) #define PUTS(str) do { \ const char *__str = (str); \ - php_output_write(__str, strlen(__str) TSRMLS_CC); \ + php_output_write(__str, strlen(__str)); \ } while (0) #define PUTS_H(str) do { \ const char *__str = (str); \ - php_output_write_unbuffered(__str, strlen(__str) TSRMLS_CC); \ + php_output_write_unbuffered(__str, strlen(__str)); \ } while (0) @@ -184,10 +182,10 @@ extern const char php_output_devnull_handler_name[sizeof("null output handler")] #define php_output_tearup() \ php_output_startup(); \ - php_output_activate(TSRMLS_C) + php_output_activate() #define php_output_teardown() \ - php_output_end_all(TSRMLS_C); \ - php_output_deactivate(TSRMLS_C); \ + php_output_end_all(); \ + php_output_deactivate(); \ php_output_shutdown() /* MINIT */ @@ -195,58 +193,58 @@ PHPAPI void php_output_startup(void); /* MSHUTDOWN */ PHPAPI void php_output_shutdown(void); -PHPAPI void php_output_register_constants(TSRMLS_D); +PHPAPI void php_output_register_constants(void); /* RINIT */ -PHPAPI int php_output_activate(TSRMLS_D); +PHPAPI int php_output_activate(void); /* RSHUTDOWN */ -PHPAPI void php_output_deactivate(TSRMLS_D); - -PHPAPI void php_output_set_status(int status TSRMLS_DC); -PHPAPI int php_output_get_status(TSRMLS_D); -PHPAPI void php_output_set_implicit_flush(int flush TSRMLS_DC); -PHPAPI const char *php_output_get_start_filename(TSRMLS_D); -PHPAPI int php_output_get_start_lineno(TSRMLS_D); - -PHPAPI size_t php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC); -PHPAPI size_t php_output_write(const char *str, size_t len TSRMLS_DC); - -PHPAPI int php_output_flush(TSRMLS_D); -PHPAPI void php_output_flush_all(TSRMLS_D); -PHPAPI int php_output_clean(TSRMLS_D); -PHPAPI void php_output_clean_all(TSRMLS_D); -PHPAPI int php_output_end(TSRMLS_D); -PHPAPI void php_output_end_all(TSRMLS_D); -PHPAPI int php_output_discard(TSRMLS_D); -PHPAPI void php_output_discard_all(TSRMLS_D); - -PHPAPI int php_output_get_contents(zval *p TSRMLS_DC); -PHPAPI int php_output_get_length(zval *p TSRMLS_DC); -PHPAPI int php_output_get_level(TSRMLS_D); -PHPAPI php_output_handler* php_output_get_active_handler(TSRMLS_D); - -PHPAPI int php_output_start_default(TSRMLS_D); -PHPAPI int php_output_start_devnull(TSRMLS_D); - -PHPAPI int php_output_start_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC); -PHPAPI int php_output_start_internal(const char *name, size_t name_len, php_output_handler_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC); - -PHPAPI php_output_handler *php_output_handler_create_user(zval *handler, size_t chunk_size, int flags TSRMLS_DC); -PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, size_t name_len, php_output_handler_context_func_t handler, size_t chunk_size, int flags TSRMLS_DC); - -PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void* TSRMLS_DC) TSRMLS_DC); -PHPAPI int php_output_handler_start(php_output_handler *handler TSRMLS_DC); -PHPAPI int php_output_handler_started(const char *name, size_t name_len TSRMLS_DC); -PHPAPI int php_output_handler_hook(php_output_handler_hook_t type, void *arg TSRMLS_DC); -PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC); -PHPAPI void php_output_handler_free(php_output_handler **handler TSRMLS_DC); - -PHPAPI int php_output_handler_conflict(const char *handler_new, size_t handler_new_len, const char *handler_set, size_t handler_set_len TSRMLS_DC); -PHPAPI int php_output_handler_conflict_register(const char *handler_name, size_t handler_name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC); -PHPAPI int php_output_handler_reverse_conflict_register(const char *handler_name, size_t handler_name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC); - -PHPAPI php_output_handler_alias_ctor_t php_output_handler_alias(const char *handler_name, size_t handler_name_len TSRMLS_DC); -PHPAPI int php_output_handler_alias_register(const char *handler_name, size_t handler_name_len, php_output_handler_alias_ctor_t func TSRMLS_DC); +PHPAPI void php_output_deactivate(void); + +PHPAPI void php_output_set_status(int status); +PHPAPI int php_output_get_status(void); +PHPAPI void php_output_set_implicit_flush(int flush); +PHPAPI const char *php_output_get_start_filename(void); +PHPAPI int php_output_get_start_lineno(void); + +PHPAPI size_t php_output_write_unbuffered(const char *str, size_t len); +PHPAPI size_t php_output_write(const char *str, size_t len); + +PHPAPI int php_output_flush(void); +PHPAPI void php_output_flush_all(void); +PHPAPI int php_output_clean(void); +PHPAPI void php_output_clean_all(void); +PHPAPI int php_output_end(void); +PHPAPI void php_output_end_all(void); +PHPAPI int php_output_discard(void); +PHPAPI void php_output_discard_all(void); + +PHPAPI int php_output_get_contents(zval *p); +PHPAPI int php_output_get_length(zval *p); +PHPAPI int php_output_get_level(void); +PHPAPI php_output_handler* php_output_get_active_handler(void); + +PHPAPI int php_output_start_default(void); +PHPAPI int php_output_start_devnull(void); + +PHPAPI int php_output_start_user(zval *output_handler, size_t chunk_size, int flags); +PHPAPI int php_output_start_internal(const char *name, size_t name_len, php_output_handler_func_t output_handler, size_t chunk_size, int flags); + +PHPAPI php_output_handler *php_output_handler_create_user(zval *handler, size_t chunk_size, int flags); +PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, size_t name_len, php_output_handler_context_func_t handler, size_t chunk_size, int flags); + +PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void*)); +PHPAPI int php_output_handler_start(php_output_handler *handler); +PHPAPI int php_output_handler_started(const char *name, size_t name_len); +PHPAPI int php_output_handler_hook(php_output_handler_hook_t type, void *arg); +PHPAPI void php_output_handler_dtor(php_output_handler *handler); +PHPAPI void php_output_handler_free(php_output_handler **handler); + +PHPAPI int php_output_handler_conflict(const char *handler_new, size_t handler_new_len, const char *handler_set, size_t handler_set_len); +PHPAPI int php_output_handler_conflict_register(const char *handler_name, size_t handler_name_len, php_output_handler_conflict_check_t check_func); +PHPAPI int php_output_handler_reverse_conflict_register(const char *handler_name, size_t handler_name_len, php_output_handler_conflict_check_t check_func); + +PHPAPI php_output_handler_alias_ctor_t php_output_handler_alias(const char *handler_name, size_t handler_name_len); +PHPAPI int php_output_handler_alias_register(const char *handler_name, size_t handler_name_len, php_output_handler_alias_ctor_t func); END_EXTERN_C() diff --git a/main/php_streams.h b/main/php_streams.h index 79ceaf2761..29abb3ebd5 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -61,27 +61,27 @@ END_EXTERN_C() /* these functions relay the file/line number information. They are depth aware, so they will pass * the ultimate ancestor, which is useful, because there can be several layers of calls */ -#define php_stream_alloc_rel(ops, thisptr, persistent, mode) _php_stream_alloc((ops), (thisptr), (persistent), (mode) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_alloc_rel(ops, thisptr, persistent, mode) _php_stream_alloc((ops), (thisptr), (persistent), (mode) STREAMS_REL_CC) -#define php_stream_copy_to_mem_rel(src, maxlen, persistent) _php_stream_copy_to_mem((src), (buf), (maxlen), (persistent) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_copy_to_mem_rel(src, maxlen, persistent) _php_stream_copy_to_mem((src), (buf), (maxlen), (persistent) STREAMS_REL_CC) -#define php_stream_fopen_rel(filename, mode, opened, options) _php_stream_fopen((filename), (mode), (opened), (options) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_fopen_rel(filename, mode, opened, options) _php_stream_fopen((filename), (mode), (opened), (options) STREAMS_REL_CC) -#define php_stream_fopen_with_path_rel(filename, mode, path, opened, options) _php_stream_fopen_with_path((filename), (mode), (path), (opened), (options) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_fopen_with_path_rel(filename, mode, path, opened, options) _php_stream_fopen_with_path((filename), (mode), (path), (opened), (options) STREAMS_REL_CC) -#define php_stream_fopen_from_fd_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd((fd), (mode), (persistent_id) STREAMS_REL_CC TSRMLS_CC) -#define php_stream_fopen_from_file_rel(file, mode) _php_stream_fopen_from_file((file), (mode) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_fopen_from_fd_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd((fd), (mode), (persistent_id) STREAMS_REL_CC) +#define php_stream_fopen_from_file_rel(file, mode) _php_stream_fopen_from_file((file), (mode) STREAMS_REL_CC) -#define php_stream_fopen_from_pipe_rel(file, mode) _php_stream_fopen_from_pipe((file), (mode) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_fopen_from_pipe_rel(file, mode) _php_stream_fopen_from_pipe((file), (mode) STREAMS_REL_CC) -#define php_stream_fopen_tmpfile_rel() _php_stream_fopen_tmpfile(0 STREAMS_REL_CC TSRMLS_CC) +#define php_stream_fopen_tmpfile_rel() _php_stream_fopen_tmpfile(0 STREAMS_REL_CC) -#define php_stream_fopen_temporary_file_rel(dir, pfx, opened_path) _php_stream_fopen_temporary_file((dir), (pfx), (opened_path) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_fopen_temporary_file_rel(dir, pfx, opened_path) _php_stream_fopen_temporary_file((dir), (pfx), (opened_path) STREAMS_REL_CC) -#define php_stream_open_wrapper_rel(path, mode, options, opened) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_REL_CC TSRMLS_CC) -#define php_stream_open_wrapper_ex_rel(path, mode, options, opened, context) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_open_wrapper_rel(path, mode, options, opened) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_REL_CC) +#define php_stream_open_wrapper_ex_rel(path, mode, options, opened, context) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) STREAMS_REL_CC) -#define php_stream_make_seekable_rel(origstream, newstream, flags) _php_stream_make_seekable((origstream), (newstream), (flags) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_make_seekable_rel(origstream, newstream, flags) _php_stream_make_seekable((origstream), (newstream), (flags) STREAMS_REL_CC) /* }}} */ @@ -117,47 +117,47 @@ typedef struct _php_stream_dirent { /* operations on streams that are file-handles */ typedef struct _php_stream_ops { /* stdio like functions - these are mandatory! */ - size_t (*write)(php_stream *stream, const char *buf, size_t count TSRMLS_DC); - size_t (*read)(php_stream *stream, char *buf, size_t count TSRMLS_DC); - int (*close)(php_stream *stream, int close_handle TSRMLS_DC); - int (*flush)(php_stream *stream TSRMLS_DC); + size_t (*write)(php_stream *stream, const char *buf, size_t count); + size_t (*read)(php_stream *stream, char *buf, size_t count); + int (*close)(php_stream *stream, int close_handle); + int (*flush)(php_stream *stream); const char *label; /* label for this ops structure */ /* these are optional */ - int (*seek)(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC); - int (*cast)(php_stream *stream, int castas, void **ret TSRMLS_DC); - int (*stat)(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC); - int (*set_option)(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC); + int (*seek)(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset); + int (*cast)(php_stream *stream, int castas, void **ret); + int (*stat)(php_stream *stream, php_stream_statbuf *ssb); + int (*set_option)(php_stream *stream, int option, int value, void *ptrparam); } php_stream_ops; typedef struct _php_stream_wrapper_ops { /* open/create a wrapped stream */ php_stream *(*stream_opener)(php_stream_wrapper *wrapper, const char *filename, const char *mode, - int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); + int options, char **opened_path, php_stream_context *context STREAMS_DC); /* close/destroy a wrapped stream */ - int (*stream_closer)(php_stream_wrapper *wrapper, php_stream *stream TSRMLS_DC); + int (*stream_closer)(php_stream_wrapper *wrapper, php_stream *stream); /* stat a wrapped stream */ - int (*stream_stat)(php_stream_wrapper *wrapper, php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC); + int (*stream_stat)(php_stream_wrapper *wrapper, php_stream *stream, php_stream_statbuf *ssb); /* stat a URL */ - int (*url_stat)(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); + int (*url_stat)(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context); /* open a "directory" stream */ php_stream *(*dir_opener)(php_stream_wrapper *wrapper, const char *filename, const char *mode, - int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); + int options, char **opened_path, php_stream_context *context STREAMS_DC); const char *label; /* delete a file */ - int (*unlink)(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); + int (*unlink)(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context); /* rename a file */ - int (*rename)(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC); + int (*rename)(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context); /* Create/Remove directory */ - int (*stream_mkdir)(php_stream_wrapper *wrapper, const char *url, int mode, int options, php_stream_context *context TSRMLS_DC); - int (*stream_rmdir)(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); + int (*stream_mkdir)(php_stream_wrapper *wrapper, const char *url, int mode, int options, php_stream_context *context); + int (*stream_rmdir)(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context); /* Metadata handling */ - int (*stream_metadata)(php_stream_wrapper *wrapper, const char *url, int options, void *value, php_stream_context *context TSRMLS_DC); + int (*stream_metadata)(php_stream_wrapper *wrapper, const char *url, int options, void *value, php_stream_context *context); } php_stream_wrapper_ops; struct _php_stream_wrapper { @@ -241,9 +241,9 @@ struct _php_stream { /* allocate a new stream for a particular ops */ BEGIN_EXTERN_C() PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract, - const char *persistent_id, const char *mode STREAMS_DC TSRMLS_DC); + const char *persistent_id, const char *mode STREAMS_DC); END_EXTERN_C() -#define php_stream_alloc(ops, thisptr, persistent_id, mode) _php_stream_alloc((ops), (thisptr), (persistent_id), (mode) STREAMS_CC TSRMLS_CC) +#define php_stream_alloc(ops, thisptr, persistent_id, mode) _php_stream_alloc((ops), (thisptr), (persistent_id), (mode) STREAMS_CC) #define php_stream_get_resource_id(stream) ((php_stream *)(stream))->res->handle /* use this to tell the stream that it is OK if we don't explicitly close it */ @@ -254,14 +254,14 @@ END_EXTERN_C() #define php_stream_to_zval(stream, zval) { ZVAL_RES(zval, (stream)->res); (stream)->__exposed++; } #define php_stream_from_zval(xstr, pzval) ZEND_FETCH_RESOURCE2((xstr), php_stream *, (pzval), -1, "stream", php_file_le_stream(), php_file_le_pstream()) -#define php_stream_from_zval_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource((pzval) TSRMLS_CC, -1, "stream", NULL, 2, php_file_le_stream(), php_file_le_pstream()) +#define php_stream_from_zval_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource((pzval), -1, "stream", NULL, 2, php_file_le_stream(), php_file_le_pstream()) BEGIN_EXTERN_C() PHPAPI php_stream *php_stream_encloses(php_stream *enclosing, php_stream *enclosed); -#define php_stream_free_enclosed(stream_enclosed, close_options) _php_stream_free_enclosed((stream_enclosed), (close_options) TSRMLS_CC) -PHPAPI int _php_stream_free_enclosed(php_stream *stream_enclosed, int close_options TSRMLS_DC); +#define php_stream_free_enclosed(stream_enclosed, close_options) _php_stream_free_enclosed((stream_enclosed), (close_options)) +PHPAPI int _php_stream_free_enclosed(php_stream *stream_enclosed, int close_options); -PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream **stream TSRMLS_DC); +PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream **stream); #define PHP_STREAM_PERSISTENT_SUCCESS 0 /* id exists */ #define PHP_STREAM_PERSISTENT_FAILURE 1 /* id exists but is not a stream! */ #define PHP_STREAM_PERSISTENT_NOT_EXIST 2 /* id does not exist */ @@ -276,73 +276,73 @@ PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream * #define PHP_STREAM_FREE_CLOSE_CASTED (PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_PRESERVE_HANDLE) #define PHP_STREAM_FREE_CLOSE_PERSISTENT (PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_PERSISTENT) -PHPAPI int _php_stream_free(php_stream *stream, int close_options TSRMLS_DC); -#define php_stream_free(stream, close_options) _php_stream_free((stream), (close_options) TSRMLS_CC) -#define php_stream_close(stream) _php_stream_free((stream), PHP_STREAM_FREE_CLOSE TSRMLS_CC) -#define php_stream_pclose(stream) _php_stream_free((stream), PHP_STREAM_FREE_CLOSE_PERSISTENT TSRMLS_CC) +PHPAPI int _php_stream_free(php_stream *stream, int close_options); +#define php_stream_free(stream, close_options) _php_stream_free((stream), (close_options)) +#define php_stream_close(stream) _php_stream_free((stream), PHP_STREAM_FREE_CLOSE) +#define php_stream_pclose(stream) _php_stream_free((stream), PHP_STREAM_FREE_CLOSE_PERSISTENT) -PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence TSRMLS_DC); -#define php_stream_rewind(stream) _php_stream_seek((stream), 0L, SEEK_SET TSRMLS_CC) -#define php_stream_seek(stream, offset, whence) _php_stream_seek((stream), (offset), (whence) TSRMLS_CC) +PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence); +#define php_stream_rewind(stream) _php_stream_seek((stream), 0L, SEEK_SET) +#define php_stream_seek(stream, offset, whence) _php_stream_seek((stream), (offset), (whence)) -PHPAPI zend_off_t _php_stream_tell(php_stream *stream TSRMLS_DC); -#define php_stream_tell(stream) _php_stream_tell((stream) TSRMLS_CC) +PHPAPI zend_off_t _php_stream_tell(php_stream *stream); +#define php_stream_tell(stream) _php_stream_tell((stream)) -PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC); -#define php_stream_read(stream, buf, count) _php_stream_read((stream), (buf), (count) TSRMLS_CC) +PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t count); +#define php_stream_read(stream, buf, count) _php_stream_read((stream), (buf), (count)) -PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC); -#define php_stream_write_string(stream, str) _php_stream_write(stream, str, strlen(str) TSRMLS_CC) -#define php_stream_write(stream, buf, count) _php_stream_write(stream, (buf), (count) TSRMLS_CC) +PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t count); +#define php_stream_write_string(stream, str) _php_stream_write(stream, str, strlen(str)) +#define php_stream_write(stream, buf, count) _php_stream_write(stream, (buf), (count)) #ifdef ZTS -PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); +PHPAPI size_t _php_stream_printf(php_stream *stream, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); #else -PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3); +PHPAPI size_t _php_stream_printf(php_stream *stream, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3); #endif -/* php_stream_printf macro & function require TSRMLS_CC */ +/* php_stream_printf macro & function require */ #define php_stream_printf _php_stream_printf -PHPAPI int _php_stream_eof(php_stream *stream TSRMLS_DC); -#define php_stream_eof(stream) _php_stream_eof((stream) TSRMLS_CC) +PHPAPI int _php_stream_eof(php_stream *stream); +#define php_stream_eof(stream) _php_stream_eof((stream)) -PHPAPI int _php_stream_getc(php_stream *stream TSRMLS_DC); -#define php_stream_getc(stream) _php_stream_getc((stream) TSRMLS_CC) +PHPAPI int _php_stream_getc(php_stream *stream); +#define php_stream_getc(stream) _php_stream_getc((stream)) -PHPAPI int _php_stream_putc(php_stream *stream, int c TSRMLS_DC); -#define php_stream_putc(stream, c) _php_stream_putc((stream), (c) TSRMLS_CC) +PHPAPI int _php_stream_putc(php_stream *stream, int c); +#define php_stream_putc(stream, c) _php_stream_putc((stream), (c)) -PHPAPI int _php_stream_flush(php_stream *stream, int closing TSRMLS_DC); -#define php_stream_flush(stream) _php_stream_flush((stream), 0 TSRMLS_CC) +PHPAPI int _php_stream_flush(php_stream *stream, int closing); +#define php_stream_flush(stream) _php_stream_flush((stream), 0) -PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, size_t *returned_len TSRMLS_DC); -#define php_stream_gets(stream, buf, maxlen) _php_stream_get_line((stream), (buf), (maxlen), NULL TSRMLS_CC) +PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, size_t *returned_len); +#define php_stream_gets(stream, buf, maxlen) _php_stream_get_line((stream), (buf), (maxlen), NULL) -#define php_stream_get_line(stream, buf, maxlen, retlen) _php_stream_get_line((stream), (buf), (maxlen), (retlen) TSRMLS_CC) -PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, const char *delim, size_t delim_len TSRMLS_DC); +#define php_stream_get_line(stream, buf, maxlen, retlen) _php_stream_get_line((stream), (buf), (maxlen), (retlen)) +PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, const char *delim, size_t delim_len); /* CAREFUL! this is equivalent to puts NOT fputs! */ -PHPAPI int _php_stream_puts(php_stream *stream, const char *buf TSRMLS_DC); -#define php_stream_puts(stream, buf) _php_stream_puts((stream), (buf) TSRMLS_CC) +PHPAPI int _php_stream_puts(php_stream *stream, const char *buf); +#define php_stream_puts(stream, buf) _php_stream_puts((stream), (buf)) -PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC); -#define php_stream_stat(stream, ssb) _php_stream_stat((stream), (ssb) TSRMLS_CC) +PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb); +#define php_stream_stat(stream, ssb) _php_stream_stat((stream), (ssb)) -PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); -#define php_stream_stat_path(path, ssb) _php_stream_stat_path((path), 0, (ssb), NULL TSRMLS_CC) -#define php_stream_stat_path_ex(path, flags, ssb, context) _php_stream_stat_path((path), (flags), (ssb), (context) TSRMLS_CC) +PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf *ssb, php_stream_context *context); +#define php_stream_stat_path(path, ssb) _php_stream_stat_path((path), 0, (ssb), NULL) +#define php_stream_stat_path_ex(path, flags, ssb, context) _php_stream_stat_path((path), (flags), (ssb), (context)) -PHPAPI int _php_stream_mkdir(const char *path, int mode, int options, php_stream_context *context TSRMLS_DC); -#define php_stream_mkdir(path, mode, options, context) _php_stream_mkdir(path, mode, options, context TSRMLS_CC) +PHPAPI int _php_stream_mkdir(const char *path, int mode, int options, php_stream_context *context); +#define php_stream_mkdir(path, mode, options, context) _php_stream_mkdir(path, mode, options, context) -PHPAPI int _php_stream_rmdir(const char *path, int options, php_stream_context *context TSRMLS_DC); -#define php_stream_rmdir(path, options, context) _php_stream_rmdir(path, options, context TSRMLS_CC) +PHPAPI int _php_stream_rmdir(const char *path, int options, php_stream_context *context); +#define php_stream_rmdir(path, options, context) _php_stream_rmdir(path, options, context) -PHPAPI php_stream *_php_stream_opendir(const char *path, int options, php_stream_context *context STREAMS_DC TSRMLS_DC); -#define php_stream_opendir(path, options, context) _php_stream_opendir((path), (options), (context) STREAMS_CC TSRMLS_CC) -PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_dirent *ent TSRMLS_DC); -#define php_stream_readdir(dirstream, dirent) _php_stream_readdir((dirstream), (dirent) TSRMLS_CC) +PHPAPI php_stream *_php_stream_opendir(const char *path, int options, php_stream_context *context STREAMS_DC); +#define php_stream_opendir(path, options, context) _php_stream_opendir((path), (options), (context) STREAMS_CC) +PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_dirent *ent); +#define php_stream_readdir(dirstream, dirent) _php_stream_readdir((dirstream), (dirent)) #define php_stream_closedir(dirstream) php_stream_close((dirstream)) #define php_stream_rewinddir(dirstream) php_stream_rewind((dirstream)) @@ -350,13 +350,13 @@ PHPAPI int php_stream_dirent_alphasort(const zend_string **a, const zend_string PHPAPI int php_stream_dirent_alphasortr(const zend_string **a, const zend_string **b); PHPAPI int _php_stream_scandir(const char *dirname, zend_string **namelist[], int flags, php_stream_context *context, - int (*compare) (const zend_string **a, const zend_string **b) TSRMLS_DC); -#define php_stream_scandir(dirname, namelist, context, compare) _php_stream_scandir((dirname), (namelist), 0, (context), (compare) TSRMLS_CC) + int (*compare) (const zend_string **a, const zend_string **b)); +#define php_stream_scandir(dirname, namelist, context, compare) _php_stream_scandir((dirname), (namelist), 0, (context), (compare)) -PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC); -#define php_stream_set_option(stream, option, value, ptrvalue) _php_stream_set_option((stream), (option), (value), (ptrvalue) TSRMLS_CC) +PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, void *ptrparam); +#define php_stream_set_option(stream, option, value, ptrvalue) _php_stream_set_option((stream), (option), (value), (ptrvalue)) -#define php_stream_set_chunk_size(stream, size) _php_stream_set_option((stream), PHP_STREAM_OPTION_SET_CHUNK_SIZE, (size), NULL TSRMLS_CC) +#define php_stream_set_chunk_size(stream, size) _php_stream_set_option((stream), PHP_STREAM_OPTION_SET_CHUNK_SIZE, (size), NULL) END_EXTERN_C() @@ -395,8 +395,8 @@ END_EXTERN_C() /* whether or not locking is supported */ #define PHP_STREAM_LOCK_SUPPORTED 1 -#define php_stream_supports_lock(stream) _php_stream_set_option((stream), PHP_STREAM_OPTION_LOCKING, 0, (void *) PHP_STREAM_LOCK_SUPPORTED TSRMLS_CC) == 0 ? 1 : 0 -#define php_stream_lock(stream, mode) _php_stream_set_option((stream), PHP_STREAM_OPTION_LOCKING, (mode), (void *) NULL TSRMLS_CC) +#define php_stream_supports_lock(stream) _php_stream_set_option((stream), PHP_STREAM_OPTION_LOCKING, 0, (void *) PHP_STREAM_LOCK_SUPPORTED) == 0 ? 1 : 0 +#define php_stream_lock(stream, mode) _php_stream_set_option((stream), PHP_STREAM_OPTION_LOCKING, (mode), (void *) NULL) /* option code used by the php_stream_xport_XXX api */ #define PHP_STREAM_OPTION_XPORT_API 7 /* see php_stream_transport.h */ @@ -407,15 +407,15 @@ END_EXTERN_C() #define PHP_STREAM_TRUNCATE_SUPPORTED 0 #define PHP_STREAM_TRUNCATE_SET_SIZE 1 /* ptrparam is a pointer to a size_t */ -#define php_stream_truncate_supported(stream) (_php_stream_set_option((stream), PHP_STREAM_OPTION_TRUNCATE_API, PHP_STREAM_TRUNCATE_SUPPORTED, NULL TSRMLS_CC) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0) +#define php_stream_truncate_supported(stream) (_php_stream_set_option((stream), PHP_STREAM_OPTION_TRUNCATE_API, PHP_STREAM_TRUNCATE_SUPPORTED, NULL) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0) BEGIN_EXTERN_C() -PHPAPI int _php_stream_truncate_set_size(php_stream *stream, size_t newsize TSRMLS_DC); -#define php_stream_truncate_set_size(stream, size) _php_stream_truncate_set_size((stream), (size) TSRMLS_CC) +PHPAPI int _php_stream_truncate_set_size(php_stream *stream, size_t newsize); +#define php_stream_truncate_set_size(stream, size) _php_stream_truncate_set_size((stream), (size)) END_EXTERN_C() #define PHP_STREAM_OPTION_META_DATA_API 11 /* ptrparam is a zval* to which to add meta data information */ -#define php_stream_populate_meta_data(stream, zv) (_php_stream_set_option((stream), PHP_STREAM_OPTION_META_DATA_API, 0, zv TSRMLS_CC) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0) +#define php_stream_populate_meta_data(stream, zv) (_php_stream_set_option((stream), PHP_STREAM_OPTION_META_DATA_API, 0, zv) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0) /* Check if the stream is still "live"; for sockets/pipes this means the socket * is still connected; for files, this does not really have meaning */ @@ -431,20 +431,20 @@ END_EXTERN_C() BEGIN_EXTERN_C() ZEND_ATTRIBUTE_DEPRECATED -PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC); -#define php_stream_copy_to_stream(src, dest, maxlen) _php_stream_copy_to_stream((src), (dest), (maxlen) STREAMS_CC TSRMLS_CC) -PHPAPI int _php_stream_copy_to_stream_ex(php_stream *src, php_stream *dest, size_t maxlen, size_t *len STREAMS_DC TSRMLS_DC); -#define php_stream_copy_to_stream_ex(src, dest, maxlen, len) _php_stream_copy_to_stream_ex((src), (dest), (maxlen), (len) STREAMS_CC TSRMLS_CC) +PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC); +#define php_stream_copy_to_stream(src, dest, maxlen) _php_stream_copy_to_stream((src), (dest), (maxlen) STREAMS_CC) +PHPAPI int _php_stream_copy_to_stream_ex(php_stream *src, php_stream *dest, size_t maxlen, size_t *len STREAMS_DC); +#define php_stream_copy_to_stream_ex(src, dest, maxlen, len) _php_stream_copy_to_stream_ex((src), (dest), (maxlen), (len) STREAMS_CC) /* read all data from stream and put into a buffer. Caller must free buffer * when done. */ -PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int persistent STREAMS_DC TSRMLS_DC); -#define php_stream_copy_to_mem(src, maxlen, persistent) _php_stream_copy_to_mem((src), (maxlen), (persistent) STREAMS_CC TSRMLS_CC) +PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int persistent STREAMS_DC); +#define php_stream_copy_to_mem(src, maxlen, persistent) _php_stream_copy_to_mem((src), (maxlen), (persistent) STREAMS_CC) /* output all data from a stream */ -PHPAPI size_t _php_stream_passthru(php_stream * src STREAMS_DC TSRMLS_DC); -#define php_stream_passthru(stream) _php_stream_passthru((stream) STREAMS_CC TSRMLS_CC) +PHPAPI size_t _php_stream_passthru(php_stream * src STREAMS_DC); +#define php_stream_passthru(stream) _php_stream_passthru((stream) STREAMS_CC) END_EXTERN_C() #include "streams/php_stream_transport.h" @@ -469,11 +469,11 @@ END_EXTERN_C() #define PHP_STREAM_CAST_INTERNAL 0x20000000 /* stream cast for internal use */ #define PHP_STREAM_CAST_MASK (PHP_STREAM_CAST_TRY_HARD | PHP_STREAM_CAST_RELEASE | PHP_STREAM_CAST_INTERNAL) BEGIN_EXTERN_C() -PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show_err TSRMLS_DC); +PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show_err); END_EXTERN_C() /* use this to check if a stream can be cast into another form */ -#define php_stream_can_cast(stream, as) _php_stream_cast((stream), (as), NULL, 0 TSRMLS_CC) -#define php_stream_cast(stream, as, ret, show_err) _php_stream_cast((stream), (as), (ret), (show_err) TSRMLS_CC) +#define php_stream_can_cast(stream, as) _php_stream_cast((stream), (as), NULL, 0) +#define php_stream_cast(stream, as, ret, show_err) _php_stream_cast((stream), (as), (ret), (show_err)) /* use this to check if a stream is of a particular type: * PHPAPI int php_stream_is(php_stream *stream, php_stream_ops *ops); */ @@ -532,22 +532,22 @@ END_EXTERN_C() /* Antique - no longer has meaning */ #define IGNORE_URL_WIN 0 -int php_init_stream_wrappers(int module_number TSRMLS_DC); -int php_shutdown_stream_wrappers(int module_number TSRMLS_DC); -void php_shutdown_stream_hashes(TSRMLS_D); +int php_init_stream_wrappers(int module_number); +int php_shutdown_stream_wrappers(int module_number); +void php_shutdown_stream_hashes(void); PHP_RSHUTDOWN_FUNCTION(streams); BEGIN_EXTERN_C() -PHPAPI int php_register_url_stream_wrapper(const char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); -PHPAPI int php_unregister_url_stream_wrapper(const char *protocol TSRMLS_DC); -PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); -PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol TSRMLS_DC); -PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); -PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options TSRMLS_DC); -PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf TSRMLS_DC); +PHPAPI int php_register_url_stream_wrapper(const char *protocol, php_stream_wrapper *wrapper); +PHPAPI int php_unregister_url_stream_wrapper(const char *protocol); +PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_stream_wrapper *wrapper); +PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol); +PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC); +PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options); +PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf); -#define php_stream_open_wrapper(path, mode, options, opened) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_CC TSRMLS_CC) -#define php_stream_open_wrapper_ex(path, mode, options, opened, context) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) STREAMS_CC TSRMLS_CC) +#define php_stream_open_wrapper(path, mode, options, opened) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_CC) +#define php_stream_open_wrapper_ex(path, mode, options, opened, context) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) STREAMS_CC) #define php_stream_get_from_zval(stream, zstream, mode, options, opened, context) \ if (Z_TYPE_PP((zstream)) == IS_RESOURCE) { \ @@ -557,9 +557,9 @@ PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf TS /* pushes an error message onto the stack for a wrapper instance */ #ifdef ZTS -PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 4, 5); +PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 4, 5); #else -PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); +PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); #endif #define PHP_STREAM_UNCHANGED 0 /* orig stream was seekable anyway */ @@ -570,15 +570,15 @@ PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int option #define PHP_STREAM_PREFER_STDIO 1 #define PHP_STREAM_FORCE_CONVERSION 2 /* DO NOT call this on streams that are referenced by resources! */ -PHPAPI int _php_stream_make_seekable(php_stream *origstream, php_stream **newstream, int flags STREAMS_DC TSRMLS_DC); -#define php_stream_make_seekable(origstream, newstream, flags) _php_stream_make_seekable((origstream), (newstream), (flags) STREAMS_CC TSRMLS_CC) +PHPAPI int _php_stream_make_seekable(php_stream *origstream, php_stream **newstream, int flags STREAMS_DC); +#define php_stream_make_seekable(origstream, newstream, flags) _php_stream_make_seekable((origstream), (newstream), (flags) STREAMS_CC) /* Give other modules access to the url_stream_wrappers_hash and stream_filters_hash */ -PHPAPI HashTable *_php_stream_get_url_stream_wrappers_hash(TSRMLS_D); -#define php_stream_get_url_stream_wrappers_hash() _php_stream_get_url_stream_wrappers_hash(TSRMLS_C) +PHPAPI HashTable *_php_stream_get_url_stream_wrappers_hash(void); +#define php_stream_get_url_stream_wrappers_hash() _php_stream_get_url_stream_wrappers_hash() PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash_global(void); -PHPAPI HashTable *_php_get_stream_filters_hash(TSRMLS_D); -#define php_get_stream_filters_hash() _php_get_stream_filters_hash(TSRMLS_C) +PHPAPI HashTable *_php_get_stream_filters_hash(void); +#define php_get_stream_filters_hash() _php_get_stream_filters_hash() PHPAPI HashTable *php_get_stream_filters_hash_global(void); extern php_stream_wrapper_ops *php_stream_user_wrapper_ops; END_EXTERN_C() diff --git a/main/php_ticks.c b/main/php_ticks.c index daa6cde6ff..0c7c0d2f1f 100644 --- a/main/php_ticks.c +++ b/main/php_ticks.c @@ -21,18 +21,18 @@ #include "php.h" #include "php_ticks.h" -int php_startup_ticks(TSRMLS_D) +int php_startup_ticks(void) { zend_llist_init(&PG(tick_functions), sizeof(void(*)(int)), NULL, 1); return SUCCESS; } -void php_deactivate_ticks(TSRMLS_D) +void php_deactivate_ticks(void) { zend_llist_clean(&PG(tick_functions)); } -void php_shutdown_ticks(TSRMLS_D) +void php_shutdown_ticks(void) { zend_llist_destroy(&PG(tick_functions)); } @@ -46,18 +46,18 @@ static int php_compare_tick_functions(void *elem1, void *elem2) return (func1 == func2); } -PHPAPI void php_add_tick_function(void (*func)(int) TSRMLS_DC) +PHPAPI void php_add_tick_function(void (*func)(int)) { zend_llist_add_element(&PG(tick_functions), (void *)&func); } -PHPAPI void php_remove_tick_function(void (*func)(int) TSRMLS_DC) +PHPAPI void php_remove_tick_function(void (*func)(int)) { zend_llist_del_element(&PG(tick_functions), (void *)func, (int(*)(void*, void*))php_compare_tick_functions); } -static void php_tick_iterator(void *data, void *arg TSRMLS_DC) +static void php_tick_iterator(void *data, void *arg) { void (*func)(int); @@ -65,9 +65,9 @@ static void php_tick_iterator(void *data, void *arg TSRMLS_DC) func(*((int *)arg)); } -void php_run_ticks(int count TSRMLS_DC) +void php_run_ticks(int count) { - zend_llist_apply_with_argument(&PG(tick_functions), (llist_apply_with_arg_func_t) php_tick_iterator, &count TSRMLS_CC); + zend_llist_apply_with_argument(&PG(tick_functions), (llist_apply_with_arg_func_t) php_tick_iterator, &count); } /* diff --git a/main/php_ticks.h b/main/php_ticks.h index 0f8277cc7f..d2a873ee18 100644 --- a/main/php_ticks.h +++ b/main/php_ticks.h @@ -21,14 +21,14 @@ #ifndef PHP_TICKS_H #define PHP_TICKS_H -int php_startup_ticks(TSRMLS_D); -void php_deactivate_ticks(TSRMLS_D); -void php_shutdown_ticks(TSRMLS_D); -void php_run_ticks(int count TSRMLS_DC); +int php_startup_ticks(void); +void php_deactivate_ticks(void); +void php_shutdown_ticks(void); +void php_run_ticks(int count); BEGIN_EXTERN_C() -PHPAPI void php_add_tick_function(void (*func)(int) TSRMLS_DC); -PHPAPI void php_remove_tick_function(void (*func)(int) TSRMLS_DC); +PHPAPI void php_add_tick_function(void (*func)(int)); +PHPAPI void php_remove_tick_function(void (*func)(int)); END_EXTERN_C() #endif diff --git a/main/php_variables.c b/main/php_variables.c index 4f911c2e65..38df80d097 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -34,26 +34,26 @@ #endif /* for systems that need to override reading of environment variables */ -void _php_import_environment_variables(zval *array_ptr TSRMLS_DC); -PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC) = _php_import_environment_variables; +void _php_import_environment_variables(zval *array_ptr); +PHPAPI void (*php_import_environment_variables)(zval *array_ptr) = _php_import_environment_variables; -PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array TSRMLS_DC) +PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array) { - php_register_variable_safe(var, strval, strlen(strval), track_vars_array TSRMLS_CC); + php_register_variable_safe(var, strval, strlen(strval), track_vars_array); } /* binary-safe version */ -PHPAPI void php_register_variable_safe(char *var, char *strval, size_t str_len, zval *track_vars_array TSRMLS_DC) +PHPAPI void php_register_variable_safe(char *var, char *strval, size_t str_len, zval *track_vars_array) { zval new_entry; assert(strval != NULL); /* Prepare value */ ZVAL_NEW_STR(&new_entry, zend_string_init(strval, str_len, 0)); - php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC); + php_register_variable_ex(var, &new_entry, track_vars_array); } -PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars_array TSRMLS_DC) +PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars_array) { char *p = NULL; char *ip = NULL; /* index pointer */ @@ -141,7 +141,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars /* do not output the error message to the screen, this helps us to to avoid "information disclosure" */ if (!PG(display_errors)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variable nesting level exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_nesting_level in php.ini.", PG(max_input_nesting_level)); + php_error_docref(NULL, E_WARNING, "Input variable nesting level exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_nesting_level in php.ini.", PG(max_input_nesting_level)); } free_alloca(var_orig, use_heap); return; @@ -241,7 +241,7 @@ typedef struct post_var_data { uint64_t cnt; } post_var_data_t; -static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof TSRMLS_DC) +static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof) { char *ksep, *vsep, *val; size_t klen, vlen; @@ -281,8 +281,8 @@ static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof TSR vlen = php_url_decode(val, vlen); } - if (sapi_module.input_filter(PARSE_POST, var->ptr, &val, vlen, &new_vlen TSRMLS_CC)) { - php_register_variable_safe(var->ptr, val, new_vlen, arr TSRMLS_CC); + if (sapi_module.input_filter(PARSE_POST, var->ptr, &val, vlen, &new_vlen)) { + php_register_variable_safe(var->ptr, val, new_vlen, arr); } efree(val); @@ -290,15 +290,15 @@ static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof TSR return 1; } -static inline int add_post_vars(zval *arr, post_var_data_t *vars, zend_bool eof TSRMLS_DC) +static inline int add_post_vars(zval *arr, post_var_data_t *vars, zend_bool eof) { uint64_t max_vars = PG(max_input_vars); vars->ptr = vars->str.s->val; vars->end = vars->str.s->val + vars->str.s->len; - while (add_post_var(arr, vars, eof TSRMLS_CC)) { + while (add_post_var(arr, vars, eof)) { if (++vars->cnt > max_vars) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "Input variables exceeded %" PRIu64 ". " "To increase the limit change max_input_vars in php.ini.", max_vars); @@ -328,7 +328,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler) if (len && len != (size_t) -1) { smart_str_appendl(&post_data.str, buf, len); - if (SUCCESS != add_post_vars(arr, &post_data, 0 TSRMLS_CC)) { + if (SUCCESS != add_post_vars(arr, &post_data, 0)) { smart_str_free(&post_data.str); return; } @@ -340,7 +340,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler) } if (post_data.str.s) { - add_post_vars(arr, &post_data, 1 TSRMLS_CC); + add_post_vars(arr, &post_data, 1); smart_str_free(&post_data.str); } } @@ -389,7 +389,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) } if (arg == PARSE_POST) { - sapi_handle_post(&array TSRMLS_CC); + sapi_handle_post(&array); return; } @@ -444,7 +444,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) } if (++count > PG(max_input_vars)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); + php_error_docref(NULL, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); break; } @@ -456,8 +456,8 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) php_url_decode(var, strlen(var)); val_len = php_url_decode(val, strlen(val)); val = estrndup(val, val_len); - if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len TSRMLS_CC)) { - php_register_variable_safe(var, val, new_val_len, &array TSRMLS_CC); + if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len)) { + php_register_variable_safe(var, val, new_val_len, &array); } efree(val); } else { @@ -467,8 +467,8 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) php_url_decode(var, strlen(var)); val_len = 0; val = estrndup("", val_len); - if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len TSRMLS_CC)) { - php_register_variable_safe(var, val, new_val_len, &array TSRMLS_CC); + if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len)) { + php_register_variable_safe(var, val, new_val_len, &array); } efree(val); } @@ -485,7 +485,7 @@ next_cookie: } } -void _php_import_environment_variables(zval *array_ptr TSRMLS_DC) +void _php_import_environment_variables(zval *array_ptr) { char buf[128]; char **env, *p, *t = buf; @@ -504,14 +504,14 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC) } memcpy(t, *env, nlen); t[nlen] = '\0'; - php_register_variable(t, p + 1, array_ptr TSRMLS_CC); + php_register_variable(t, p + 1, array_ptr); } if (t != buf && t != NULL) { efree(t); } } -zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC) +zend_bool php_std_auto_global_callback(char *name, uint name_len) { zend_printf("%s\n", name); return 0; /* don't rearm */ @@ -519,7 +519,7 @@ zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC) /* {{{ php_build_argv */ -static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) +static void php_build_argv(char *s, zval *track_vars_array) { zval arr, argc, tmp; int count = 0; @@ -585,33 +585,33 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) /* {{{ php_register_server_variables */ -static inline void php_register_server_variables(TSRMLS_D) +static inline void php_register_server_variables(void) { zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]); array_init(&PG(http_globals)[TRACK_VARS_SERVER]); /* Server variables */ if (sapi_module.register_server_variables) { - sapi_module.register_server_variables(&PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); + sapi_module.register_server_variables(&PG(http_globals)[TRACK_VARS_SERVER]); } /* PHP Authentication support */ if (SG(request_info).auth_user) { - php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); + php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, &PG(http_globals)[TRACK_VARS_SERVER]); } if (SG(request_info).auth_password) { - php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); + php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, &PG(http_globals)[TRACK_VARS_SERVER]); } if (SG(request_info).auth_digest) { - php_register_variable("PHP_AUTH_DIGEST", SG(request_info).auth_digest, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); + php_register_variable("PHP_AUTH_DIGEST", SG(request_info).auth_digest, &PG(http_globals)[TRACK_VARS_SERVER]); } /* store request init time */ { zval request_time_float, request_time_long; - ZVAL_DOUBLE(&request_time_float, sapi_get_request_time(TSRMLS_C)); - php_register_variable_ex("REQUEST_TIME_FLOAT", &request_time_float, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); + ZVAL_DOUBLE(&request_time_float, sapi_get_request_time()); + php_register_variable_ex("REQUEST_TIME_FLOAT", &request_time_float, &PG(http_globals)[TRACK_VARS_SERVER]); ZVAL_LONG(&request_time_long, zend_dval_to_lval(Z_DVAL(request_time_float))); - php_register_variable_ex("REQUEST_TIME", &request_time_long, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); + php_register_variable_ex("REQUEST_TIME", &request_time_long, &PG(http_globals)[TRACK_VARS_SERVER]); } } @@ -619,7 +619,7 @@ static inline void php_register_server_variables(TSRMLS_D) /* {{{ php_autoglobal_merge */ -static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) +static void php_autoglobal_merge(HashTable *dest, HashTable *src) { zval *src_entry, *dest_entry; zend_string *string_key; @@ -646,7 +646,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) } } else { SEPARATE_ZVAL(dest_entry); - php_autoglobal_merge(Z_ARRVAL_P(dest_entry), Z_ARRVAL_P(src_entry) TSRMLS_CC); + php_autoglobal_merge(Z_ARRVAL_P(dest_entry), Z_ARRVAL_P(src_entry)); } } ZEND_HASH_FOREACH_END(); } @@ -654,21 +654,21 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) /* {{{ php_hash_environment */ -PHPAPI int php_hash_environment(TSRMLS_D) +PHPAPI int php_hash_environment(void) { memset(PG(http_globals), 0, sizeof(PG(http_globals))); - zend_activate_auto_globals(TSRMLS_C); + zend_activate_auto_globals(); if (PG(register_argc_argv)) { - php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); + php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER]); } return SUCCESS; } /* }}} */ -static zend_bool php_auto_globals_create_get(zend_string *name TSRMLS_DC) +static zend_bool php_auto_globals_create_get(zend_string *name) { if (PG(variables_order) && (strchr(PG(variables_order),'G') || strchr(PG(variables_order),'g'))) { - sapi_module.treat_data(PARSE_GET, NULL, NULL TSRMLS_CC); + sapi_module.treat_data(PARSE_GET, NULL, NULL); } else { zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_GET]); array_init(&PG(http_globals)[TRACK_VARS_GET]); @@ -680,14 +680,14 @@ static zend_bool php_auto_globals_create_get(zend_string *name TSRMLS_DC) return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_post(zend_string *name TSRMLS_DC) +static zend_bool php_auto_globals_create_post(zend_string *name) { if (PG(variables_order) && (strchr(PG(variables_order),'P') || strchr(PG(variables_order),'p')) && !SG(headers_sent) && SG(request_info).request_method && !strcasecmp(SG(request_info).request_method, "POST")) { - sapi_module.treat_data(PARSE_POST, NULL, NULL TSRMLS_CC); + sapi_module.treat_data(PARSE_POST, NULL, NULL); } else { zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_POST]); array_init(&PG(http_globals)[TRACK_VARS_POST]); @@ -699,10 +699,10 @@ static zend_bool php_auto_globals_create_post(zend_string *name TSRMLS_DC) return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_cookie(zend_string *name TSRMLS_DC) +static zend_bool php_auto_globals_create_cookie(zend_string *name) { if (PG(variables_order) && (strchr(PG(variables_order),'C') || strchr(PG(variables_order),'c'))) { - sapi_module.treat_data(PARSE_COOKIE, NULL, NULL TSRMLS_CC); + sapi_module.treat_data(PARSE_COOKIE, NULL, NULL); } else { zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_COOKIE]); array_init(&PG(http_globals)[TRACK_VARS_COOKIE]); @@ -714,7 +714,7 @@ static zend_bool php_auto_globals_create_cookie(zend_string *name TSRMLS_DC) return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_files(zend_string *name TSRMLS_DC) +static zend_bool php_auto_globals_create_files(zend_string *name) { if (Z_TYPE(PG(http_globals)[TRACK_VARS_FILES]) == IS_UNDEF) { array_init(&PG(http_globals)[TRACK_VARS_FILES]); @@ -726,10 +726,10 @@ static zend_bool php_auto_globals_create_files(zend_string *name TSRMLS_DC) return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_server(zend_string *name TSRMLS_DC) +static zend_bool php_auto_globals_create_server(zend_string *name) { if (PG(variables_order) && (strchr(PG(variables_order),'S') || strchr(PG(variables_order),'s'))) { - php_register_server_variables(TSRMLS_C); + php_register_server_variables(); if (PG(register_argc_argv)) { if (SG(request_info).argc) { @@ -742,7 +742,7 @@ static zend_bool php_auto_globals_create_server(zend_string *name TSRMLS_DC) zend_hash_str_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "argc", sizeof("argc")-1, argc); } } else { - php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); + php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER]); } } @@ -757,13 +757,13 @@ static zend_bool php_auto_globals_create_server(zend_string *name TSRMLS_DC) return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_env(zend_string *name TSRMLS_DC) +static zend_bool php_auto_globals_create_env(zend_string *name) { zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_ENV]); array_init(&PG(http_globals)[TRACK_VARS_ENV]); if (PG(variables_order) && (strchr(PG(variables_order),'E') || strchr(PG(variables_order),'e'))) { - php_import_environment_variables(&PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC); + php_import_environment_variables(&PG(http_globals)[TRACK_VARS_ENV]); } zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_ENV]); @@ -772,7 +772,7 @@ static zend_bool php_auto_globals_create_env(zend_string *name TSRMLS_DC) return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_request(zend_string *name TSRMLS_DC) +static zend_bool php_auto_globals_create_request(zend_string *name) { zval form_variables; unsigned char _gpc_flags[3] = {0, 0, 0}; @@ -791,21 +791,21 @@ static zend_bool php_auto_globals_create_request(zend_string *name TSRMLS_DC) case 'g': case 'G': if (!_gpc_flags[0]) { - php_autoglobal_merge(Z_ARRVAL(form_variables), Z_ARRVAL(PG(http_globals)[TRACK_VARS_GET]) TSRMLS_CC); + php_autoglobal_merge(Z_ARRVAL(form_variables), Z_ARRVAL(PG(http_globals)[TRACK_VARS_GET])); _gpc_flags[0] = 1; } break; case 'p': case 'P': if (!_gpc_flags[1]) { - php_autoglobal_merge(Z_ARRVAL(form_variables), Z_ARRVAL(PG(http_globals)[TRACK_VARS_POST]) TSRMLS_CC); + php_autoglobal_merge(Z_ARRVAL(form_variables), Z_ARRVAL(PG(http_globals)[TRACK_VARS_POST])); _gpc_flags[1] = 1; } break; case 'c': case 'C': if (!_gpc_flags[2]) { - php_autoglobal_merge(Z_ARRVAL(form_variables), Z_ARRVAL(PG(http_globals)[TRACK_VARS_COOKIE]) TSRMLS_CC); + php_autoglobal_merge(Z_ARRVAL(form_variables), Z_ARRVAL(PG(http_globals)[TRACK_VARS_COOKIE])); _gpc_flags[2] = 1; } break; @@ -816,15 +816,15 @@ static zend_bool php_auto_globals_create_request(zend_string *name TSRMLS_DC) return 0; } -void php_startup_auto_globals(TSRMLS_D) +void php_startup_auto_globals(void) { - zend_register_auto_global(zend_string_init("_GET", sizeof("_GET")-1, 1), 0, php_auto_globals_create_get TSRMLS_CC); - zend_register_auto_global(zend_string_init("_POST", sizeof("_POST")-1, 1), 0, php_auto_globals_create_post TSRMLS_CC); - zend_register_auto_global(zend_string_init("_COOKIE", sizeof("_COOKIE")-1, 1), 0, php_auto_globals_create_cookie TSRMLS_CC); - zend_register_auto_global(zend_string_init("_SERVER", sizeof("_SERVER")-1, 1), PG(auto_globals_jit), php_auto_globals_create_server TSRMLS_CC); - zend_register_auto_global(zend_string_init("_ENV", sizeof("_ENV")-1, 1), PG(auto_globals_jit), php_auto_globals_create_env TSRMLS_CC); - zend_register_auto_global(zend_string_init("_REQUEST", sizeof("_REQUEST")-1, 1), PG(auto_globals_jit), php_auto_globals_create_request TSRMLS_CC); - zend_register_auto_global(zend_string_init("_FILES", sizeof("_FILES")-1, 1), 0, php_auto_globals_create_files TSRMLS_CC); + zend_register_auto_global(zend_string_init("_GET", sizeof("_GET")-1, 1), 0, php_auto_globals_create_get); + zend_register_auto_global(zend_string_init("_POST", sizeof("_POST")-1, 1), 0, php_auto_globals_create_post); + zend_register_auto_global(zend_string_init("_COOKIE", sizeof("_COOKIE")-1, 1), 0, php_auto_globals_create_cookie); + zend_register_auto_global(zend_string_init("_SERVER", sizeof("_SERVER")-1, 1), PG(auto_globals_jit), php_auto_globals_create_server); + zend_register_auto_global(zend_string_init("_ENV", sizeof("_ENV")-1, 1), PG(auto_globals_jit), php_auto_globals_create_env); + zend_register_auto_global(zend_string_init("_REQUEST", sizeof("_REQUEST")-1, 1), PG(auto_globals_jit), php_auto_globals_create_request); + zend_register_auto_global(zend_string_init("_FILES", sizeof("_FILES")-1, 1), 0, php_auto_globals_create_files); } /* diff --git a/main/php_variables.h b/main/php_variables.h index 08abeb5267..6c9ceaa277 100644 --- a/main/php_variables.h +++ b/main/php_variables.h @@ -34,14 +34,14 @@ #define PARSE_SESSION 6 BEGIN_EXTERN_C() -void php_startup_auto_globals(TSRMLS_D); -extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC); -PHPAPI void php_register_variable(char *var, char *val, zval *track_vars_array TSRMLS_DC); +void php_startup_auto_globals(void); +extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr); +PHPAPI void php_register_variable(char *var, char *val, zval *track_vars_array); /* binary-safe version */ -PHPAPI void php_register_variable_safe(char *var, char *val, size_t val_len, zval *track_vars_array TSRMLS_DC); -PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array TSRMLS_DC); +PHPAPI void php_register_variable_safe(char *var, char *val, size_t val_len, zval *track_vars_array); +PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array); -PHPAPI int php_hash_environment(TSRMLS_D); +PHPAPI int php_hash_environment(void); END_EXTERN_C() #define NUM_TRACK_VARS 6 diff --git a/main/rfc1867.c b/main/rfc1867.c index e8b15f8494..4ff6507465 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -41,13 +41,13 @@ #define DEBUG_FILE_UPLOAD ZEND_DEBUG -static int dummy_encoding_translation(TSRMLS_D) +static int dummy_encoding_translation(void) { return 0; } -static char *php_ap_getword(const zend_encoding *encoding, char **line, char stop TSRMLS_DC); -static char *php_ap_getword_conf(const zend_encoding *encoding, char *str TSRMLS_DC); +static char *php_ap_getword(const zend_encoding *encoding, char **line, char stop); +static char *php_ap_getword_conf(const zend_encoding *encoding, char *str); static php_rfc1867_encoding_translation_t php_rfc1867_encoding_translation = dummy_encoding_translation; static php_rfc1867_get_detect_order_t php_rfc1867_get_detect_order = NULL; @@ -56,9 +56,9 @@ static php_rfc1867_getword_t php_rfc1867_getword = php_ap_getword; static php_rfc1867_getword_conf_t php_rfc1867_getword_conf = php_ap_getword_conf; static php_rfc1867_basename_t php_rfc1867_basename = NULL; -PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra TSRMLS_DC) = NULL; +PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra) = NULL; -static void safe_php_register_variable(char *var, char *strval, size_t val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC); +static void safe_php_register_variable(char *var, char *strval, size_t val_len, zval *track_vars_array, zend_bool override_protection); /* The longest property name we use in an uploaded file array */ #define MAX_SIZE_OF_INDEX sizeof("[tmp_name]") @@ -76,7 +76,7 @@ static void safe_php_register_variable(char *var, char *strval, size_t val_len, #define UPLOAD_ERROR_F 7 /* Failed to write file to disk */ #define UPLOAD_ERROR_X 8 /* File upload stopped by extension */ -void php_rfc1867_register_constants(TSRMLS_D) /* {{{ */ +void php_rfc1867_register_constants(void) /* {{{ */ { REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_OK", UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT); REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_INI_SIZE", UPLOAD_ERROR_A, CONST_CS | CONST_PERSISTENT); @@ -89,7 +89,7 @@ void php_rfc1867_register_constants(TSRMLS_D) /* {{{ */ } /* }}} */ -static void normalize_protected_variable(char *varname TSRMLS_DC) /* {{{ */ +static void normalize_protected_variable(char *varname) /* {{{ */ { char *s = varname, *index = NULL, *indexend = NULL, *p; @@ -147,49 +147,49 @@ static void normalize_protected_variable(char *varname TSRMLS_DC) /* {{{ */ } /* }}} */ -static void add_protected_variable(char *varname TSRMLS_DC) /* {{{ */ +static void add_protected_variable(char *varname) /* {{{ */ { - normalize_protected_variable(varname TSRMLS_CC); + normalize_protected_variable(varname); zend_hash_str_add_empty_element(&PG(rfc1867_protected_variables), varname, strlen(varname)); } /* }}} */ -static zend_bool is_protected_variable(char *varname TSRMLS_DC) /* {{{ */ +static zend_bool is_protected_variable(char *varname) /* {{{ */ { - normalize_protected_variable(varname TSRMLS_CC); + normalize_protected_variable(varname); return zend_hash_str_exists(&PG(rfc1867_protected_variables), varname, strlen(varname)); } /* }}} */ -static void safe_php_register_variable(char *var, char *strval, size_t val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */ +static void safe_php_register_variable(char *var, char *strval, size_t val_len, zval *track_vars_array, zend_bool override_protection) /* {{{ */ { - if (override_protection || !is_protected_variable(var TSRMLS_CC)) { - php_register_variable_safe(var, strval, val_len, track_vars_array TSRMLS_CC); + if (override_protection || !is_protected_variable(var)) { + php_register_variable_safe(var, strval, val_len, track_vars_array); } } /* }}} */ -static void safe_php_register_variable_ex(char *var, zval *val, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */ +static void safe_php_register_variable_ex(char *var, zval *val, zval *track_vars_array, zend_bool override_protection) /* {{{ */ { - if (override_protection || !is_protected_variable(var TSRMLS_CC)) { - php_register_variable_ex(var, val, track_vars_array TSRMLS_CC); + if (override_protection || !is_protected_variable(var)) { + php_register_variable_ex(var, val, track_vars_array); } } /* }}} */ -static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC) /* {{{ */ +static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files, zend_bool override_protection) /* {{{ */ { - safe_php_register_variable(strvar, val, strlen(val), http_post_files, override_protection TSRMLS_CC); + safe_php_register_variable(strvar, val, strlen(val), http_post_files, override_protection); } /* }}} */ -static void register_http_post_files_variable_ex(char *var, zval *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC) /* {{{ */ +static void register_http_post_files_variable_ex(char *var, zval *val, zval *http_post_files, zend_bool override_protection) /* {{{ */ { - safe_php_register_variable_ex(var, val, http_post_files, override_protection TSRMLS_CC); + safe_php_register_variable_ex(var, val, http_post_files, override_protection); } /* }}} */ -static int unlink_filename(zval *el TSRMLS_DC) /* {{{ */ +static int unlink_filename(zval *el) /* {{{ */ { char *filename = (char*)Z_PTR_P(el); VCWD_UNLINK(filename); @@ -203,9 +203,9 @@ static void free_filename(zval *el) { efree(filename); } -void destroy_uploaded_files_hash(TSRMLS_D) /* {{{ */ +void destroy_uploaded_files_hash(void) /* {{{ */ { - zend_hash_apply(SG(rfc1867_uploaded_files), unlink_filename TSRMLS_CC); + zend_hash_apply(SG(rfc1867_uploaded_files), unlink_filename); zend_hash_destroy(SG(rfc1867_uploaded_files)); FREE_HASHTABLE(SG(rfc1867_uploaded_files)); } @@ -242,7 +242,7 @@ typedef struct { * Fill up the buffer with client data. * Returns number of bytes added to buffer. */ -static int fill_buffer(multipart_buffer *self TSRMLS_DC) +static int fill_buffer(multipart_buffer *self) { int bytes_to_read, total_read = 0, actual_read = 0; @@ -261,7 +261,7 @@ static int fill_buffer(multipart_buffer *self TSRMLS_DC) char *buf = self->buffer + self->bytes_in_buffer; - actual_read = (int)sapi_module.read_post(buf, bytes_to_read TSRMLS_CC); + actual_read = (int)sapi_module.read_post(buf, bytes_to_read); /* update the buffer length */ if (actual_read > 0) { @@ -278,9 +278,9 @@ static int fill_buffer(multipart_buffer *self TSRMLS_DC) } /* eof if we are out of bytes, or if we hit the final boundary */ -static int multipart_buffer_eof(multipart_buffer *self TSRMLS_DC) +static int multipart_buffer_eof(multipart_buffer *self) { - if ( (self->bytes_in_buffer == 0 && fill_buffer(self TSRMLS_CC) < 1) ) { + if ( (self->bytes_in_buffer == 0 && fill_buffer(self) < 1) ) { return 1; } else { return 0; @@ -288,7 +288,7 @@ static int multipart_buffer_eof(multipart_buffer *self TSRMLS_DC) } /* create new multipart_buffer structure */ -static multipart_buffer *multipart_buffer_new(char *boundary, int boundary_len TSRMLS_DC) +static multipart_buffer *multipart_buffer_new(char *boundary, int boundary_len) { multipart_buffer *self = (multipart_buffer *) ecalloc(1, sizeof(multipart_buffer)); @@ -305,8 +305,8 @@ static multipart_buffer *multipart_buffer_new(char *boundary, int boundary_len T self->buf_begin = self->buffer; self->bytes_in_buffer = 0; - if (php_rfc1867_encoding_translation(TSRMLS_C)) { - php_rfc1867_get_detect_order(&self->detect_order, &self->detect_order_size TSRMLS_CC); + if (php_rfc1867_encoding_translation()) { + php_rfc1867_get_detect_order(&self->detect_order, &self->detect_order_size); } else { self->detect_order = NULL; self->detect_order_size = 0; @@ -363,12 +363,12 @@ static char *next_line(multipart_buffer *self) } /* Returns the next CRLF terminated line from the client */ -static char *get_line(multipart_buffer *self TSRMLS_DC) +static char *get_line(multipart_buffer *self) { char* ptr = next_line(self); if (!ptr) { - fill_buffer(self TSRMLS_CC); + fill_buffer(self); ptr = next_line(self); } @@ -387,12 +387,12 @@ static void php_free_hdr_entry(mime_header_entry *h) } /* finds a boundary */ -static int find_boundary(multipart_buffer *self, char *boundary TSRMLS_DC) +static int find_boundary(multipart_buffer *self, char *boundary) { char *line; /* loop thru lines */ - while( (line = get_line(self TSRMLS_CC)) ) + while( (line = get_line(self)) ) { /* finished if we found the boundary */ if (!strcmp(line, boundary)) { @@ -405,27 +405,27 @@ static int find_boundary(multipart_buffer *self, char *boundary TSRMLS_DC) } /* parse headers */ -static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header TSRMLS_DC) +static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header) { char *line; mime_header_entry prev_entry = {0}, entry; int prev_len, cur_len; /* didn't find boundary, abort */ - if (!find_boundary(self, self->boundary TSRMLS_CC)) { + if (!find_boundary(self, self->boundary)) { return 0; } /* get lines of text, or CRLF_CRLF */ - while( (line = get_line(self TSRMLS_CC)) && line[0] != '\0' ) + while( (line = get_line(self)) && line[0] != '\0' ) { /* add header to table */ char *key = line; char *value = NULL; - if (php_rfc1867_encoding_translation(TSRMLS_C)) { - self->input_encoding = zend_multibyte_encoding_detector(line, strlen(line), self->detect_order, self->detect_order_size TSRMLS_CC); + if (php_rfc1867_encoding_translation()) { + self->input_encoding = zend_multibyte_encoding_detector(line, strlen(line), self->detect_order, self->detect_order_size); } /* space in the beginning means same header */ @@ -483,7 +483,7 @@ static char *php_mime_get_hdr_value(zend_llist header, char *key) return NULL; } -static char *php_ap_getword(const zend_encoding *encoding, char **line, char stop TSRMLS_DC) +static char *php_ap_getword(const zend_encoding *encoding, char **line, char stop) { char *pos = *line, quote; char *res; @@ -537,7 +537,7 @@ static char *substring_conf(char *start, int len, char quote) return result; } -static char *php_ap_getword_conf(const zend_encoding *encoding, char *str TSRMLS_DC) +static char *php_ap_getword_conf(const zend_encoding *encoding, char *str) { while (*str && isspace(*str)) { ++str; @@ -562,7 +562,7 @@ static char *php_ap_getword_conf(const zend_encoding *encoding, char *str TSRMLS } } -static char *php_ap_basename(const zend_encoding *encoding, char *path TSRMLS_DC) +static char *php_ap_basename(const zend_encoding *encoding, char *path) { char *s = strrchr(path, '\\'); char *s2 = strrchr(path, '/'); @@ -611,14 +611,14 @@ static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int ne } /* read until a boundary condition */ -static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end TSRMLS_DC) +static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end) { size_t len, max; char *bound; /* fill buffer if needed */ if (bytes > self->bytes_in_buffer) { - fill_buffer(self TSRMLS_CC); + fill_buffer(self); } /* look for a potential boundary match, only read data up to that point */ @@ -657,12 +657,12 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes XXX: this is horrible memory-usage-wise, but we only expect to do this on small pieces of form data. */ -static char *multipart_buffer_read_body(multipart_buffer *self, size_t *len TSRMLS_DC) +static char *multipart_buffer_read_body(multipart_buffer *self, size_t *len) { char buf[FILLUNIT], *out=NULL; int total_bytes=0, read_bytes=0; - while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL TSRMLS_CC))) { + while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL))) { out = erealloc(out, total_bytes + read_bytes + 1); memcpy(out + total_bytes, buf, read_bytes); total_bytes += read_bytes; @@ -697,13 +697,13 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ void *event_extra_data = NULL; unsigned int llen = 0; int upload_cnt = INI_INT("max_file_uploads"); - const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding(TSRMLS_C); + const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding(); php_rfc1867_getword_t getword; php_rfc1867_getword_conf_t getword_conf; php_rfc1867_basename_t _basename; zend_long count = 0; - if (php_rfc1867_encoding_translation(TSRMLS_C) && internal_encoding) { + if (php_rfc1867_encoding_translation() && internal_encoding) { getword = php_rfc1867_getword; getword_conf = php_rfc1867_getword_conf; _basename = php_rfc1867_basename; @@ -757,7 +757,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } /* Initialize the buffer */ - if (!(mbuff = multipart_buffer_new(boundary, boundary_len TSRMLS_CC))) { + if (!(mbuff = multipart_buffer_new(boundary, boundary_len))) { sapi_module.sapi_error(E_WARNING, "Unable to initialize the input buffer"); return; } @@ -777,12 +777,12 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ multipart_event_start event_start; event_start.content_length = SG(request_info).content_length; - if (php_rfc1867_callback(MULTIPART_EVENT_START, &event_start, &event_extra_data TSRMLS_CC) == FAILURE) { + if (php_rfc1867_callback(MULTIPART_EVENT_START, &event_start, &event_extra_data) == FAILURE) { goto fileupload_done; } } - while (!multipart_buffer_eof(mbuff TSRMLS_CC)) + while (!multipart_buffer_eof(mbuff)) { char buff[FILLUNIT]; char *cd = NULL, *param = NULL, *filename = NULL, *tmp = NULL; @@ -791,7 +791,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ zend_llist_clean(&header); - if (!multipart_buffer_headers(mbuff, &header TSRMLS_CC)) { + if (!multipart_buffer_headers(mbuff, &header)) { goto fileupload_done; } @@ -803,7 +803,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ ++cd; } - while (*cd && (pair = getword(mbuff->input_encoding, &cd, ';' TSRMLS_CC))) + while (*cd && (pair = getword(mbuff->input_encoding, &cd, ';'))) { char *key = NULL, *word = pair; @@ -812,17 +812,17 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } if (strchr(pair, '=')) { - key = getword(mbuff->input_encoding, &pair, '=' TSRMLS_CC); + key = getword(mbuff->input_encoding, &pair, '='); if (!strcasecmp(key, "name")) { if (param) { efree(param); } - param = getword_conf(mbuff->input_encoding, pair TSRMLS_CC); + param = getword_conf(mbuff->input_encoding, pair); if (mbuff->input_encoding && internal_encoding) { unsigned char *new_param; size_t new_param_len; - if ((size_t)-1 != zend_multibyte_encoding_converter(&new_param, &new_param_len, (unsigned char *)param, strlen(param), internal_encoding, mbuff->input_encoding TSRMLS_CC)) { + if ((size_t)-1 != zend_multibyte_encoding_converter(&new_param, &new_param_len, (unsigned char *)param, strlen(param), internal_encoding, mbuff->input_encoding)) { efree(param); param = (char *)new_param; } @@ -831,11 +831,11 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ if (filename) { efree(filename); } - filename = getword_conf(mbuff->input_encoding, pair TSRMLS_CC); + filename = getword_conf(mbuff->input_encoding, pair); if (mbuff->input_encoding && internal_encoding) { unsigned char *new_filename; size_t new_filename_len; - if ((size_t)-1 != zend_multibyte_encoding_converter(&new_filename, &new_filename_len, (unsigned char *)filename, strlen(filename), internal_encoding, mbuff->input_encoding TSRMLS_CC)) { + if ((size_t)-1 != zend_multibyte_encoding_converter(&new_filename, &new_filename_len, (unsigned char *)filename, strlen(filename), internal_encoding, mbuff->input_encoding)) { efree(filename); filename = (char *)new_filename; } @@ -851,7 +851,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ /* Normal form variable, safe to read all data into memory */ if (!filename && param) { size_t value_len; - char *value = multipart_buffer_read_body(mbuff, &value_len TSRMLS_CC); + char *value = multipart_buffer_read_body(mbuff, &value_len); size_t new_val_len; /* Dummy variable */ if (!value) { @@ -862,14 +862,14 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ if (mbuff->input_encoding && internal_encoding) { unsigned char *new_value; size_t new_value_len; - if ((size_t)-1 != zend_multibyte_encoding_converter(&new_value, &new_value_len, (unsigned char *)value, value_len, internal_encoding, mbuff->input_encoding TSRMLS_CC)) { + if ((size_t)-1 != zend_multibyte_encoding_converter(&new_value, &new_value_len, (unsigned char *)value, value_len, internal_encoding, mbuff->input_encoding)) { efree(value); value = (char *)new_value; value_len = new_value_len; } } - if (++count <= PG(max_input_vars) && sapi_module.input_filter(PARSE_POST, param, &value, value_len, &new_val_len TSRMLS_CC)) { + if (++count <= PG(max_input_vars) && sapi_module.input_filter(PARSE_POST, param, &value, value_len, &new_val_len)) { if (php_rfc1867_callback != NULL) { multipart_event_formdata event_formdata; size_t newlength = new_val_len; @@ -879,17 +879,17 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ event_formdata.value = &value; event_formdata.length = new_val_len; event_formdata.newlength = &newlength; - if (php_rfc1867_callback(MULTIPART_EVENT_FORMDATA, &event_formdata, &event_extra_data TSRMLS_CC) == FAILURE) { + if (php_rfc1867_callback(MULTIPART_EVENT_FORMDATA, &event_formdata, &event_extra_data) == FAILURE) { efree(param); efree(value); continue; } new_val_len = newlength; } - safe_php_register_variable(param, value, new_val_len, array_ptr, 0 TSRMLS_CC); + safe_php_register_variable(param, value, new_val_len, array_ptr, 0); } else { if (count == PG(max_input_vars) + 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); + php_error_docref(NULL, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); } if (php_rfc1867_callback != NULL) { @@ -900,7 +900,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ event_formdata.value = &value; event_formdata.length = value_len; event_formdata.newlength = NULL; - php_rfc1867_callback(MULTIPART_EVENT_FORMDATA, &event_formdata, &event_extra_data TSRMLS_CC); + php_rfc1867_callback(MULTIPART_EVENT_FORMDATA, &event_formdata, &event_extra_data); } } @@ -976,7 +976,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ event_file_start.post_bytes_processed = SG(read_post_bytes); event_file_start.name = param; event_file_start.filename = &filename; - if (php_rfc1867_callback(MULTIPART_EVENT_FILE_START, &event_file_start, &event_extra_data TSRMLS_CC) == FAILURE) { + if (php_rfc1867_callback(MULTIPART_EVENT_FILE_START, &event_file_start, &event_extra_data) == FAILURE) { temp_filename = ""; efree(param); efree(filename); @@ -1002,14 +1002,14 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ if (!cancel_upload) { /* only bother to open temp file if we have data */ - blen = multipart_buffer_read(mbuff, buff, sizeof(buff), &end TSRMLS_CC); + blen = multipart_buffer_read(mbuff, buff, sizeof(buff), &end); #if DEBUG_FILE_UPLOAD if (blen > 0) { #else /* in non-debug mode we have no problem with 0-length files */ { #endif - fd = php_open_temporary_fd_ex(PG(upload_tmp_dir), "php", &temp_filename, 1 TSRMLS_CC); + fd = php_open_temporary_fd_ex(PG(upload_tmp_dir), "php", &temp_filename, 1); upload_cnt--; if (fd == -1) { sapi_module.sapi_error(E_WARNING, "File upload error - unable to create a temporary file"); @@ -1028,7 +1028,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ event_file_data.data = buff; event_file_data.length = blen; event_file_data.newlength = &blen; - if (php_rfc1867_callback(MULTIPART_EVENT_FILE_DATA, &event_file_data, &event_extra_data TSRMLS_CC) == FAILURE) { + if (php_rfc1867_callback(MULTIPART_EVENT_FILE_DATA, &event_file_data, &event_extra_data) == FAILURE) { cancel_upload = UPLOAD_ERROR_X; continue; } @@ -1069,7 +1069,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } /* read data for next iteration */ - blen = multipart_buffer_read(mbuff, buff, sizeof(buff), &end TSRMLS_CC); + blen = multipart_buffer_read(mbuff, buff, sizeof(buff), &end); } if (fd != -1) { /* may not be initialized if file could not be created */ @@ -1094,7 +1094,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ event_file_end.post_bytes_processed = SG(read_post_bytes); event_file_end.temp_filename = temp_filename; event_file_end.cancel_upload = cancel_upload; - if (php_rfc1867_callback(MULTIPART_EVENT_FILE_END, &event_file_end, &event_extra_data TSRMLS_CC) == FAILURE) { + if (php_rfc1867_callback(MULTIPART_EVENT_FILE_END, &event_file_end, &event_extra_data) == FAILURE) { cancel_upload = UPLOAD_ERROR_X; } } @@ -1144,13 +1144,13 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ * the full path of the file on the user's filesystem, which means that unless * the user does basename() they get a bogus file name. Until IE's user base drops * to nill or problem is fixed this code must remain enabled for all systems. */ - s = _basename(internal_encoding, filename TSRMLS_CC); + s = _basename(internal_encoding, filename); if (!s) { s = filename; } if (!is_anonymous) { - safe_php_register_variable(lbuf, s, strlen(s), NULL, 0 TSRMLS_CC); + safe_php_register_variable(lbuf, s, strlen(s), NULL, 0); } /* Add $foo[name] */ @@ -1159,7 +1159,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } else { snprintf(lbuf, llen, "%s[name]", param); } - register_http_post_files_variable(lbuf, s, &PG(http_globals)[TRACK_VARS_FILES], 0 TSRMLS_CC); + register_http_post_files_variable(lbuf, s, &PG(http_globals)[TRACK_VARS_FILES], 0); efree(filename); s = NULL; @@ -1181,7 +1181,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ snprintf(lbuf, llen, "%s_type", param); } if (!is_anonymous) { - safe_php_register_variable(lbuf, cd, strlen(cd), NULL, 0 TSRMLS_CC); + safe_php_register_variable(lbuf, cd, strlen(cd), NULL, 0); } /* Add $foo[type] */ @@ -1190,7 +1190,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } else { snprintf(lbuf, llen, "%s[type]", param); } - register_http_post_files_variable(lbuf, cd, &PG(http_globals)[TRACK_VARS_FILES], 0 TSRMLS_CC); + register_http_post_files_variable(lbuf, cd, &PG(http_globals)[TRACK_VARS_FILES], 0); /* Restore Content-Type Header */ if (s != NULL) { @@ -1204,12 +1204,12 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ zval zfilename; /* Initialize variables */ - add_protected_variable(param TSRMLS_CC); + add_protected_variable(param); /* if param is of form xxx[.*] this will cut it to xxx */ if (!is_anonymous) { ZVAL_STRING(&zfilename, temp_filename); - safe_php_register_variable_ex(param, &zfilename, NULL, 1 TSRMLS_CC); + safe_php_register_variable_ex(param, &zfilename, NULL, 1); } /* Add $foo[tmp_name] */ @@ -1218,9 +1218,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } else { snprintf(lbuf, llen, "%s[tmp_name]", param); } - add_protected_variable(lbuf TSRMLS_CC); + add_protected_variable(lbuf); ZVAL_STRING(&zfilename, temp_filename); - register_http_post_files_variable_ex(lbuf, &zfilename, &PG(http_globals)[TRACK_VARS_FILES], 1 TSRMLS_CC); + register_http_post_files_variable_ex(lbuf, &zfilename, &PG(http_globals)[TRACK_VARS_FILES], 1); } { @@ -1258,7 +1258,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } else { snprintf(lbuf, llen, "%s[error]", param); } - register_http_post_files_variable_ex(lbuf, &error_type, &PG(http_globals)[TRACK_VARS_FILES], 0 TSRMLS_CC); + register_http_post_files_variable_ex(lbuf, &error_type, &PG(http_globals)[TRACK_VARS_FILES], 0); /* Add $foo_size */ if (is_arr_upload) { @@ -1270,7 +1270,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ if (size_overflow) { ZVAL_STRING(&file_size, file_size_buf); } - safe_php_register_variable_ex(lbuf, &file_size, NULL, size_overflow TSRMLS_CC); + safe_php_register_variable_ex(lbuf, &file_size, NULL, size_overflow); } /* Add $foo[size] */ @@ -1282,7 +1282,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ if (size_overflow) { ZVAL_STRING(&file_size, file_size_buf); } - register_http_post_files_variable_ex(lbuf, &file_size, &PG(http_globals)[TRACK_VARS_FILES], size_overflow TSRMLS_CC); + register_http_post_files_variable_ex(lbuf, &file_size, &PG(http_globals)[TRACK_VARS_FILES], size_overflow); } efree(param); } @@ -1293,7 +1293,7 @@ fileupload_done: multipart_event_end event_end; event_end.post_bytes_processed = SG(read_post_bytes); - php_rfc1867_callback(MULTIPART_EVENT_END, &event_end, &event_extra_data TSRMLS_CC); + php_rfc1867_callback(MULTIPART_EVENT_END, &event_end, &event_extra_data); } if (lbuf) efree(lbuf); diff --git a/main/rfc1867.h b/main/rfc1867.h index ab5f50f8d6..8df4fa8b52 100644 --- a/main/rfc1867.h +++ b/main/rfc1867.h @@ -67,18 +67,18 @@ typedef struct _multipart_event_end { size_t post_bytes_processed; } multipart_event_end; -typedef int (*php_rfc1867_encoding_translation_t)(TSRMLS_D); -typedef void (*php_rfc1867_get_detect_order_t)(const zend_encoding ***list, size_t *list_size TSRMLS_DC); -typedef void (*php_rfc1867_set_input_encoding_t)(const zend_encoding *encoding TSRMLS_DC); -typedef char* (*php_rfc1867_getword_t)(const zend_encoding *encoding, char **line, char stop TSRMLS_DC); -typedef char* (*php_rfc1867_getword_conf_t)(const zend_encoding *encoding, char *str TSRMLS_DC); -typedef char* (*php_rfc1867_basename_t)(const zend_encoding *encoding, char *str TSRMLS_DC); +typedef int (*php_rfc1867_encoding_translation_t)(void); +typedef void (*php_rfc1867_get_detect_order_t)(const zend_encoding ***list, size_t *list_size); +typedef void (*php_rfc1867_set_input_encoding_t)(const zend_encoding *encoding); +typedef char* (*php_rfc1867_getword_t)(const zend_encoding *encoding, char **line, char stop); +typedef char* (*php_rfc1867_getword_conf_t)(const zend_encoding *encoding, char *str); +typedef char* (*php_rfc1867_basename_t)(const zend_encoding *encoding, char *str); SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler); -void destroy_uploaded_files_hash(TSRMLS_D); -void php_rfc1867_register_constants(TSRMLS_D); -extern PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra TSRMLS_DC); +void destroy_uploaded_files_hash(void); +void php_rfc1867_register_constants(void); +extern PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra); SAPI_API void php_rfc1867_set_multibyte_callbacks( php_rfc1867_encoding_translation_t encoding_translation, diff --git a/main/snprintf.c b/main/snprintf.c index 7e4d8a11ab..b9867ebcee 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -796,9 +796,8 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / */ switch (*fmt) { case 'Z': { - TSRMLS_FETCH(); - zvp = (zval*) va_arg(ap, zval*); - free_zcopy = zend_make_printable_zval(zvp, &zcopy TSRMLS_CC); + zvp = (zval*) va_arg(ap, zval*); + free_zcopy = zend_make_printable_zval(zvp, &zcopy); if (free_zcopy) { zvp = &zcopy; } diff --git a/main/spprintf.c b/main/spprintf.c index ee73d4f4e5..f860ee3dff 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -410,9 +410,8 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt */ switch (*fmt) { case 'Z': { - TSRMLS_FETCH(); - zvp = (zval*) va_arg(ap, zval*); - free_zcopy = zend_make_printable_zval(zvp, &zcopy TSRMLS_CC); + zvp = (zval*) va_arg(ap, zval*); + free_zcopy = zend_make_printable_zval(zvp, &zcopy); if (free_zcopy) { zvp = &zcopy; } diff --git a/main/streams/cast.c b/main/streams/cast.c index 3291a9ca8f..83236fa47f 100644 --- a/main/streams/cast.c +++ b/main/streams/cast.c @@ -63,7 +63,6 @@ FILE *fopencookie(void *cookie, const char *mode, COOKIE_IO_FUNCTIONS_T *funcs) static int stream_cookie_reader(void *cookie, char *buffer, int size) { int ret; - TSRMLS_FETCH(); ret = php_stream_read((php_stream*)cookie, buffer, size); return ret; @@ -71,14 +70,12 @@ static int stream_cookie_reader(void *cookie, char *buffer, int size) static int stream_cookie_writer(void *cookie, const char *buffer, int size) { - TSRMLS_FETCH(); return php_stream_write((php_stream *)cookie, (char *)buffer, size); } static PHP_FPOS_T stream_cookie_seeker(void *cookie, zend_off_t position, int whence) { - TSRMLS_FETCH(); return (PHP_FPOS_T)php_stream_seek((php_stream *)cookie, position, whence); } @@ -86,7 +83,6 @@ static PHP_FPOS_T stream_cookie_seeker(void *cookie, zend_off_t position, int wh static int stream_cookie_closer(void *cookie) { php_stream *stream = (php_stream*)cookie; - TSRMLS_FETCH(); /* prevent recursion */ stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE; @@ -96,7 +92,6 @@ static int stream_cookie_closer(void *cookie) static ssize_t stream_cookie_reader(void *cookie, char *buffer, size_t size) { ssize_t ret; - TSRMLS_FETCH(); ret = php_stream_read(((php_stream *)cookie), buffer, size); return ret; @@ -104,7 +99,6 @@ static ssize_t stream_cookie_reader(void *cookie, char *buffer, size_t size) static ssize_t stream_cookie_writer(void *cookie, const char *buffer, size_t size) { - TSRMLS_FETCH(); return php_stream_write(((php_stream *)cookie), (char *)buffer, size); } @@ -112,7 +106,6 @@ static ssize_t stream_cookie_writer(void *cookie, const char *buffer, size_t siz # ifdef COOKIE_SEEKER_USES_OFF64_T static int stream_cookie_seeker(void *cookie, __off64_t *position, int whence) { - TSRMLS_FETCH(); *position = php_stream_seek((php_stream *)cookie, (zend_off_t)*position, whence); @@ -124,7 +117,6 @@ static int stream_cookie_seeker(void *cookie, __off64_t *position, int whence) # else static int stream_cookie_seeker(void *cookie, zend_off_t position, int whence) { - TSRMLS_FETCH(); return php_stream_seek((php_stream *)cookie, position, whence); } @@ -133,7 +125,6 @@ static int stream_cookie_seeker(void *cookie, zend_off_t position, int whence) static int stream_cookie_closer(void *cookie) { php_stream *stream = (php_stream*)cookie; - TSRMLS_FETCH(); /* prevent recursion */ stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE; @@ -197,7 +188,7 @@ void php_stream_mode_sanitize_fdopen_fopencookie(php_stream *stream, char *resul /* }}} */ /* {{{ php_stream_cast */ -PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show_err TSRMLS_DC) +PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show_err) { int flags = castas & PHP_STREAM_CAST_MASK; castas &= ~PHP_STREAM_CAST_MASK; @@ -208,7 +199,7 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) { zend_off_t dummy; - stream->ops->seek(stream, stream->position, SEEK_SET, &dummy TSRMLS_CC); + stream->ops->seek(stream, stream->position, SEEK_SET, &dummy); stream->readpos = stream->writepos = 0; } } @@ -228,7 +219,7 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show if (php_stream_is(stream, PHP_STREAM_IS_STDIO) && stream->ops->cast && !php_stream_is_filtered(stream) && - stream->ops->cast(stream, castas, ret TSRMLS_CC) == SUCCESS + stream->ops->cast(stream, castas, ret) == SUCCESS ) { goto exit_success; } @@ -265,12 +256,12 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show b) no memory -> lets bail */ - php_error_docref(NULL TSRMLS_CC, E_ERROR, "fopencookie failed"); + php_error_docref(NULL, E_ERROR, "fopencookie failed"); return FAILURE; #endif - if (!php_stream_is_filtered(stream) && stream->ops->cast && stream->ops->cast(stream, castas, NULL TSRMLS_CC) == SUCCESS) { - if (FAILURE == stream->ops->cast(stream, castas, ret TSRMLS_CC)) { + if (!php_stream_is_filtered(stream) && stream->ops->cast && stream->ops->cast(stream, castas, NULL) == SUCCESS) { + if (FAILURE == stream->ops->cast(stream, castas, ret)) { return FAILURE; } goto exit_success; @@ -304,9 +295,9 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show } if (php_stream_is_filtered(stream)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot cast a filtered stream on this system"); + php_error_docref(NULL, E_WARNING, "cannot cast a filtered stream on this system"); return FAILURE; - } else if (stream->ops->cast && stream->ops->cast(stream, castas, ret TSRMLS_CC) == SUCCESS) { + } else if (stream->ops->cast && stream->ops->cast(stream, castas, ret) == SUCCESS) { goto exit_success; } @@ -319,7 +310,7 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show "select()able descriptor" }; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot represent a stream of type %s as a %s", stream->ops->label, cast_names[castas]); + php_error_docref(NULL, E_WARNING, "cannot represent a stream of type %s as a %s", stream->ops->label, cast_names[castas]); } return FAILURE; @@ -334,7 +325,7 @@ exit_success: * will be accessing the stream. Emit a warning so that the end-user will * know that they should try something else */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, ZEND_LONG_FMT " bytes of buffered data lost during stream conversion!", (zend_long)(stream->writepos - stream->readpos)); + php_error_docref(NULL, E_WARNING, ZEND_LONG_FMT " bytes of buffered data lost during stream conversion!", (zend_long)(stream->writepos - stream->readpos)); } if (castas == PHP_STREAM_AS_STDIO && ret) { @@ -351,7 +342,7 @@ exit_success: /* }}} */ /* {{{ php_stream_open_wrapper_as_file */ -PHPAPI FILE * _php_stream_open_wrapper_as_file(char *path, char *mode, int options, char **opened_path STREAMS_DC TSRMLS_DC) +PHPAPI FILE * _php_stream_open_wrapper_as_file(char *path, char *mode, int options, char **opened_path STREAMS_DC) { FILE *fp = NULL; php_stream *stream = NULL; @@ -374,7 +365,7 @@ PHPAPI FILE * _php_stream_open_wrapper_as_file(char *path, char *mode, int optio /* }}} */ /* {{{ php_stream_make_seekable */ -PHPAPI int _php_stream_make_seekable(php_stream *origstream, php_stream **newstream, int flags STREAMS_DC TSRMLS_DC) +PHPAPI int _php_stream_make_seekable(php_stream *origstream, php_stream **newstream, int flags STREAMS_DC) { if (newstream == NULL) { return PHP_STREAM_FAILED; diff --git a/main/streams/filter.c b/main/streams/filter.c index 56e388403d..62d27e5ee7 100644 --- a/main/streams/filter.c +++ b/main/streams/filter.c @@ -38,24 +38,24 @@ PHPAPI HashTable *php_get_stream_filters_hash_global(void) } /* Normal hash selection/retrieval call */ -PHPAPI HashTable *_php_get_stream_filters_hash(TSRMLS_D) +PHPAPI HashTable *_php_get_stream_filters_hash(void) { return (FG(stream_filters) ? FG(stream_filters) : &stream_filters_hash); } /* API for registering GLOBAL filters */ -PHPAPI int php_stream_filter_register_factory(const char *filterpattern, php_stream_filter_factory *factory TSRMLS_DC) +PHPAPI int php_stream_filter_register_factory(const char *filterpattern, php_stream_filter_factory *factory) { return zend_hash_str_add_ptr(&stream_filters_hash, filterpattern, strlen(filterpattern), factory) ? SUCCESS : FAILURE; } -PHPAPI int php_stream_filter_unregister_factory(const char *filterpattern TSRMLS_DC) +PHPAPI int php_stream_filter_unregister_factory(const char *filterpattern) { return zend_hash_str_del(&stream_filters_hash, filterpattern, strlen(filterpattern)); } /* API for registering VOLATILE wrappers */ -PHPAPI int php_stream_filter_register_factory_volatile(const char *filterpattern, php_stream_filter_factory *factory TSRMLS_DC) +PHPAPI int php_stream_filter_register_factory_volatile(const char *filterpattern, php_stream_filter_factory *factory) { if (!FG(stream_filters)) { ALLOC_HASHTABLE(FG(stream_filters)); @@ -68,7 +68,7 @@ PHPAPI int php_stream_filter_register_factory_volatile(const char *filterpattern /* Buckets */ -PHPAPI php_stream_bucket *php_stream_bucket_new(php_stream *stream, char *buf, size_t buflen, int own_buf, int buf_persistent TSRMLS_DC) +PHPAPI php_stream_bucket *php_stream_bucket_new(php_stream *stream, char *buf, size_t buflen, int own_buf, int buf_persistent) { int is_persistent = php_stream_is_persistent(stream); php_stream_bucket *bucket; @@ -112,11 +112,11 @@ PHPAPI php_stream_bucket *php_stream_bucket_new(php_stream *stream, char *buf, s * In both cases, the original bucket is unlinked from its brigade. * If a copy is made, the original bucket is delref'd. * */ -PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bucket TSRMLS_DC) +PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bucket) { php_stream_bucket *retval; - php_stream_bucket_unlink(bucket TSRMLS_CC); + php_stream_bucket_unlink(bucket); if (bucket->refcount == 1 && bucket->own_buf) { return bucket; @@ -131,12 +131,12 @@ PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bu retval->refcount = 1; retval->own_buf = 1; - php_stream_bucket_delref(bucket TSRMLS_CC); + php_stream_bucket_delref(bucket); return retval; } -PHPAPI int php_stream_bucket_split(php_stream_bucket *in, php_stream_bucket **left, php_stream_bucket **right, size_t length TSRMLS_DC) +PHPAPI int php_stream_bucket_split(php_stream_bucket *in, php_stream_bucket **left, php_stream_bucket **right, size_t length) { *left = (php_stream_bucket*)pecalloc(1, sizeof(php_stream_bucket), in->is_persistent); *right = (php_stream_bucket*)pecalloc(1, sizeof(php_stream_bucket), in->is_persistent); @@ -177,7 +177,7 @@ exit_fail: return FAILURE; } -PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket TSRMLS_DC) +PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket) { if (--bucket->refcount == 0) { if (bucket->own_buf) { @@ -187,7 +187,7 @@ PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket TSRMLS_DC) } } -PHPAPI void php_stream_bucket_prepend(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket TSRMLS_DC) +PHPAPI void php_stream_bucket_prepend(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket) { bucket->next = brigade->head; bucket->prev = NULL; @@ -201,7 +201,7 @@ PHPAPI void php_stream_bucket_prepend(php_stream_bucket_brigade *brigade, php_st bucket->brigade = brigade; } -PHPAPI void php_stream_bucket_append(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket TSRMLS_DC) +PHPAPI void php_stream_bucket_append(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket) { if (brigade->tail == bucket) { return; @@ -219,7 +219,7 @@ PHPAPI void php_stream_bucket_append(php_stream_bucket_brigade *brigade, php_str bucket->brigade = brigade; } -PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket TSRMLS_DC) +PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket) { if (bucket->prev) { bucket->prev->next = bucket->next; @@ -247,7 +247,7 @@ PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket TSRMLS_DC) * match. If that fails, we try "convert.charset.*", then "convert.*" * This means that we don't need to clog up the hashtable with a zillion * charsets (for example) but still be able to provide them all as filters */ -PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC) +PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval *filterparams, int persistent) { HashTable *filter_hash = (FG(stream_filters) ? FG(stream_filters) : &stream_filters_hash); php_stream_filter_factory *factory = NULL; @@ -258,7 +258,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval n = (int)strlen(filtername); if (NULL != (factory = zend_hash_str_find_ptr(filter_hash, filtername, n))) { - filter = factory->create_filter(filtername, filterparams, persistent TSRMLS_CC); + filter = factory->create_filter(filtername, filterparams, persistent); } else if ((period = strrchr(filtername, '.'))) { /* try a wildcard */ char *wildname; @@ -270,7 +270,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval *period = '\0'; strncat(wildname, ".*", 2); if (NULL != (factory = zend_hash_str_find_ptr(filter_hash, wildname, strlen(wildname)))) { - filter = factory->create_filter(filtername, filterparams, persistent TSRMLS_CC); + filter = factory->create_filter(filtername, filterparams, persistent); } *period = '\0'; @@ -282,15 +282,15 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval if (filter == NULL) { /* TODO: these need correct docrefs */ if (factory == NULL) - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to locate filter \"%s\"", filtername); + php_error_docref(NULL, E_WARNING, "unable to locate filter \"%s\"", filtername); else - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to create or locate filter \"%s\"", filtername); + php_error_docref(NULL, E_WARNING, "unable to create or locate filter \"%s\"", filtername); } return filter; } -PHPAPI php_stream_filter *_php_stream_filter_alloc(php_stream_filter_ops *fops, void *abstract, int persistent STREAMS_DC TSRMLS_DC) +PHPAPI php_stream_filter *_php_stream_filter_alloc(php_stream_filter_ops *fops, void *abstract, int persistent STREAMS_DC) { php_stream_filter *filter; @@ -304,14 +304,14 @@ PHPAPI php_stream_filter *_php_stream_filter_alloc(php_stream_filter_ops *fops, return filter; } -PHPAPI void php_stream_filter_free(php_stream_filter *filter TSRMLS_DC) +PHPAPI void php_stream_filter_free(php_stream_filter *filter) { if (filter->fops->dtor) - filter->fops->dtor(filter TSRMLS_CC); + filter->fops->dtor(filter); pefree(filter, filter->is_persistent); } -PHPAPI int php_stream_filter_prepend_ex(php_stream_filter_chain *chain, php_stream_filter *filter TSRMLS_DC) +PHPAPI int php_stream_filter_prepend_ex(php_stream_filter_chain *chain, php_stream_filter *filter) { filter->next = chain->head; filter->prev = NULL; @@ -327,12 +327,12 @@ PHPAPI int php_stream_filter_prepend_ex(php_stream_filter_chain *chain, php_stre return SUCCESS; } -PHPAPI void _php_stream_filter_prepend(php_stream_filter_chain *chain, php_stream_filter *filter TSRMLS_DC) +PHPAPI void _php_stream_filter_prepend(php_stream_filter_chain *chain, php_stream_filter *filter) { - php_stream_filter_prepend_ex(chain, filter TSRMLS_CC); + php_stream_filter_prepend_ex(chain, filter); } -PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_stream_filter *filter TSRMLS_DC) +PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_stream_filter *filter) { php_stream *stream = chain->stream; @@ -354,9 +354,9 @@ PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_strea php_stream_bucket *bucket; size_t consumed = 0; - bucket = php_stream_bucket_new(stream, (char*) stream->readbuf + stream->readpos, stream->writepos - stream->readpos, 0, 0 TSRMLS_CC); - php_stream_bucket_append(brig_inp, bucket TSRMLS_CC); - status = filter->fops->filter(stream, filter, brig_inp, brig_outp, &consumed, PSFS_FLAG_NORMAL TSRMLS_CC); + bucket = php_stream_bucket_new(stream, (char*) stream->readbuf + stream->readpos, stream->writepos - stream->readpos, 0, 0); + php_stream_bucket_append(brig_inp, bucket); + status = filter->fops->filter(stream, filter, brig_inp, brig_outp, &consumed, PSFS_FLAG_NORMAL); if (stream->readpos + consumed > (uint)stream->writepos) { /* No behaving filter should cause this. */ @@ -367,15 +367,15 @@ PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_strea case PSFS_ERR_FATAL: while (brig_in.head) { bucket = brig_in.head; - php_stream_bucket_unlink(bucket TSRMLS_CC); - php_stream_bucket_delref(bucket TSRMLS_CC); + php_stream_bucket_unlink(bucket); + php_stream_bucket_delref(bucket); } while (brig_out.head) { bucket = brig_out.head; - php_stream_bucket_unlink(bucket TSRMLS_CC); - php_stream_bucket_delref(bucket TSRMLS_CC); + php_stream_bucket_unlink(bucket); + php_stream_bucket_delref(bucket); } - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filter failed to process pre-buffered data"); + php_error_docref(NULL, E_WARNING, "Filter failed to process pre-buffered data"); return FAILURE; case PSFS_FEED_ME: /* We don't actually need data yet, @@ -403,8 +403,8 @@ PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_strea memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); stream->writepos += bucket->buflen; - php_stream_bucket_unlink(bucket TSRMLS_CC); - php_stream_bucket_delref(bucket TSRMLS_CC); + php_stream_bucket_unlink(bucket); + php_stream_bucket_delref(bucket); } break; } @@ -413,9 +413,9 @@ PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_strea return SUCCESS; } -PHPAPI void _php_stream_filter_append(php_stream_filter_chain *chain, php_stream_filter *filter TSRMLS_DC) +PHPAPI void _php_stream_filter_append(php_stream_filter_chain *chain, php_stream_filter *filter) { - if (php_stream_filter_append_ex(chain, filter TSRMLS_CC) != SUCCESS) { + if (php_stream_filter_append_ex(chain, filter) != SUCCESS) { if (chain->head == filter) { chain->head = NULL; chain->tail = NULL; @@ -426,7 +426,7 @@ PHPAPI void _php_stream_filter_append(php_stream_filter_chain *chain, php_stream } } -PHPAPI int _php_stream_filter_flush(php_stream_filter *filter, int finish TSRMLS_DC) +PHPAPI int _php_stream_filter_flush(php_stream_filter *filter, int finish) { php_stream_bucket_brigade brig_a = { NULL, NULL }, brig_b = { NULL, NULL }, *inp = &brig_a, *outp = &brig_b, *brig_temp; php_stream_bucket *bucket; @@ -447,7 +447,7 @@ PHPAPI int _php_stream_filter_flush(php_stream_filter *filter, int finish TSRMLS for(current = filter; current; current = current->next) { php_stream_filter_status_t status; - status = filter->fops->filter(stream, filter, inp, outp, NULL, flags TSRMLS_CC); + status = filter->fops->filter(stream, filter, inp, outp, NULL, flags); if (status == PSFS_FEED_ME) { /* We've flushed the data far enough */ return SUCCESS; @@ -493,22 +493,22 @@ PHPAPI int _php_stream_filter_flush(php_stream_filter *filter, int finish TSRMLS while ((bucket = inp->head)) { memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); stream->writepos += bucket->buflen; - php_stream_bucket_unlink(bucket TSRMLS_CC); - php_stream_bucket_delref(bucket TSRMLS_CC); + php_stream_bucket_unlink(bucket); + php_stream_bucket_delref(bucket); } } else if (chain == &(stream->writefilters)) { /* Send flushed data to the stream */ while ((bucket = inp->head)) { - stream->ops->write(stream, bucket->buf, bucket->buflen TSRMLS_CC); - php_stream_bucket_unlink(bucket TSRMLS_CC); - php_stream_bucket_delref(bucket TSRMLS_CC); + stream->ops->write(stream, bucket->buf, bucket->buflen); + php_stream_bucket_unlink(bucket); + php_stream_bucket_delref(bucket); } } return SUCCESS; } -PHPAPI php_stream_filter *php_stream_filter_remove(php_stream_filter *filter, int call_dtor TSRMLS_DC) +PHPAPI php_stream_filter *php_stream_filter_remove(php_stream_filter *filter, int call_dtor) { if (filter->prev) { filter->prev->next = filter->next; @@ -526,7 +526,7 @@ PHPAPI php_stream_filter *php_stream_filter_remove(php_stream_filter *filter, in } if (call_dtor) { - php_stream_filter_free(filter TSRMLS_CC); + php_stream_filter_free(filter); return NULL; } return filter; diff --git a/main/streams/glob_wrapper.c b/main/streams/glob_wrapper.c index e62fbfb662..7822265ea3 100644 --- a/main/streams/glob_wrapper.c +++ b/main/streams/glob_wrapper.c @@ -47,7 +47,7 @@ typedef struct { size_t pattern_len; } glob_s_t; -PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, size_t *plen STREAMS_DC TSRMLS_DC) /* {{{ */ +PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, size_t *plen STREAMS_DC) /* {{{ */ { glob_s_t *pglob = (glob_s_t *)stream->abstract; @@ -69,7 +69,7 @@ PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, size_t *ple } /* }}} */ -PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, size_t *plen STREAMS_DC TSRMLS_DC) /* {{{ */ +PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, size_t *plen STREAMS_DC) /* {{{ */ { glob_s_t *pglob = (glob_s_t *)stream->abstract; @@ -91,7 +91,7 @@ PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, size_t * } /* }}} */ -PHPAPI int _php_glob_stream_get_count(php_stream *stream, int *pflags STREAMS_DC TSRMLS_DC) /* {{{ */ +PHPAPI int _php_glob_stream_get_count(php_stream *stream, int *pflags STREAMS_DC) /* {{{ */ { glob_s_t *pglob = (glob_s_t *)stream->abstract; @@ -109,7 +109,7 @@ PHPAPI int _php_glob_stream_get_count(php_stream *stream, int *pflags STREAMS_DC } /* }}} */ -static void php_glob_stream_path_split(glob_s_t *pglob, const char *path, int get_path, const char **p_file TSRMLS_DC) /* {{{ */ +static void php_glob_stream_path_split(glob_s_t *pglob, const char *path, int get_path, const char **p_file) /* {{{ */ { const char *pos, *gpath = path; @@ -137,7 +137,7 @@ static void php_glob_stream_path_split(glob_s_t *pglob, const char *path, int ge } /* }}} */ -static size_t php_glob_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) /* {{{ */ +static size_t php_glob_stream_read(php_stream *stream, char *buf, size_t count) /* {{{ */ { glob_s_t *pglob = (glob_s_t *)stream->abstract; php_stream_dirent *ent = (php_stream_dirent*)buf; @@ -146,7 +146,7 @@ static size_t php_glob_stream_read(php_stream *stream, char *buf, size_t count T /* avoid problems if someone mis-uses the stream */ if (count == sizeof(php_stream_dirent) && pglob) { if (pglob->index < (size_t)pglob->glob.gl_pathc) { - php_glob_stream_path_split(pglob, pglob->glob.gl_pathv[pglob->index++], pglob->flags & GLOB_APPEND, &path TSRMLS_CC); + php_glob_stream_path_split(pglob, pglob->glob.gl_pathv[pglob->index++], pglob->flags & GLOB_APPEND, &path); PHP_STRLCPY(ent->d_name, path, sizeof(ent->d_name), strlen(path)); return sizeof(php_stream_dirent); } @@ -161,7 +161,7 @@ static size_t php_glob_stream_read(php_stream *stream, char *buf, size_t count T } /* }}} */ -static int php_glob_stream_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{{ */ +static int php_glob_stream_close(php_stream *stream, int close_handle) /* {{{ */ { glob_s_t *pglob = (glob_s_t *)stream->abstract; @@ -180,7 +180,7 @@ static int php_glob_stream_close(php_stream *stream, int close_handle TSRMLS_DC) } /* {{{ */ -static int php_glob_stream_rewind(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) /* {{{ */ +static int php_glob_stream_rewind(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs) /* {{{ */ { glob_s_t *pglob = (glob_s_t *)stream->abstract; @@ -207,13 +207,13 @@ php_stream_ops php_glob_stream_ops = { /* {{{ php_glob_stream_opener */ static php_stream *php_glob_stream_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, - int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) + int options, char **opened_path, php_stream_context *context STREAMS_DC) { glob_s_t *pglob; int ret; const char *tmp, *pos; - if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) { + if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path)) { return NULL; } @@ -252,9 +252,9 @@ static php_stream *php_glob_stream_opener(php_stream_wrapper *wrapper, const cha pglob->flags |= GLOB_APPEND; if (pglob->glob.gl_pathc) { - php_glob_stream_path_split(pglob, pglob->glob.gl_pathv[0], 1, &tmp TSRMLS_CC); + php_glob_stream_path_split(pglob, pglob->glob.gl_pathv[0], 1, &tmp); } else { - php_glob_stream_path_split(pglob, path, 1, &tmp TSRMLS_CC); + php_glob_stream_path_split(pglob, path, 1, &tmp); } return php_stream_alloc(&php_glob_stream_ops, pglob, 0, mode); diff --git a/main/streams/memory.c b/main/streams/memory.c index 28274d7fcd..b2dca2115c 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -46,7 +46,7 @@ typedef struct { /* {{{ */ -static size_t php_stream_memory_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) +static size_t php_stream_memory_write(php_stream *stream, const char *buf, size_t count) { php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; assert(ms != NULL); @@ -82,7 +82,7 @@ static size_t php_stream_memory_write(php_stream *stream, const char *buf, size_ /* {{{ */ -static size_t php_stream_memory_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static size_t php_stream_memory_read(php_stream *stream, char *buf, size_t count) { php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; assert(ms != NULL); @@ -107,7 +107,7 @@ static size_t php_stream_memory_read(php_stream *stream, char *buf, size_t count /* {{{ */ -static int php_stream_memory_close(php_stream *stream, int close_handle TSRMLS_DC) +static int php_stream_memory_close(php_stream *stream, int close_handle) { php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; assert(ms != NULL); @@ -122,7 +122,7 @@ static int php_stream_memory_close(php_stream *stream, int close_handle TSRMLS_D /* {{{ */ -static int php_stream_memory_flush(php_stream *stream TSRMLS_DC) +static int php_stream_memory_flush(php_stream *stream) { /* nothing to do here */ return 0; @@ -131,7 +131,7 @@ static int php_stream_memory_flush(php_stream *stream TSRMLS_DC) /* {{{ */ -static int php_stream_memory_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) +static int php_stream_memory_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs) { php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; assert(ms != NULL); @@ -195,13 +195,13 @@ static int php_stream_memory_seek(php_stream *stream, zend_off_t offset, int whe /* }}} */ /* {{{ */ -static int php_stream_memory_cast(php_stream *stream, int castas, void **ret TSRMLS_DC) +static int php_stream_memory_cast(php_stream *stream, int castas, void **ret) { return FAILURE; } /* }}} */ -static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) /* {{{ */ +static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{ */ { time_t timestamp = 0; php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; @@ -244,7 +244,7 @@ static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb TS } /* }}} */ -static int php_stream_memory_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) /* {{{ */ +static int php_stream_memory_set_option(php_stream *stream, int option, int value, void *ptrparam) /* {{{ */ { php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; size_t newsize; @@ -290,7 +290,7 @@ PHPAPI php_stream_ops php_stream_memory_ops = { /* {{{ */ -PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC) { php_stream_memory_data *self; php_stream *stream; @@ -310,7 +310,7 @@ PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC TSRMLS_DC) /* {{{ */ -PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC) { php_stream *stream; php_stream_memory_data *ms; @@ -335,7 +335,7 @@ PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length ST /* {{{ */ -PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC TSRMLS_DC) +PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC) { php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; @@ -361,7 +361,7 @@ typedef struct { /* {{{ */ -static size_t php_stream_temp_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) +static size_t php_stream_temp_write(php_stream *stream, const char *buf, size_t count) { php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract; assert(ts != NULL); @@ -387,7 +387,7 @@ static size_t php_stream_temp_write(php_stream *stream, const char *buf, size_t /* {{{ */ -static size_t php_stream_temp_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static size_t php_stream_temp_read(php_stream *stream, char *buf, size_t count) { php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract; size_t got; @@ -408,7 +408,7 @@ static size_t php_stream_temp_read(php_stream *stream, char *buf, size_t count T /* {{{ */ -static int php_stream_temp_close(php_stream *stream, int close_handle TSRMLS_DC) +static int php_stream_temp_close(php_stream *stream, int close_handle) { php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract; int ret; @@ -435,7 +435,7 @@ static int php_stream_temp_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{{ */ -static int php_stream_temp_flush(php_stream *stream TSRMLS_DC) +static int php_stream_temp_flush(php_stream *stream) { php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract; assert(ts != NULL); @@ -446,7 +446,7 @@ static int php_stream_temp_flush(php_stream *stream TSRMLS_DC) /* {{{ */ -static int php_stream_temp_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) +static int php_stream_temp_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs) { php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract; int ret; @@ -466,7 +466,7 @@ static int php_stream_temp_seek(php_stream *stream, zend_off_t offset, int whenc /* }}} */ /* {{{ */ -static int php_stream_temp_cast(php_stream *stream, int castas, void **ret TSRMLS_DC) +static int php_stream_temp_cast(php_stream *stream, int castas, void **ret) { php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract; php_stream *file; @@ -512,7 +512,7 @@ static int php_stream_temp_cast(php_stream *stream, int castas, void **ret TSRML } /* }}} */ -static int php_stream_temp_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) /* {{{ */ +static int php_stream_temp_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{ */ { php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract; @@ -523,7 +523,7 @@ static int php_stream_temp_stat(php_stream *stream, php_stream_statbuf *ssb TSRM } /* }}} */ -static int php_stream_temp_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) /* {{{ */ +static int php_stream_temp_set_option(php_stream *stream, int option, int value, void *ptrparam) /* {{{ */ { php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract; @@ -555,7 +555,7 @@ PHPAPI php_stream_ops php_stream_temp_ops = { /* }}} */ /* {{{ _php_stream_temp_create_ex */ -PHPAPI php_stream *_php_stream_temp_create_ex(int mode, size_t max_memory_usage, const char *tmpdir STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_temp_create_ex(int mode, size_t max_memory_usage, const char *tmpdir STREAMS_DC) { php_stream_temp_data *self; php_stream *stream; @@ -577,14 +577,14 @@ PHPAPI php_stream *_php_stream_temp_create_ex(int mode, size_t max_memory_usage, /* }}} */ /* {{{ _php_stream_temp_create */ -PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC) { return php_stream_temp_create_ex(mode, max_memory_usage, NULL); } /* }}} */ /* {{{ _php_stream_temp_open */ -PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC) { php_stream *stream; php_stream_temp_data *ts; @@ -593,8 +593,8 @@ PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char if ((stream = php_stream_temp_create_rel(mode, max_memory_usage)) != NULL) { if (length) { assert(buf != NULL); - php_stream_temp_write(stream, buf, length TSRMLS_CC); - php_stream_temp_seek(stream, 0, SEEK_SET, &newoffs TSRMLS_CC); + php_stream_temp_write(stream, buf, length); + php_stream_temp_seek(stream, 0, SEEK_SET, &newoffs); } ts = (php_stream_temp_data*)stream->abstract; assert(ts != NULL); @@ -616,7 +616,7 @@ PHPAPI php_stream_ops php_stream_rfc2397_ops = { static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, - php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ + php_stream_context *context STREAMS_DC) /* {{{ */ { php_stream *stream; php_stream_temp_data *ts; @@ -641,7 +641,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con } if ((comma = memchr(path, ',', dlen)) == NULL) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "rfc2397: no comma in URL"); + php_stream_wrapper_log_error(wrapper, options, "rfc2397: no comma in URL"); return NULL; } @@ -653,7 +653,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con sep = memchr(path, '/', mlen); if (!semi && !sep) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "rfc2397: illegal media type"); + php_stream_wrapper_log_error(wrapper, options, "rfc2397: illegal media type"); return NULL; } @@ -668,7 +668,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con path += plen; } else if (semi != path || mlen != sizeof(";base64")-1 || memcmp(path, ";base64", sizeof(";base64")-1)) { /* must be error since parameters are only allowed after mediatype */ zval_ptr_dtor(&meta); - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "rfc2397: illegal media type"); + php_stream_wrapper_log_error(wrapper, options, "rfc2397: illegal media type"); return NULL; } /* get parameters and potentially ';base64' */ @@ -681,7 +681,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con if (mlen != sizeof("base64")-1 || memcmp(path, "base64", sizeof("base64")-1)) { /* must be error since parameters are only allowed after mediatype and we have no '=' sign */ zval_ptr_dtor(&meta); - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "rfc2397: illegal parameter"); + php_stream_wrapper_log_error(wrapper, options, "rfc2397: illegal parameter"); return NULL; } base64 = 1; @@ -701,7 +701,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con } if (mlen) { zval_ptr_dtor(&meta); - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "rfc2397: illegal URL"); + php_stream_wrapper_log_error(wrapper, options, "rfc2397: illegal URL"); return NULL; } } else { @@ -717,7 +717,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con base64_comma = php_base64_decode((const unsigned char *)comma, dlen); if (!base64_comma) { zval_ptr_dtor(&meta); - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "rfc2397: unable to decode"); + php_stream_wrapper_log_error(wrapper, options, "rfc2397: unable to decode"); return NULL; } comma = base64_comma->val; @@ -730,8 +730,8 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con if ((stream = php_stream_temp_create_rel(0, ~0u)) != NULL) { /* store data */ - php_stream_temp_write(stream, comma, ilen TSRMLS_CC); - php_stream_temp_seek(stream, 0, SEEK_SET, &newoffs TSRMLS_CC); + php_stream_temp_write(stream, comma, ilen); + php_stream_temp_seek(stream, 0, SEEK_SET, &newoffs); /* set special stream stuff (enforce exact mode) */ vlen = strlen(mode); if (vlen >= sizeof(stream->mode)) { diff --git a/main/streams/mmap.c b/main/streams/mmap.c index 8746959bbe..3eee859c13 100644 --- a/main/streams/mmap.c +++ b/main/streams/mmap.c @@ -22,7 +22,7 @@ #include "php.h" #include "php_streams_int.h" -PHPAPI char *_php_stream_mmap_range(php_stream *stream, size_t offset, size_t length, php_stream_mmap_operation_t mode, size_t *mapped_len TSRMLS_DC) +PHPAPI char *_php_stream_mmap_range(php_stream *stream, size_t offset, size_t length, php_stream_mmap_operation_t mode, size_t *mapped_len) { php_stream_mmap_range range; @@ -46,12 +46,12 @@ PHPAPI char *_php_stream_mmap_range(php_stream *stream, size_t offset, size_t le return NULL; } -PHPAPI int _php_stream_mmap_unmap(php_stream *stream TSRMLS_DC) +PHPAPI int _php_stream_mmap_unmap(php_stream *stream) { return php_stream_set_option(stream, PHP_STREAM_OPTION_MMAP_API, PHP_STREAM_MMAP_UNMAP, NULL) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0; } -PHPAPI int _php_stream_mmap_unmap_ex(php_stream *stream, zend_off_t readden TSRMLS_DC) +PHPAPI int _php_stream_mmap_unmap_ex(php_stream *stream, zend_off_t readden) { int ret = 1; diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h index ac90a0ba3c..836cd9cadb 100644 --- a/main/streams/php_stream_context.h +++ b/main/streams/php_stream_context.h @@ -25,7 +25,7 @@ typedef void (*php_stream_notification_func)(php_stream_context *context, int notifycode, int severity, char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, - void * ptr TSRMLS_DC); + void * ptr); #define PHP_STREAM_NOTIFIER_PROGRESS 1 @@ -33,10 +33,10 @@ typedef void (*php_stream_notification_func)(php_stream_context *context, If no context was passed, use the default context The default context has not yet been created, do it now. */ #define php_stream_context_from_zval(zcontext, nocontext) ( \ - (zcontext) ? zend_fetch_resource(zcontext TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context(TSRMLS_C)) : \ + (zcontext) ? zend_fetch_resource(zcontext, -1, "Stream-Context", NULL, 1, php_le_stream_context()) : \ (nocontext) ? NULL : \ FG(default_context) ? FG(default_context) : \ - (FG(default_context) = php_stream_context_alloc(TSRMLS_C)) ) + (FG(default_context) = php_stream_context_alloc()) ) #define php_stream_context_to_zval(context, zval) { ZVAL_RES(zval, (context)->res); GC_REFCOUNT((context)->res)++; } @@ -58,7 +58,7 @@ struct _php_stream_context { BEGIN_EXTERN_C() PHPAPI void php_stream_context_free(php_stream_context *context); -PHPAPI php_stream_context *php_stream_context_alloc(TSRMLS_D); +PHPAPI php_stream_context *php_stream_context_alloc(void); PHPAPI zval *php_stream_context_get_option(php_stream_context *context, const char *wrappername, const char *optionname); PHPAPI int php_stream_context_set_option(php_stream_context *context, @@ -86,17 +86,17 @@ END_EXTERN_C() BEGIN_EXTERN_C() PHPAPI void php_stream_notification_notify(php_stream_context *context, int notifycode, int severity, - char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, void * ptr TSRMLS_DC); -PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context TSRMLS_DC); + char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, void * ptr); +PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context); END_EXTERN_C() #define php_stream_notify_info(context, code, xmsg, xcode) do { if ((context) && (context)->notifier) { \ php_stream_notification_notify((context), (code), PHP_STREAM_NOTIFY_SEVERITY_INFO, \ - (xmsg), (xcode), 0, 0, NULL TSRMLS_CC); } } while (0) + (xmsg), (xcode), 0, 0, NULL); } } while (0) #define php_stream_notify_progress(context, bsofar, bmax) do { if ((context) && (context)->notifier) { \ php_stream_notification_notify((context), PHP_STREAM_NOTIFY_PROGRESS, PHP_STREAM_NOTIFY_SEVERITY_INFO, \ - NULL, 0, (bsofar), (bmax), NULL TSRMLS_CC); } } while(0) + NULL, 0, (bsofar), (bmax), NULL); } } while(0) #define php_stream_notify_progress_init(context, sofar, bmax) do { if ((context) && (context)->notifier) { \ (context)->notifier->progress = (sofar); \ @@ -111,11 +111,11 @@ END_EXTERN_C() #define php_stream_notify_file_size(context, file_size, xmsg, xcode) do { if ((context) && (context)->notifier) { \ php_stream_notification_notify((context), PHP_STREAM_NOTIFY_FILE_SIZE_IS, PHP_STREAM_NOTIFY_SEVERITY_INFO, \ - (xmsg), (xcode), 0, (file_size), NULL TSRMLS_CC); } } while(0) + (xmsg), (xcode), 0, (file_size), NULL); } } while(0) #define php_stream_notify_error(context, code, xmsg, xcode) do { if ((context) && (context)->notifier) {\ php_stream_notification_notify((context), (code), PHP_STREAM_NOTIFY_SEVERITY_ERR, \ - (xmsg), (xcode), 0, 0, NULL TSRMLS_CC); } } while(0) + (xmsg), (xcode), 0, 0, NULL); } } while(0) /* diff --git a/main/streams/php_stream_filter_api.h b/main/streams/php_stream_filter_api.h index dfa4ae2937..7c9248ecc1 100644 --- a/main/streams/php_stream_filter_api.h +++ b/main/streams/php_stream_filter_api.h @@ -67,14 +67,14 @@ typedef enum { /* Buckets API. */ BEGIN_EXTERN_C() -PHPAPI php_stream_bucket *php_stream_bucket_new(php_stream *stream, char *buf, size_t buflen, int own_buf, int buf_persistent TSRMLS_DC); -PHPAPI int php_stream_bucket_split(php_stream_bucket *in, php_stream_bucket **left, php_stream_bucket **right, size_t length TSRMLS_DC); -PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket TSRMLS_DC); +PHPAPI php_stream_bucket *php_stream_bucket_new(php_stream *stream, char *buf, size_t buflen, int own_buf, int buf_persistent); +PHPAPI int php_stream_bucket_split(php_stream_bucket *in, php_stream_bucket **left, php_stream_bucket **right, size_t length); +PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket); #define php_stream_bucket_addref(bucket) (bucket)->refcount++ -PHPAPI void php_stream_bucket_prepend(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket TSRMLS_DC); -PHPAPI void php_stream_bucket_append(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket TSRMLS_DC); -PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket TSRMLS_DC); -PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bucket TSRMLS_DC); +PHPAPI void php_stream_bucket_prepend(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket); +PHPAPI void php_stream_bucket_append(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket); +PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket); +PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bucket); END_EXTERN_C() #define PSFS_FLAG_NORMAL 0 /* regular read/write */ @@ -90,9 +90,9 @@ typedef struct _php_stream_filter_ops { php_stream_bucket_brigade *buckets_out, size_t *bytes_consumed, int flags - TSRMLS_DC); + ); - void (*dtor)(php_stream_filter *thisfilter TSRMLS_DC); + void (*dtor)(php_stream_filter *thisfilter); const char *label; @@ -124,32 +124,32 @@ struct _php_stream_filter { /* stack filter onto a stream */ BEGIN_EXTERN_C() -PHPAPI void _php_stream_filter_prepend(php_stream_filter_chain *chain, php_stream_filter *filter TSRMLS_DC); -PHPAPI int php_stream_filter_prepend_ex(php_stream_filter_chain *chain, php_stream_filter *filter TSRMLS_DC); -PHPAPI void _php_stream_filter_append(php_stream_filter_chain *chain, php_stream_filter *filter TSRMLS_DC); -PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_stream_filter *filter TSRMLS_DC); -PHPAPI int _php_stream_filter_flush(php_stream_filter *filter, int finish TSRMLS_DC); -PHPAPI php_stream_filter *php_stream_filter_remove(php_stream_filter *filter, int call_dtor TSRMLS_DC); -PHPAPI void php_stream_filter_free(php_stream_filter *filter TSRMLS_DC); -PHPAPI php_stream_filter *_php_stream_filter_alloc(php_stream_filter_ops *fops, void *abstract, int persistent STREAMS_DC TSRMLS_DC); +PHPAPI void _php_stream_filter_prepend(php_stream_filter_chain *chain, php_stream_filter *filter); +PHPAPI int php_stream_filter_prepend_ex(php_stream_filter_chain *chain, php_stream_filter *filter); +PHPAPI void _php_stream_filter_append(php_stream_filter_chain *chain, php_stream_filter *filter); +PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_stream_filter *filter); +PHPAPI int _php_stream_filter_flush(php_stream_filter *filter, int finish); +PHPAPI php_stream_filter *php_stream_filter_remove(php_stream_filter *filter, int call_dtor); +PHPAPI void php_stream_filter_free(php_stream_filter *filter); +PHPAPI php_stream_filter *_php_stream_filter_alloc(php_stream_filter_ops *fops, void *abstract, int persistent STREAMS_DC); END_EXTERN_C() -#define php_stream_filter_alloc(fops, thisptr, persistent) _php_stream_filter_alloc((fops), (thisptr), (persistent) STREAMS_CC TSRMLS_CC) -#define php_stream_filter_alloc_rel(fops, thisptr, persistent) _php_stream_filter_alloc((fops), (thisptr), (persistent) STREAMS_REL_CC TSRMLS_CC) -#define php_stream_filter_prepend(chain, filter) _php_stream_filter_prepend((chain), (filter) TSRMLS_CC) -#define php_stream_filter_append(chain, filter) _php_stream_filter_append((chain), (filter) TSRMLS_CC) -#define php_stream_filter_flush(filter, finish) _php_stream_filter_flush((filter), (finish) TSRMLS_CC) +#define php_stream_filter_alloc(fops, thisptr, persistent) _php_stream_filter_alloc((fops), (thisptr), (persistent) STREAMS_CC) +#define php_stream_filter_alloc_rel(fops, thisptr, persistent) _php_stream_filter_alloc((fops), (thisptr), (persistent) STREAMS_REL_CC) +#define php_stream_filter_prepend(chain, filter) _php_stream_filter_prepend((chain), (filter)) +#define php_stream_filter_append(chain, filter) _php_stream_filter_append((chain), (filter)) +#define php_stream_filter_flush(filter, finish) _php_stream_filter_flush((filter), (finish)) #define php_stream_is_filtered(stream) ((stream)->readfilters.head || (stream)->writefilters.head) typedef struct _php_stream_filter_factory { - php_stream_filter *(*create_filter)(const char *filtername, zval *filterparams, int persistent TSRMLS_DC); + php_stream_filter *(*create_filter)(const char *filtername, zval *filterparams, int persistent); } php_stream_filter_factory; BEGIN_EXTERN_C() -PHPAPI int php_stream_filter_register_factory(const char *filterpattern, php_stream_filter_factory *factory TSRMLS_DC); -PHPAPI int php_stream_filter_unregister_factory(const char *filterpattern TSRMLS_DC); -PHPAPI int php_stream_filter_register_factory_volatile(const char *filterpattern, php_stream_filter_factory *factory TSRMLS_DC); -PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC); +PHPAPI int php_stream_filter_register_factory(const char *filterpattern, php_stream_filter_factory *factory); +PHPAPI int php_stream_filter_unregister_factory(const char *filterpattern); +PHPAPI int php_stream_filter_register_factory_volatile(const char *filterpattern, php_stream_filter_factory *factory); +PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval *filterparams, int persistent); END_EXTERN_C() /* diff --git a/main/streams/php_stream_glob_wrapper.h b/main/streams/php_stream_glob_wrapper.h index 69b67d4c85..be93651fd1 100644 --- a/main/streams/php_stream_glob_wrapper.h +++ b/main/streams/php_stream_glob_wrapper.h @@ -23,14 +23,14 @@ PHPAPI extern php_stream_ops php_glob_stream_ops; BEGIN_EXTERN_C() -PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, size_t *plen STREAMS_DC TSRMLS_DC); -#define php_glob_stream_get_path(stream, copy, plen) _php_glob_stream_get_path((stream), (copy), (plen) STREAMS_CC TSRMLS_CC) +PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, size_t *plen STREAMS_DC); +#define php_glob_stream_get_path(stream, copy, plen) _php_glob_stream_get_path((stream), (copy), (plen) STREAMS_CC) -PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, size_t *plen STREAMS_DC TSRMLS_DC); -#define php_glob_stream_get_pattern(stream, copy, plen) _php_glob_stream_get_pattern((stream), (copy), (plen) STREAMS_CC TSRMLS_CC) +PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, size_t *plen STREAMS_DC); +#define php_glob_stream_get_pattern(stream, copy, plen) _php_glob_stream_get_pattern((stream), (copy), (plen) STREAMS_CC) -PHPAPI int _php_glob_stream_get_count(php_stream *stream, int *pflags STREAMS_DC TSRMLS_DC); -#define php_glob_stream_get_count(stream, pflags) _php_glob_stream_get_count((stream), (pflags) STREAMS_CC TSRMLS_CC) +PHPAPI int _php_glob_stream_get_count(php_stream *stream, int *pflags STREAMS_DC); +#define php_glob_stream_get_count(stream, pflags) _php_glob_stream_get_count((stream), (pflags) STREAMS_CC) END_EXTERN_C() diff --git a/main/streams/php_stream_mmap.h b/main/streams/php_stream_mmap.h index a25c4ac6b9..e58b703095 100644 --- a/main/streams/php_stream_mmap.h +++ b/main/streams/php_stream_mmap.h @@ -60,22 +60,22 @@ typedef struct { #define PHP_STREAM_MMAP_ALL 0 -#define php_stream_mmap_supported(stream) (_php_stream_set_option((stream), PHP_STREAM_OPTION_MMAP_API, PHP_STREAM_MMAP_SUPPORTED, NULL TSRMLS_CC) == 0 ? 1 : 0) +#define php_stream_mmap_supported(stream) (_php_stream_set_option((stream), PHP_STREAM_OPTION_MMAP_API, PHP_STREAM_MMAP_SUPPORTED, NULL) == 0 ? 1 : 0) /* Returns 1 if the stream in its current state can be memory mapped, * 0 otherwise */ #define php_stream_mmap_possible(stream) (!php_stream_is_filtered((stream)) && php_stream_mmap_supported((stream))) BEGIN_EXTERN_C() -PHPAPI char *_php_stream_mmap_range(php_stream *stream, size_t offset, size_t length, php_stream_mmap_operation_t mode, size_t *mapped_len TSRMLS_DC); -#define php_stream_mmap_range(stream, offset, length, mode, mapped_len) _php_stream_mmap_range((stream), (offset), (length), (mode), (mapped_len) TSRMLS_CC) +PHPAPI char *_php_stream_mmap_range(php_stream *stream, size_t offset, size_t length, php_stream_mmap_operation_t mode, size_t *mapped_len); +#define php_stream_mmap_range(stream, offset, length, mode, mapped_len) _php_stream_mmap_range((stream), (offset), (length), (mode), (mapped_len)) /* un-maps the last mapped range */ -PHPAPI int _php_stream_mmap_unmap(php_stream *stream TSRMLS_DC); -#define php_stream_mmap_unmap(stream) _php_stream_mmap_unmap((stream) TSRMLS_CC) +PHPAPI int _php_stream_mmap_unmap(php_stream *stream); +#define php_stream_mmap_unmap(stream) _php_stream_mmap_unmap((stream)) -PHPAPI int _php_stream_mmap_unmap_ex(php_stream *stream, zend_off_t readden TSRMLS_DC); -#define php_stream_mmap_unmap_ex(stream, readden) _php_stream_mmap_unmap_ex((stream), (readden) TSRMLS_CC) +PHPAPI int _php_stream_mmap_unmap_ex(php_stream *stream, zend_off_t readden); +#define php_stream_mmap_unmap_ex(stream, readden) _php_stream_mmap_unmap_ex((stream), (readden)) END_EXTERN_C() /* diff --git a/main/streams/php_stream_plain_wrapper.h b/main/streams/php_stream_plain_wrapper.h index 7d5278c620..d2bf50d189 100644 --- a/main/streams/php_stream_plain_wrapper.h +++ b/main/streams/php_stream_plain_wrapper.h @@ -27,32 +27,32 @@ PHPAPI extern php_stream_wrapper php_plain_files_wrapper; BEGIN_EXTERN_C() /* like fopen, but returns a stream */ -PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, char **opened_path, int options STREAMS_DC TSRMLS_DC); -#define php_stream_fopen(filename, mode, opened) _php_stream_fopen((filename), (mode), (opened), 0 STREAMS_CC TSRMLS_CC) +PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, char **opened_path, int options STREAMS_DC); +#define php_stream_fopen(filename, mode, opened) _php_stream_fopen((filename), (mode), (opened), 0 STREAMS_CC) -PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC); -#define php_stream_fopen_with_path(filename, mode, path, opened) _php_stream_fopen_with_path((filename), (mode), (path), (opened), 0 STREAMS_CC TSRMLS_CC) +PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path, int options STREAMS_DC); +#define php_stream_fopen_with_path(filename, mode, path, opened) _php_stream_fopen_with_path((filename), (mode), (path), (opened), 0 STREAMS_CC) -PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STREAMS_DC TSRMLS_DC); -#define php_stream_fopen_from_file(file, mode) _php_stream_fopen_from_file((file), (mode) STREAMS_CC TSRMLS_CC) +PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STREAMS_DC); +#define php_stream_fopen_from_file(file, mode) _php_stream_fopen_from_file((file), (mode) STREAMS_CC) -PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const char *persistent_id STREAMS_DC TSRMLS_DC); -#define php_stream_fopen_from_fd(fd, mode, persistent_id) _php_stream_fopen_from_fd((fd), (mode), (persistent_id) STREAMS_CC TSRMLS_CC) +PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const char *persistent_id STREAMS_DC); +#define php_stream_fopen_from_fd(fd, mode, persistent_id) _php_stream_fopen_from_fd((fd), (mode), (persistent_id) STREAMS_CC) -PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode STREAMS_DC TSRMLS_DC); -#define php_stream_fopen_from_pipe(file, mode) _php_stream_fopen_from_pipe((file), (mode) STREAMS_CC TSRMLS_CC) +PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode STREAMS_DC); +#define php_stream_fopen_from_pipe(file, mode) _php_stream_fopen_from_pipe((file), (mode) STREAMS_CC) -PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC TSRMLS_DC); -#define php_stream_fopen_tmpfile() _php_stream_fopen_tmpfile(0 STREAMS_CC TSRMLS_CC) +PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC); +#define php_stream_fopen_tmpfile() _php_stream_fopen_tmpfile(0 STREAMS_CC) -PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path STREAMS_DC TSRMLS_DC); -#define php_stream_fopen_temporary_file(dir, pfx, opened_path) _php_stream_fopen_temporary_file((dir), (pfx), (opened_path) STREAMS_CC TSRMLS_CC) +PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path STREAMS_DC); +#define php_stream_fopen_temporary_file(dir, pfx, opened_path) _php_stream_fopen_temporary_file((dir), (pfx), (opened_path) STREAMS_CC) /* This is a utility API for extensions that are opening a stream, converting it * to a FILE* and then closing it again. Be warned that fileno() on the result * will most likely fail on systems with fopencookie. */ -PHPAPI FILE * _php_stream_open_wrapper_as_file(char * path, char * mode, int options, char **opened_path STREAMS_DC TSRMLS_DC); -#define php_stream_open_wrapper_as_file(path, mode, options, opened_path) _php_stream_open_wrapper_as_file((path), (mode), (options), (opened_path) STREAMS_CC TSRMLS_CC) +PHPAPI FILE * _php_stream_open_wrapper_as_file(char * path, char * mode, int options, char **opened_path STREAMS_DC); +#define php_stream_open_wrapper_as_file(path, mode, options, opened_path) _php_stream_open_wrapper_as_file((path), (mode), (options), (opened_path) STREAMS_CC) END_EXTERN_C() diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h index 2d076064cf..7f587282f0 100644 --- a/main/streams/php_stream_transport.h +++ b/main/streams/php_stream_transport.h @@ -30,12 +30,12 @@ typedef php_stream *(php_stream_transport_factory_func)(const char *proto, size_ const char *resourcename, size_t resourcenamelen, const char *persistent_id, int options, int flags, struct timeval *timeout, - php_stream_context *context STREAMS_DC TSRMLS_DC); + php_stream_context *context STREAMS_DC); typedef php_stream_transport_factory_func *php_stream_transport_factory; BEGIN_EXTERN_C() -PHPAPI int php_stream_xport_register(const char *protocol, php_stream_transport_factory factory TSRMLS_DC); -PHPAPI int php_stream_xport_unregister(const char *protocol TSRMLS_DC); +PHPAPI int php_stream_xport_register(const char *protocol, php_stream_transport_factory factory); +PHPAPI int php_stream_xport_unregister(const char *protocol); #define STREAM_XPORT_CLIENT 0 #define STREAM_XPORT_SERVER 1 @@ -52,16 +52,16 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in php_stream_context *context, zend_string **error_string, int *error_code - STREAMS_DC TSRMLS_DC); + STREAMS_DC); #define php_stream_xport_create(name, namelen, options, flags, persistent_id, timeout, context, estr, ecode) \ - _php_stream_xport_create(name, namelen, options, flags, persistent_id, timeout, context, estr, ecode STREAMS_CC TSRMLS_CC) + _php_stream_xport_create(name, namelen, options, flags, persistent_id, timeout, context, estr, ecode STREAMS_CC) /* Bind the stream to a local address */ PHPAPI int php_stream_xport_bind(php_stream *stream, const char *name, size_t namelen, zend_string **error_text - TSRMLS_DC); + ); /* Connect to a remote address */ PHPAPI int php_stream_xport_connect(php_stream *stream, @@ -70,13 +70,13 @@ PHPAPI int php_stream_xport_connect(php_stream *stream, struct timeval *timeout, zend_string **error_text, int *error_code - TSRMLS_DC); + ); /* Prepare to listen */ PHPAPI int php_stream_xport_listen(php_stream *stream, int backlog, zend_string **error_text - TSRMLS_DC); + ); /* Get the next client and their address as a string, or the underlying address * structure. You must efree either of these if you request them */ @@ -85,13 +85,13 @@ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, void **addr, socklen_t *addrlen, struct timeval *timeout, zend_string **error_text - TSRMLS_DC); + ); /* Get the name of either the socket or it's peer */ PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer, zend_string **textaddr, void **addr, socklen_t *addrlen - TSRMLS_DC); + ); enum php_stream_xport_send_recv_flags { STREAM_OOB = 1, @@ -102,12 +102,12 @@ enum php_stream_xport_send_recv_flags { * peeking, optionally retrieving OOB data */ PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t buflen, int flags, void **addr, socklen_t *addrlen, - zend_string **textaddr TSRMLS_DC); + zend_string **textaddr); /* Similar to send() system call; send data to the stream, optionally * sending it as OOB data */ PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t buflen, - int flags, void *addr, socklen_t addrlen TSRMLS_DC); + int flags, void *addr, socklen_t addrlen); typedef enum { STREAM_SHUT_RD, @@ -117,7 +117,7 @@ typedef enum { /* Similar to shutdown() system call; shut down part of a full-duplex * connection */ -PHPAPI int php_stream_xport_shutdown(php_stream *stream, stream_shutdown_t how TSRMLS_DC); +PHPAPI int php_stream_xport_shutdown(php_stream *stream, stream_shutdown_t how); END_EXTERN_C() @@ -186,8 +186,8 @@ typedef enum { /* These functions provide crypto support on the underlying transport */ BEGIN_EXTERN_C() -PHPAPI int php_stream_xport_crypto_setup(php_stream *stream, php_stream_xport_crypt_method_t crypto_method, php_stream *session_stream TSRMLS_DC); -PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate TSRMLS_DC); +PHPAPI int php_stream_xport_crypto_setup(php_stream *stream, php_stream_xport_crypt_method_t crypto_method, php_stream *session_stream); +PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate); END_EXTERN_C() typedef struct _php_stream_xport_crypto_param { diff --git a/main/streams/php_streams_int.h b/main/streams/php_streams_int.h index d8799fcefb..ac0163ddb4 100644 --- a/main/streams/php_streams_int.h +++ b/main/streams/php_streams_int.h @@ -66,6 +66,6 @@ * ones. result should be a char[5]. */ void php_stream_mode_sanitize_fdopen_fopencookie(php_stream *stream, char *result); -void php_stream_tidy_wrapper_error_log(php_stream_wrapper *wrapper TSRMLS_DC); -void php_stream_display_wrapper_errors(php_stream_wrapper *wrapper, const char *path, const char *caption TSRMLS_DC); +void php_stream_tidy_wrapper_error_log(php_stream_wrapper *wrapper); +void php_stream_display_wrapper_errors(php_stream_wrapper *wrapper, const char *path, const char *caption); diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 8fad2aa4f1..acb34b8968 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -44,14 +44,14 @@ # include "win32/time.h" #endif -#define php_stream_fopen_from_fd_int(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_CC TSRMLS_CC) -#define php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_REL_CC TSRMLS_CC) -#define php_stream_fopen_from_file_int(file, mode) _php_stream_fopen_from_file_int((file), (mode) STREAMS_CC TSRMLS_CC) -#define php_stream_fopen_from_file_int_rel(file, mode) _php_stream_fopen_from_file_int((file), (mode) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_fopen_from_fd_int(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_CC) +#define php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_REL_CC) +#define php_stream_fopen_from_file_int(file, mode) _php_stream_fopen_from_file_int((file), (mode) STREAMS_CC) +#define php_stream_fopen_from_file_int_rel(file, mode) _php_stream_fopen_from_file_int((file), (mode) STREAMS_REL_CC) #if !defined(WINDOWS) && !defined(NETWARE) -extern int php_get_uid_by_name(const char *name, uid_t *uid TSRMLS_DC); -extern int php_get_gid_by_name(const char *name, gid_t *gid TSRMLS_DC); +extern int php_get_uid_by_name(const char *name, uid_t *uid); +extern int php_get_gid_by_name(const char *name, gid_t *gid); #endif #if defined(PHP_WIN32) @@ -158,7 +158,7 @@ static int do_fstat(php_stdio_stream_data *d, int force) return 0; } -static php_stream *_php_stream_fopen_from_fd_int(int fd, const char *mode, const char *persistent_id STREAMS_DC TSRMLS_DC) +static php_stream *_php_stream_fopen_from_fd_int(int fd, const char *mode, const char *persistent_id STREAMS_DC) { php_stdio_stream_data *self; @@ -174,7 +174,7 @@ static php_stream *_php_stream_fopen_from_fd_int(int fd, const char *mode, const return php_stream_alloc_rel(&php_stream_stdio_ops, self, persistent_id, mode); } -static php_stream *_php_stream_fopen_from_file_int(FILE *file, const char *mode STREAMS_DC TSRMLS_DC) +static php_stream *_php_stream_fopen_from_file_int(FILE *file, const char *mode STREAMS_DC) { php_stdio_stream_data *self; @@ -190,12 +190,12 @@ static php_stream *_php_stream_fopen_from_file_int(FILE *file, const char *mode return php_stream_alloc_rel(&php_stream_stdio_ops, self, 0, mode); } -PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path_ptr STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path_ptr STREAMS_DC) { char *opened_path = NULL; int fd; - fd = php_open_temporary_fd(dir, pfx, &opened_path TSRMLS_CC); + fd = php_open_temporary_fd(dir, pfx, &opened_path); if (fd != -1) { php_stream *stream; @@ -216,19 +216,19 @@ PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char } close(fd); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to allocate stream"); + php_error_docref(NULL, E_WARNING, "unable to allocate stream"); return NULL; } return NULL; } -PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC) { return php_stream_fopen_temporary_file(NULL, "php", NULL); } -PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const char *persistent_id STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const char *persistent_id STREAMS_DC) { php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id); @@ -267,7 +267,7 @@ PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const cha return stream; } -PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STREAMS_DC) { php_stream *stream = php_stream_fopen_from_file_int_rel(file, mode); @@ -299,7 +299,7 @@ PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STRE return stream; } -PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode STREAMS_DC) { php_stdio_stream_data *self; php_stream *stream; @@ -318,7 +318,7 @@ PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode STRE return stream; } -static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) +static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count) { php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract; @@ -345,7 +345,7 @@ static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count } } -static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count) { php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract; size_t ret; @@ -406,7 +406,7 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS return ret; } -static int php_stdiop_close(php_stream *stream, int close_handle TSRMLS_DC) +static int php_stdiop_close(php_stream *stream, int close_handle) { int ret; php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract; @@ -467,7 +467,7 @@ static int php_stdiop_close(php_stream *stream, int close_handle TSRMLS_DC) return ret; } -static int php_stdiop_flush(php_stream *stream TSRMLS_DC) +static int php_stdiop_flush(php_stream *stream) { php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract; @@ -484,7 +484,7 @@ static int php_stdiop_flush(php_stream *stream TSRMLS_DC) return 0; } -static int php_stdiop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC) +static int php_stdiop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset) { php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract; int ret; @@ -492,7 +492,7 @@ static int php_stdiop_seek(php_stream *stream, zend_off_t offset, int whence, ze assert(data != NULL); if (data->is_pipe) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot seek on a pipe"); + php_error_docref(NULL, E_WARNING, "cannot seek on a pipe"); return -1; } @@ -513,7 +513,7 @@ static int php_stdiop_seek(php_stream *stream, zend_off_t offset, int whence, ze } } -static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC) +static int php_stdiop_cast(php_stream *stream, int castas, void **ret) { php_socket_t fd; php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract; @@ -571,7 +571,7 @@ static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC) } } -static int php_stdiop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) +static int php_stdiop_stat(php_stream *stream, php_stream_statbuf *ssb) { int ret; php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract; @@ -583,7 +583,7 @@ static int php_stdiop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC return ret; } -static int php_stdiop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) +static int php_stdiop_set_option(php_stream *stream, int option, int value, void *ptrparam) { php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract; size_t size; @@ -846,7 +846,7 @@ PHPAPI php_stream_ops php_stream_stdio_ops = { /* }}} */ /* {{{ plain files opendir/readdir implementation */ -static size_t php_plain_files_dirstream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static size_t php_plain_files_dirstream_read(php_stream *stream, char *buf, size_t count) { DIR *dir = (DIR*)stream->abstract; /* avoid libc5 readdir problems */ @@ -865,12 +865,12 @@ static size_t php_plain_files_dirstream_read(php_stream *stream, char *buf, size return 0; } -static int php_plain_files_dirstream_close(php_stream *stream, int close_handle TSRMLS_DC) +static int php_plain_files_dirstream_close(php_stream *stream, int close_handle) { return closedir((DIR *)stream->abstract); } -static int php_plain_files_dirstream_rewind(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) +static int php_plain_files_dirstream_rewind(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs) { rewinddir((DIR *)stream->abstract); return 0; @@ -887,18 +887,18 @@ static php_stream_ops php_plain_files_dirstream_ops = { }; static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, - int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) + int options, char **opened_path, php_stream_context *context STREAMS_DC) { DIR *dir = NULL; php_stream *stream = NULL; #ifdef HAVE_GLOB if (options & STREAM_USE_GLOB_DIR_OPEN) { - return php_glob_stream_wrapper.wops->dir_opener(&php_glob_stream_wrapper, path, mode, options, opened_path, context STREAMS_REL_CC TSRMLS_CC); + return php_glob_stream_wrapper.wops->dir_opener(&php_glob_stream_wrapper, path, mode, options, opened_path, context STREAMS_REL_CC); } #endif - if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) { + if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path)) { return NULL; } @@ -906,7 +906,7 @@ static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, const #ifdef PHP_WIN32 if (!dir) { - php_win32_docref2_from_error(GetLastError(), path, path TSRMLS_CC); + php_win32_docref2_from_error(GetLastError(), path, path); } if (dir && dir->finished) { @@ -925,7 +925,7 @@ static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, const /* }}} */ /* {{{ php_stream_fopen */ -PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, char **opened_path, int options STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, char **opened_path, int options STREAMS_DC) { char *realpath = NULL; int open_flags; @@ -936,7 +936,7 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, cha if (FAILURE == php_stream_parse_fopen_modes(mode, &open_flags)) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "`%s' is not a valid mode for fopen", mode); + php_error_docref(NULL, E_WARNING, "`%s' is not a valid mode for fopen", mode); } return NULL; } @@ -944,14 +944,14 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, cha if (options & STREAM_ASSUME_REALPATH) { realpath = estrdup(filename); } else { - if ((realpath = expand_filepath(filename, NULL TSRMLS_CC)) == NULL) { + if ((realpath = expand_filepath(filename, NULL)) == NULL) { return NULL; } } if (persistent) { spprintf(&persistent_id, 0, "streams_stdio_%d_%s", open_flags, realpath); - switch (php_stream_from_persistent_id(persistent_id, &ret TSRMLS_CC)) { + switch (php_stream_from_persistent_id(persistent_id, &ret)) { case PHP_STREAM_PERSISTENT_SUCCESS: if (opened_path) { *opened_path = realpath; @@ -1025,22 +1025,22 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, cha static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, - int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) + int options, char **opened_path, php_stream_context *context STREAMS_DC) { - if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) { + if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path)) { return NULL; } return php_stream_fopen_rel(path, mode, opened_path, options); } -static int php_plain_files_url_stater(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) +static int php_plain_files_url_stater(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context) { if (strncasecmp(url, "file://", sizeof("file://") - 1) == 0) { url += sizeof("file://") - 1; } - if (php_check_open_basedir_ex(url, (flags & PHP_STREAM_URL_STAT_QUIET) ? 0 : 1 TSRMLS_CC)) { + if (php_check_open_basedir_ex(url, (flags & PHP_STREAM_URL_STAT_QUIET) ? 0 : 1)) { return -1; } @@ -1060,7 +1060,7 @@ static int php_plain_files_url_stater(php_stream_wrapper *wrapper, const char *u return VCWD_STAT(url, &ssb->sb); } -static int php_plain_files_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context) { int ret; @@ -1068,25 +1068,25 @@ static int php_plain_files_unlink(php_stream_wrapper *wrapper, const char *url, url += sizeof("file://") - 1; } - if (php_check_open_basedir(url TSRMLS_CC)) { + if (php_check_open_basedir(url)) { return 0; } ret = VCWD_UNLINK(url); if (ret == -1) { if (options & REPORT_ERRORS) { - php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(errno)); + php_error_docref1(NULL, url, E_WARNING, "%s", strerror(errno)); } return 0; } /* Clear stat cache (and realpath cache) */ - php_clear_stat_cache(1, NULL, 0 TSRMLS_CC); + php_clear_stat_cache(1, NULL, 0); return 1; } -static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context) { int ret; @@ -1096,11 +1096,11 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f #ifdef PHP_WIN32 if (!php_win32_check_trailing_space(url_from, (int)strlen(url_from))) { - php_win32_docref2_from_error(ERROR_INVALID_NAME, url_from, url_to TSRMLS_CC); + php_win32_docref2_from_error(ERROR_INVALID_NAME, url_from, url_to); return 0; } if (!php_win32_check_trailing_space(url_to, (int)strlen(url_to))) { - php_win32_docref2_from_error(ERROR_INVALID_NAME, url_from, url_to TSRMLS_CC); + php_win32_docref2_from_error(ERROR_INVALID_NAME, url_from, url_to); return 0; } #endif @@ -1113,7 +1113,7 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f url_to += sizeof("file://") - 1; } - if (php_check_open_basedir(url_from TSRMLS_CC) || php_check_open_basedir(url_to TSRMLS_CC)) { + if (php_check_open_basedir(url_from) || php_check_open_basedir(url_to)) { return 0; } @@ -1124,25 +1124,25 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f # ifdef EXDEV if (errno == EXDEV) { zend_stat_t sb; - if (php_copy_file(url_from, url_to TSRMLS_CC) == SUCCESS) { + if (php_copy_file(url_from, url_to) == SUCCESS) { if (VCWD_STAT(url_from, &sb) == 0) { # if !defined(TSRM_WIN32) && !defined(NETWARE) if (VCWD_CHMOD(url_to, sb.st_mode)) { if (errno == EPERM) { - php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno)); VCWD_UNLINK(url_from); return 1; } - php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno)); return 0; } if (VCWD_CHOWN(url_to, sb.st_uid, sb.st_gid)) { if (errno == EPERM) { - php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno)); VCWD_UNLINK(url_from); return 1; } - php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno)); return 0; } # endif @@ -1150,27 +1150,27 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f return 1; } } - php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno)); return 0; } # endif #endif #ifdef PHP_WIN32 - php_win32_docref2_from_error(GetLastError(), url_from, url_to TSRMLS_CC); + php_win32_docref2_from_error(GetLastError(), url_from, url_to); #else - php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno)); #endif return 0; } /* Clear stat cache (and realpath cache) */ - php_clear_stat_cache(1, NULL, 0 TSRMLS_CC); + php_clear_stat_cache(1, NULL, 0); return 1; } -static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, int mode, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, int mode, int options, php_stream_context *context) { int ret, recursive = options & PHP_STREAM_MKDIR_RECURSIVE; char *p; @@ -1180,7 +1180,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i } if (!recursive) { - ret = php_mkdir(dir, mode TSRMLS_CC); + ret = php_mkdir(dir, mode); } else { /* we look for directory separator from the end of string, thus hopefuly reducing our work load */ char *e; @@ -1189,8 +1189,8 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i int offset = 0; char buf[MAXPATHLEN]; - if (!expand_filepath_with_mode(dir, buf, NULL, 0, CWD_EXPAND TSRMLS_CC)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path"); + if (!expand_filepath_with_mode(dir, buf, NULL, 0, CWD_EXPAND )) { + php_error_docref(NULL, E_WARNING, "Invalid path"); return 0; } @@ -1227,8 +1227,8 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i } if (p == buf) { - ret = php_mkdir(dir, mode TSRMLS_CC); - } else if (!(ret = php_mkdir(buf, mode TSRMLS_CC))) { + ret = php_mkdir(dir, mode); + } else if (!(ret = php_mkdir(buf, mode))) { if (!p) { p = buf; } @@ -1239,7 +1239,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i if ((*(p+1) != '\0') && (ret = VCWD_MKDIR(buf, (mode_t)mode)) < 0) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + php_error_docref(NULL, E_WARNING, "%s", strerror(errno)); } break; } @@ -1256,35 +1256,35 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i } } -static int php_plain_files_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context) { if (strncasecmp(url, "file://", sizeof("file://") - 1) == 0) { url += sizeof("file://") - 1; } - if (php_check_open_basedir(url TSRMLS_CC)) { + if (php_check_open_basedir(url)) { return 0; } #if PHP_WIN32 if (!php_win32_check_trailing_space(url, (int)strlen(url))) { - php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(ENOENT)); + php_error_docref1(NULL, url, E_WARNING, "%s", strerror(ENOENT)); return 0; } #endif if (VCWD_RMDIR(url) < 0) { - php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(errno)); + php_error_docref1(NULL, url, E_WARNING, "%s", strerror(errno)); return 0; } /* Clear stat cache (and realpath cache) */ - php_clear_stat_cache(1, NULL, 0 TSRMLS_CC); + php_clear_stat_cache(1, NULL, 0); return 1; } -static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url, int option, void *value, php_stream_context *context TSRMLS_DC) +static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url, int option, void *value, php_stream_context *context) { struct utimbuf *newtime; #if !defined(WINDOWS) && !defined(NETWARE) @@ -1299,7 +1299,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url #if PHP_WIN32 if (!php_win32_check_trailing_space(url, url_len)) { - php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(ENOENT)); + php_error_docref1(NULL, url, E_WARNING, "%s", strerror(ENOENT)); return 0; } #endif @@ -1308,7 +1308,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url url += sizeof("file://") - 1; } - if (php_check_open_basedir(url TSRMLS_CC)) { + if (php_check_open_basedir(url)) { return 0; } @@ -1318,7 +1318,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url if (VCWD_ACCESS(url, F_OK) != 0) { FILE *file = VCWD_FOPEN(url, "w"); if (file == NULL) { - php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "Unable to create file %s because %s", url, strerror(errno)); + php_error_docref1(NULL, url, E_WARNING, "Unable to create file %s because %s", url, strerror(errno)); return 0; } fclose(file); @@ -1330,8 +1330,8 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url case PHP_STREAM_META_OWNER_NAME: case PHP_STREAM_META_OWNER: if(option == PHP_STREAM_META_OWNER_NAME) { - if(php_get_uid_by_name((char *)value, &uid TSRMLS_CC) != SUCCESS) { - php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "Unable to find uid for %s", (char *)value); + if(php_get_uid_by_name((char *)value, &uid) != SUCCESS) { + php_error_docref1(NULL, url, E_WARNING, "Unable to find uid for %s", (char *)value); return 0; } } else { @@ -1342,8 +1342,8 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url case PHP_STREAM_META_GROUP: case PHP_STREAM_META_GROUP_NAME: if(option == PHP_STREAM_META_OWNER_NAME) { - if(php_get_gid_by_name((char *)value, &gid TSRMLS_CC) != SUCCESS) { - php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "Unable to find gid for %s", (char *)value); + if(php_get_gid_by_name((char *)value, &gid) != SUCCESS) { + php_error_docref1(NULL, url, E_WARNING, "Unable to find gid for %s", (char *)value); return 0; } } else { @@ -1357,14 +1357,14 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url ret = VCWD_CHMOD(url, mode); break; default: - php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "Unknown option %d for stream_metadata", option); + php_error_docref1(NULL, url, E_WARNING, "Unknown option %d for stream_metadata", option); return 0; } if (ret == -1) { - php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "Operation failed: %s", strerror(errno)); + php_error_docref1(NULL, url, E_WARNING, "Operation failed: %s", strerror(errno)); return 0; } - php_clear_stat_cache(0, NULL, 0 TSRMLS_CC); + php_clear_stat_cache(0, NULL, 0); return 1; } @@ -1390,7 +1390,7 @@ PHPAPI php_stream_wrapper php_plain_files_wrapper = { }; /* {{{ php_stream_fopen_with_path */ -PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path, int options STREAMS_DC) { /* code ripped off from fopen_wrappers.c */ char *pathbuf, *end; @@ -1424,7 +1424,7 @@ PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char } - if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(filename TSRMLS_CC)) { + if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(filename)) { return NULL; } @@ -1436,7 +1436,7 @@ not_relative_path: /* Absolute path open */ if (IS_ABSOLUTE_PATH(filename, filename_length)) { - if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(filename TSRMLS_CC)) { + if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(filename)) { return NULL; } @@ -1447,17 +1447,17 @@ not_relative_path: if (IS_SLASH(filename[0])) { size_t cwd_len; char *cwd; - cwd = virtual_getcwd_ex(&cwd_len TSRMLS_CC); + cwd = virtual_getcwd_ex(&cwd_len); /* getcwd() will return always return [DRIVE_LETTER]:/) on windows. */ *(cwd+3) = '\0'; if (snprintf(trypath, MAXPATHLEN, "%s%s", cwd, filename) >= MAXPATHLEN) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path was truncated to %d", cwd, filename, MAXPATHLEN); + php_error_docref(NULL, E_NOTICE, "%s/%s path was truncated to %d", cwd, filename, MAXPATHLEN); } efree(cwd); - if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(trypath TSRMLS_CC)) { + if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(trypath)) { return NULL; } @@ -1473,8 +1473,8 @@ not_relative_path: /* append the calling scripts' current working directory * as a fall back case */ - if (zend_is_executing(TSRMLS_C)) { - exec_fname = zend_get_executed_filename(TSRMLS_C); + if (zend_is_executing()) { + exec_fname = zend_get_executed_filename(); exec_fname_length = (int)strlen(exec_fname); path_length = (int)strlen(path); @@ -1506,10 +1506,10 @@ not_relative_path: goto stream_skip; } if (snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename) >= MAXPATHLEN) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path was truncated to %d", ptr, filename, MAXPATHLEN); + php_error_docref(NULL, E_NOTICE, "%s/%s path was truncated to %d", ptr, filename, MAXPATHLEN); } - if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir_ex(trypath, 0 TSRMLS_CC)) { + if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir_ex(trypath, 0)) { goto stream_skip; } diff --git a/main/streams/streams.c b/main/streams/streams.c index c6420dc0d0..fab5d42eb3 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -55,7 +55,7 @@ PHPAPI int php_file_le_stream_filter(void) return le_stream_filter; } -PHPAPI HashTable *_php_stream_get_url_stream_wrappers_hash(TSRMLS_D) +PHPAPI HashTable *_php_stream_get_url_stream_wrappers_hash(void) { return (FG(stream_wrappers) ? FG(stream_wrappers) : &url_stream_wrappers_hash); } @@ -65,7 +65,7 @@ PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash_global(void) return &url_stream_wrappers_hash; } -static int _php_stream_release_context(zval *zv, void *pContext TSRMLS_DC) +static int _php_stream_release_context(zval *zv, void *pContext) { zend_resource *le = Z_RES_P(zv); if (le->ptr == pContext) { @@ -74,7 +74,7 @@ static int _php_stream_release_context(zval *zv, void *pContext TSRMLS_DC) return 0; } -static int forget_persistent_resource_id_numbers(zval *el TSRMLS_DC) +static int forget_persistent_resource_id_numbers(zval *el) { php_stream *stream; zend_resource *rsrc = Z_RES_P(el); @@ -94,7 +94,7 @@ fprintf(stderr, "forget_persistent: %s:%p\n", stream->ops->label, stream); if (PHP_STREAM_CONTEXT(stream)) { zend_hash_apply_with_argument(&EG(regular_list), _php_stream_release_context, - PHP_STREAM_CONTEXT(stream) TSRMLS_CC); + PHP_STREAM_CONTEXT(stream)); stream->ctx = NULL; } @@ -103,7 +103,7 @@ fprintf(stderr, "forget_persistent: %s:%p\n", stream->ops->label, stream); PHP_RSHUTDOWN_FUNCTION(streams) { - zend_hash_apply(&EG(persistent_list), forget_persistent_resource_id_numbers TSRMLS_CC); + zend_hash_apply(&EG(persistent_list), forget_persistent_resource_id_numbers); return SUCCESS; } @@ -116,7 +116,7 @@ PHPAPI php_stream *php_stream_encloses(php_stream *enclosing, php_stream *enclos return orig; } -PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream **stream TSRMLS_DC) +PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream **stream) { zend_resource *le; @@ -155,7 +155,7 @@ PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream * /* }}} */ -static zend_llist *php_get_wrapper_errors_list(php_stream_wrapper *wrapper TSRMLS_DC) +static zend_llist *php_get_wrapper_errors_list(php_stream_wrapper *wrapper) { if (!FG(wrapper_errors)) { return NULL; @@ -165,14 +165,14 @@ static zend_llist *php_get_wrapper_errors_list(php_stream_wrapper *wrapper TSRML } /* {{{ wrapper error reporting */ -void php_stream_display_wrapper_errors(php_stream_wrapper *wrapper, const char *path, const char *caption TSRMLS_DC) +void php_stream_display_wrapper_errors(php_stream_wrapper *wrapper, const char *path, const char *caption) { char *tmp = estrdup(path); char *msg; int free_msg = 0; if (wrapper) { - zend_llist *err_list = php_get_wrapper_errors_list(wrapper TSRMLS_CC); + zend_llist *err_list = php_get_wrapper_errors_list(wrapper); if (err_list) { size_t l = 0; int brlen; @@ -222,14 +222,14 @@ void php_stream_display_wrapper_errors(php_stream_wrapper *wrapper, const char * } php_strip_url_passwd(tmp); - php_error_docref1(NULL TSRMLS_CC, tmp, E_WARNING, "%s: %s", caption, msg); + php_error_docref1(NULL, tmp, E_WARNING, "%s: %s", caption, msg); efree(tmp); if (free_msg) { efree(msg); } } -void php_stream_tidy_wrapper_error_log(php_stream_wrapper *wrapper TSRMLS_DC) +void php_stream_tidy_wrapper_error_log(php_stream_wrapper *wrapper) { if (wrapper && FG(wrapper_errors)) { zend_hash_str_del(FG(wrapper_errors), (const char*)&wrapper, sizeof(wrapper)); @@ -247,7 +247,7 @@ static void wrapper_list_dtor(zval *item) { efree(list); } -PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options TSRMLS_DC, const char *fmt, ...) +PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options, const char *fmt, ...) { va_list args; char *buffer = NULL; @@ -257,7 +257,7 @@ PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int option va_end(args); if (options & REPORT_ERRORS || wrapper == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", buffer); + php_error_docref(NULL, E_WARNING, "%s", buffer); efree(buffer); } else { zend_llist *list = NULL; @@ -284,7 +284,7 @@ PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int option /* }}} */ /* allocate a new stream for a particular ops */ -PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract, const char *persistent_id, const char *mode STREAMS_DC TSRMLS_DC) /* {{{ */ +PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract, const char *persistent_id, const char *mode STREAMS_DC) /* {{{ */ { php_stream *ret; @@ -341,10 +341,10 @@ fprintf(stderr, "stream_alloc: %s:%p persistent=%s\n", ops->label, ret, persiste } /* }}} */ -PHPAPI int _php_stream_free_enclosed(php_stream *stream_enclosed, int close_options TSRMLS_DC) /* {{{ */ +PHPAPI int _php_stream_free_enclosed(php_stream *stream_enclosed, int close_options) /* {{{ */ { return _php_stream_free(stream_enclosed, - close_options | PHP_STREAM_FREE_IGNORE_ENCLOSING TSRMLS_CC); + close_options | PHP_STREAM_FREE_IGNORE_ENCLOSING); } /* }}} */ @@ -369,14 +369,14 @@ static const char *_php_stream_pretty_free_options(int close_options, char *out) } #endif -static int _php_stream_free_persistent(zval *zv, void *pStream TSRMLS_DC) +static int _php_stream_free_persistent(zval *zv, void *pStream) { zend_resource *le = Z_RES_P(zv); return le->ptr == pStream; } -PHPAPI int _php_stream_free(php_stream *stream, int close_options TSRMLS_DC) /* {{{ */ +PHPAPI int _php_stream_free(php_stream *stream, int close_options) /* {{{ */ { int ret = 1; int preserve_handle = close_options & PHP_STREAM_FREE_PRESERVE_HANDLE ? 1 : 0; @@ -426,7 +426,7 @@ PHPAPI int _php_stream_free(php_stream *stream, int close_options TSRMLS_DC) /* * enclosing stream can free this stream. We remove rsrc_dtor because * we want the enclosing stream to be deleted from the resource list */ return _php_stream_free(enclosing_stream, - (close_options | PHP_STREAM_FREE_CALL_DTOR) & ~PHP_STREAM_FREE_RSRC_DTOR TSRMLS_CC); + (close_options | PHP_STREAM_FREE_CALL_DTOR) & ~PHP_STREAM_FREE_RSRC_DTOR); } /* if we are releasing the stream only (and preserving the underlying handle), @@ -454,7 +454,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov #endif /* make sure everything is saved */ - _php_stream_flush(stream, 1 TSRMLS_CC); + _php_stream_flush(stream, 1); /* If not called from the resource dtor, remove the stream from the resource list. */ if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) == 0 && stream->res) { @@ -485,7 +485,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov return fclose(stream->stdiocast); } - ret = stream->ops->close(stream, preserve_handle ? 0 : 1 TSRMLS_CC); + ret = stream->ops->close(stream, preserve_handle ? 0 : 1); stream->abstract = NULL; /* tidy up any FILE* that might have been fdopened */ @@ -498,14 +498,14 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov if (close_options & PHP_STREAM_FREE_RELEASE_STREAM) { while (stream->readfilters.head) { - php_stream_filter_remove(stream->readfilters.head, 1 TSRMLS_CC); + php_stream_filter_remove(stream->readfilters.head, 1); } while (stream->writefilters.head) { - php_stream_filter_remove(stream->writefilters.head, 1 TSRMLS_CC); + php_stream_filter_remove(stream->writefilters.head, 1); } if (stream->wrapper && stream->wrapper->wops && stream->wrapper->wops->stream_closer) { - stream->wrapper->wops->stream_closer(stream->wrapper, stream TSRMLS_CC); + stream->wrapper->wops->stream_closer(stream->wrapper, stream); stream->wrapper = NULL; } @@ -521,7 +521,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov if (stream->is_persistent && (close_options & PHP_STREAM_FREE_PERSISTENT)) { /* we don't work with *stream but need its value for comparison */ - zend_hash_apply_with_argument(&EG(persistent_list), _php_stream_free_persistent, stream TSRMLS_CC); + zend_hash_apply_with_argument(&EG(persistent_list), _php_stream_free_persistent, stream); } #if ZEND_DEBUG if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) && (stream->__exposed == 0) && (EG(error_reporting) & E_WARNING)) { @@ -572,7 +572,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov /* {{{ generic stream operations */ -static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_DC) +static void php_stream_fill_read_buffer(php_stream *stream, size_t size) { /* allocate/fill the buffer */ @@ -597,12 +597,12 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D php_stream_filter *filter; /* read a chunk into a bucket */ - justread = stream->ops->read(stream, chunk_buf, stream->chunk_size TSRMLS_CC); + justread = stream->ops->read(stream, chunk_buf, stream->chunk_size); if (justread && justread != (size_t)-1) { - bucket = php_stream_bucket_new(stream, chunk_buf, justread, 0, 0 TSRMLS_CC); + bucket = php_stream_bucket_new(stream, chunk_buf, justread, 0, 0); /* after this call, bucket is owned by the brigade */ - php_stream_bucket_append(brig_inp, bucket TSRMLS_CC); + php_stream_bucket_append(brig_inp, bucket); flags = PSFS_FLAG_NORMAL; } else { @@ -611,7 +611,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D /* wind the handle... */ for (filter = stream->readfilters.head; filter; filter = filter->next) { - status = filter->fops->filter(stream, filter, brig_inp, brig_outp, NULL, flags TSRMLS_CC); + status = filter->fops->filter(stream, filter, brig_inp, brig_outp, NULL, flags); if (status != PSFS_PASS_ON) { break; @@ -643,8 +643,8 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); stream->writepos += bucket->buflen; - php_stream_bucket_unlink(bucket TSRMLS_CC); - php_stream_bucket_delref(bucket TSRMLS_CC); + php_stream_bucket_unlink(bucket); + php_stream_bucket_delref(bucket); } break; @@ -695,7 +695,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D justread = stream->ops->read(stream, (char*)stream->readbuf + stream->writepos, stream->readbuflen - stream->writepos - TSRMLS_CC); + ); if (justread != (size_t)-1) { stream->writepos += justread; @@ -704,7 +704,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D } } -PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t size TSRMLS_DC) +PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t size) { size_t toread = 0, didread = 0; @@ -734,13 +734,13 @@ PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t size TSRMLS } if (!stream->readfilters.head && (stream->flags & PHP_STREAM_FLAG_NO_BUFFER || stream->chunk_size == 1)) { - toread = stream->ops->read(stream, buf, size TSRMLS_CC); + toread = stream->ops->read(stream, buf, size); if (toread == (size_t) -1) { /* e.g. underlying read(2) returned -1 */ break; } } else { - php_stream_fill_read_buffer(stream, size TSRMLS_CC); + php_stream_fill_read_buffer(stream, size); toread = stream->writepos - stream->readpos; if (toread > size) { @@ -774,7 +774,7 @@ PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t size TSRMLS return didread; } -PHPAPI int _php_stream_eof(php_stream *stream TSRMLS_DC) +PHPAPI int _php_stream_eof(php_stream *stream) { /* if there is data in the buffer, it's not EOF */ if (stream->writepos - stream->readpos > 0) { @@ -791,7 +791,7 @@ PHPAPI int _php_stream_eof(php_stream *stream TSRMLS_DC) return stream->eof; } -PHPAPI int _php_stream_putc(php_stream *stream, int c TSRMLS_DC) +PHPAPI int _php_stream_putc(php_stream *stream, int c) { unsigned char buf = c; @@ -801,7 +801,7 @@ PHPAPI int _php_stream_putc(php_stream *stream, int c TSRMLS_DC) return EOF; } -PHPAPI int _php_stream_getc(php_stream *stream TSRMLS_DC) +PHPAPI int _php_stream_getc(php_stream *stream) { char buf; @@ -811,7 +811,7 @@ PHPAPI int _php_stream_getc(php_stream *stream TSRMLS_DC) return EOF; } -PHPAPI int _php_stream_puts(php_stream *stream, const char *buf TSRMLS_DC) +PHPAPI int _php_stream_puts(php_stream *stream, const char *buf) { size_t len; char newline[2] = "\n"; /* is this OK for Win? */ @@ -823,13 +823,13 @@ PHPAPI int _php_stream_puts(php_stream *stream, const char *buf TSRMLS_DC) return 0; } -PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) +PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb) { memset(ssb, 0, sizeof(*ssb)); /* if the stream was wrapped, allow the wrapper to stat it */ if (stream->wrapper && stream->wrapper->wops->stream_stat != NULL) { - return stream->wrapper->wops->stream_stat(stream->wrapper, stream, ssb TSRMLS_CC); + return stream->wrapper->wops->stream_stat(stream->wrapper, stream, ssb); } /* if the stream doesn't directly support stat-ing, return with failure. @@ -840,10 +840,10 @@ PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D return -1; } - return (stream->ops->stat)(stream, ssb TSRMLS_CC); + return (stream->ops->stat)(stream, ssb); } -PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf TSRMLS_DC) +PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf) { size_t avail; const char *cr, *lf, *eol = NULL; @@ -886,7 +886,7 @@ PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf TS * appropriate length to hold the line, regardless of the line length, memory * permitting */ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, - size_t *returned_len TSRMLS_DC) + size_t *returned_len) { size_t avail = 0; size_t current_buf_size = 0; @@ -923,7 +923,7 @@ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, int done = 0; readptr = (char*)stream->readbuf + stream->readpos; - eol = php_stream_locate_eol(stream, NULL TSRMLS_CC); + eol = php_stream_locate_eol(stream, NULL); if (eol) { cpysz = eol - readptr + 1; @@ -976,7 +976,7 @@ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, } } - php_stream_fill_read_buffer(stream, toread TSRMLS_CC); + php_stream_fill_read_buffer(stream, toread); if (stream->writepos - stream->readpos == 0) { break; @@ -1006,7 +1006,7 @@ static const char *_php_stream_search_delim(php_stream *stream, size_t maxlen, size_t skiplen, const char *delim, /* non-empty! */ - size_t delim_len TSRMLS_DC) + size_t delim_len) { size_t seek_len; @@ -1026,7 +1026,7 @@ static const char *_php_stream_search_delim(php_stream *stream, } } -PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, const char *delim, size_t delim_len TSRMLS_DC) +PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, const char *delim, size_t delim_len) { zend_string *ret_buf; /* returned buffer */ const char *found_delim = NULL; @@ -1040,7 +1040,7 @@ PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, con if (has_delim) { found_delim = _php_stream_search_delim( - stream, maxlen, 0, delim, delim_len TSRMLS_CC); + stream, maxlen, 0, delim, delim_len); } buffered_len = STREAM_BUFFERED_AMOUNT(stream); @@ -1051,7 +1051,7 @@ PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, con to_read_now = MIN(maxlen - buffered_len, stream->chunk_size); - php_stream_fill_read_buffer(stream, buffered_len + to_read_now TSRMLS_CC); + php_stream_fill_read_buffer(stream, buffered_len + to_read_now); just_read = STREAM_BUFFERED_AMOUNT(stream) - buffered_len; @@ -1073,7 +1073,7 @@ PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, con buffered_len >= (delim_len - 1) ? buffered_len - (delim_len - 1) : 0, - delim, delim_len TSRMLS_CC); + delim, delim_len); if (found_delim) { break; } @@ -1115,7 +1115,7 @@ PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, con } /* Writes a buffer directly to a stream, using multiple of the chunk size */ -static size_t _php_stream_write_buffer(php_stream *stream, const char *buf, size_t count TSRMLS_DC) +static size_t _php_stream_write_buffer(php_stream *stream, const char *buf, size_t count) { size_t didwrite = 0, towrite, justwrote; @@ -1125,7 +1125,7 @@ static size_t _php_stream_write_buffer(php_stream *stream, const char *buf, size if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0 && stream->readpos != stream->writepos) { stream->readpos = stream->writepos = 0; - stream->ops->seek(stream, stream->position, SEEK_SET, &stream->position TSRMLS_CC); + stream->ops->seek(stream, stream->position, SEEK_SET, &stream->position); } @@ -1134,7 +1134,7 @@ static size_t _php_stream_write_buffer(php_stream *stream, const char *buf, size if (towrite > stream->chunk_size) towrite = stream->chunk_size; - justwrote = stream->ops->write(stream, buf, towrite TSRMLS_CC); + justwrote = stream->ops->write(stream, buf, towrite); /* convert justwrote to an integer, since normally it is unsigned */ if ((int)justwrote > 0) { @@ -1160,7 +1160,7 @@ static size_t _php_stream_write_buffer(php_stream *stream, const char *buf, size * This may trigger a real write to the stream. * Returns the number of bytes consumed from buf by the first filter in the chain. * */ -static size_t _php_stream_write_filtered(php_stream *stream, const char *buf, size_t count, int flags TSRMLS_DC) +static size_t _php_stream_write_filtered(php_stream *stream, const char *buf, size_t count, int flags) { size_t consumed = 0; php_stream_bucket *bucket; @@ -1170,15 +1170,15 @@ static size_t _php_stream_write_filtered(php_stream *stream, const char *buf, si php_stream_filter *filter; if (buf) { - bucket = php_stream_bucket_new(stream, (char *)buf, count, 0, 0 TSRMLS_CC); - php_stream_bucket_append(&brig_in, bucket TSRMLS_CC); + bucket = php_stream_bucket_new(stream, (char *)buf, count, 0, 0); + php_stream_bucket_append(&brig_in, bucket); } for (filter = stream->writefilters.head; filter; filter = filter->next) { /* for our return value, we are interested in the number of bytes consumed from * the first filter in the chain */ status = filter->fops->filter(stream, filter, brig_inp, brig_outp, - filter == stream->writefilters.head ? &consumed : NULL, flags TSRMLS_CC); + filter == stream->writefilters.head ? &consumed : NULL, flags); if (status != PSFS_PASS_ON) { break; @@ -1198,14 +1198,14 @@ static size_t _php_stream_write_filtered(php_stream *stream, const char *buf, si * underlying stream */ while (brig_inp->head) { bucket = brig_inp->head; - _php_stream_write_buffer(stream, bucket->buf, bucket->buflen TSRMLS_CC); + _php_stream_write_buffer(stream, bucket->buf, bucket->buflen); /* Potential error situation - eg: no space on device. Perhaps we should keep this brigade * hanging around and try to write it later. * At the moment, we just drop it on the floor * */ - php_stream_bucket_unlink(bucket TSRMLS_CC); - php_stream_bucket_delref(bucket TSRMLS_CC); + php_stream_bucket_unlink(bucket); + php_stream_bucket_delref(bucket); } break; case PSFS_FEED_ME: @@ -1221,35 +1221,35 @@ static size_t _php_stream_write_filtered(php_stream *stream, const char *buf, si return consumed; } -PHPAPI int _php_stream_flush(php_stream *stream, int closing TSRMLS_DC) +PHPAPI int _php_stream_flush(php_stream *stream, int closing) { int ret = 0; if (stream->writefilters.head) { - _php_stream_write_filtered(stream, NULL, 0, closing ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_FLUSH_INC TSRMLS_CC); + _php_stream_write_filtered(stream, NULL, 0, closing ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_FLUSH_INC ); } if (stream->ops->flush) { - ret = stream->ops->flush(stream TSRMLS_CC); + ret = stream->ops->flush(stream); } return ret; } -PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) +PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t count) { if (buf == NULL || count == 0 || stream->ops->write == NULL) { return 0; } if (stream->writefilters.head) { - return _php_stream_write_filtered(stream, buf, count, PSFS_FLAG_NORMAL TSRMLS_CC); + return _php_stream_write_filtered(stream, buf, count, PSFS_FLAG_NORMAL); } else { - return _php_stream_write_buffer(stream, buf, count TSRMLS_CC); + return _php_stream_write_buffer(stream, buf, count); } } -PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char *fmt, ...) +PHPAPI size_t _php_stream_printf(php_stream *stream, const char *fmt, ...) { size_t count; char *buf; @@ -1269,12 +1269,12 @@ PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char *fmt, return count; } -PHPAPI zend_off_t _php_stream_tell(php_stream *stream TSRMLS_DC) +PHPAPI zend_off_t _php_stream_tell(php_stream *stream) { return stream->position; } -PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence TSRMLS_DC) +PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence) { if (stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) { /* flush to commit data written to the fopencookie FILE* */ @@ -1309,7 +1309,7 @@ PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence TS int ret; if (stream->writefilters.head) { - _php_stream_flush(stream, 0 TSRMLS_CC); + _php_stream_flush(stream, 0); } switch(whence) { @@ -1318,7 +1318,7 @@ PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence TS whence = SEEK_SET; break; } - ret = stream->ops->seek(stream, offset, whence, &stream->position TSRMLS_CC); + ret = stream->ops->seek(stream, offset, whence, &stream->position); if (((stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) || ret == 0) { if (ret == 0) { @@ -1348,17 +1348,17 @@ PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence TS return 0; } - php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream does not support seeking"); + php_error_docref(NULL, E_WARNING, "stream does not support seeking"); return -1; } -PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) +PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, void *ptrparam) { int ret = PHP_STREAM_OPTION_RETURN_NOTIMPL; if (stream->ops->set_option) { - ret = stream->ops->set_option(stream, option, value, ptrparam TSRMLS_CC); + ret = stream->ops->set_option(stream, option, value, ptrparam); } if (ret == PHP_STREAM_OPTION_RETURN_NOTIMPL) { @@ -1387,12 +1387,12 @@ PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, voi return ret; } -PHPAPI int _php_stream_truncate_set_size(php_stream *stream, size_t newsize TSRMLS_DC) +PHPAPI int _php_stream_truncate_set_size(php_stream *stream, size_t newsize) { return php_stream_set_option(stream, PHP_STREAM_OPTION_TRUNCATE_API, PHP_STREAM_TRUNCATE_SET_SIZE, &newsize); } -PHPAPI size_t _php_stream_passthru(php_stream * stream STREAMS_DC TSRMLS_DC) +PHPAPI size_t _php_stream_passthru(php_stream * stream STREAMS_DC) { size_t bcount = 0; char buf[8192]; @@ -1427,7 +1427,7 @@ PHPAPI size_t _php_stream_passthru(php_stream * stream STREAMS_DC TSRMLS_DC) } -PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int persistent STREAMS_DC TSRMLS_DC) +PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int persistent STREAMS_DC) { size_t ret = 0; char *ptr; @@ -1503,7 +1503,7 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int } /* Returns SUCCESS/FAILURE and sets *len to the number of bytes moved */ -PHPAPI int _php_stream_copy_to_stream_ex(php_stream *src, php_stream *dest, size_t maxlen, size_t *len STREAMS_DC TSRMLS_DC) +PHPAPI int _php_stream_copy_to_stream_ex(php_stream *src, php_stream *dest, size_t maxlen, size_t *len STREAMS_DC) { char buf[CHUNK_SIZE]; size_t readchunk; @@ -1610,10 +1610,10 @@ PHPAPI int _php_stream_copy_to_stream_ex(php_stream *src, php_stream *dest, size * Returns 1 when source len is 0. * Deprecated in favor of php_stream_copy_to_stream_ex() */ ZEND_ATTRIBUTE_DEPRECATED -PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC) +PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC) { size_t len; - int ret = _php_stream_copy_to_stream_ex(src, dest, maxlen, &len STREAMS_REL_CC TSRMLS_CC); + int ret = _php_stream_copy_to_stream_ex(src, dest, maxlen, &len STREAMS_REL_CC); if (ret == SUCCESS && len == 0 && maxlen != 0) { return 1; } @@ -1623,20 +1623,20 @@ PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size /* {{{ wrapper init and registration */ -static void stream_resource_regular_dtor(zend_resource *rsrc TSRMLS_DC) +static void stream_resource_regular_dtor(zend_resource *rsrc) { php_stream *stream = (php_stream*)rsrc->ptr; /* set the return value for pclose */ FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR); } -static void stream_resource_persistent_dtor(zend_resource *rsrc TSRMLS_DC) +static void stream_resource_persistent_dtor(zend_resource *rsrc) { php_stream *stream = (php_stream*)rsrc->ptr; FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR); } -void php_shutdown_stream_hashes(TSRMLS_D) +void php_shutdown_stream_hashes(void) { if (FG(stream_wrappers)) { zend_hash_destroy(FG(stream_wrappers)); @@ -1657,7 +1657,7 @@ void php_shutdown_stream_hashes(TSRMLS_D) } } -int php_init_stream_wrappers(int module_number TSRMLS_DC) +int php_init_stream_wrappers(int module_number) { le_stream = zend_register_list_destructors_ex(stream_resource_regular_dtor, NULL, "stream", module_number); le_pstream = zend_register_list_destructors_ex(NULL, stream_resource_persistent_dtor, "persistent stream", module_number); @@ -1669,19 +1669,19 @@ int php_init_stream_wrappers(int module_number TSRMLS_DC) zend_hash_init(php_get_stream_filters_hash_global(), 8, NULL, NULL, 1); zend_hash_init(php_stream_xport_get_hash(), 8, NULL, NULL, 1); - return (php_stream_xport_register("tcp", php_stream_generic_socket_factory TSRMLS_CC) == SUCCESS + return (php_stream_xport_register("tcp", php_stream_generic_socket_factory) == SUCCESS && - php_stream_xport_register("udp", php_stream_generic_socket_factory TSRMLS_CC) == SUCCESS + php_stream_xport_register("udp", php_stream_generic_socket_factory) == SUCCESS #if defined(AF_UNIX) && !(defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)) && - php_stream_xport_register("unix", php_stream_generic_socket_factory TSRMLS_CC) == SUCCESS + php_stream_xport_register("unix", php_stream_generic_socket_factory) == SUCCESS && - php_stream_xport_register("udg", php_stream_generic_socket_factory TSRMLS_CC) == SUCCESS + php_stream_xport_register("udg", php_stream_generic_socket_factory) == SUCCESS #endif ) ? SUCCESS : FAILURE; } -int php_shutdown_stream_wrappers(int module_number TSRMLS_DC) +int php_shutdown_stream_wrappers(int module_number) { zend_hash_destroy(&url_stream_wrappers_hash); zend_hash_destroy(php_get_stream_filters_hash_global()); @@ -1709,7 +1709,7 @@ static inline int php_stream_wrapper_scheme_validate(const char *protocol, unsig } /* API for registering GLOBAL wrappers */ -PHPAPI int php_register_url_stream_wrapper(const char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) +PHPAPI int php_register_url_stream_wrapper(const char *protocol, php_stream_wrapper *wrapper) { unsigned int protocol_len = (unsigned int)strlen(protocol); @@ -1720,12 +1720,12 @@ PHPAPI int php_register_url_stream_wrapper(const char *protocol, php_stream_wrap return zend_hash_str_add_ptr(&url_stream_wrappers_hash, protocol, protocol_len, wrapper) ? SUCCESS : FAILURE; } -PHPAPI int php_unregister_url_stream_wrapper(const char *protocol TSRMLS_DC) +PHPAPI int php_unregister_url_stream_wrapper(const char *protocol) { return zend_hash_str_del(&url_stream_wrappers_hash, protocol, strlen(protocol)); } -static void clone_wrapper_hash(TSRMLS_D) +static void clone_wrapper_hash(void) { ALLOC_HASHTABLE(FG(stream_wrappers)); zend_hash_init(FG(stream_wrappers), zend_hash_num_elements(&url_stream_wrappers_hash), NULL, NULL, 1); @@ -1733,7 +1733,7 @@ static void clone_wrapper_hash(TSRMLS_D) } /* API for registering VOLATILE wrappers */ -PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) +PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_stream_wrapper *wrapper) { unsigned int protocol_len = (unsigned int)strlen(protocol); @@ -1742,16 +1742,16 @@ PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_st } if (!FG(stream_wrappers)) { - clone_wrapper_hash(TSRMLS_C); + clone_wrapper_hash(); } return zend_hash_str_add_ptr(FG(stream_wrappers), protocol, protocol_len, wrapper) ? SUCCESS : FAILURE; } -PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol TSRMLS_DC) +PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol) { if (!FG(stream_wrappers)) { - clone_wrapper_hash(TSRMLS_C); + clone_wrapper_hash(); } return zend_hash_str_del(FG(stream_wrappers), protocol, strlen(protocol)); @@ -1759,7 +1759,7 @@ PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol TSRML /* }}} */ /* {{{ php_stream_locate_url_wrapper */ -PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options TSRMLS_DC) +PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options) { HashTable *wrapper_hash = (FG(stream_wrappers) ? FG(stream_wrappers) : &url_stream_wrappers_hash); php_stream_wrapper *wrapper = NULL; @@ -1784,7 +1784,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const /* BC with older php scripts and zlib wrapper */ protocol = "compress.zlib"; n = 13; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Use of \"zlib:\" wrapper is deprecated; please use \"compress.zlib://\" instead"); + php_error_docref(NULL, E_WARNING, "Use of \"zlib:\" wrapper is deprecated; please use \"compress.zlib://\" instead"); } if (protocol) { @@ -1799,7 +1799,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const } PHP_STRLCPY(wrapper_name, protocol, sizeof(wrapper_name), n); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find the wrapper \"%s\" - did you forget to enable it when you configured PHP?", wrapper_name); + php_error_docref(NULL, E_WARNING, "Unable to find the wrapper \"%s\" - did you forget to enable it when you configured PHP?", wrapper_name); wrapper = NULL; protocol = NULL; @@ -1825,7 +1825,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const if (localhost == 0 && path[n+3] != '\0' && path[n+3] != '/') { #endif if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "remote host file access not supported, %s", path); + php_error_docref(NULL, E_WARNING, "remote host file access not supported, %s", path); } return NULL; } @@ -1862,7 +1862,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const } if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "file:// wrapper is disabled in the server configuration"); + php_error_docref(NULL, E_WARNING, "file:// wrapper is disabled in the server configuration"); } return NULL; } @@ -1879,9 +1879,9 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const /* protocol[n] probably isn't '\0' */ char *protocol_dup = estrndup(protocol, n); if (!PG(allow_url_fopen)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s:// wrapper is disabled in the server configuration by allow_url_fopen=0", protocol_dup); + php_error_docref(NULL, E_WARNING, "%s:// wrapper is disabled in the server configuration by allow_url_fopen=0", protocol_dup); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s:// wrapper is disabled in the server configuration by allow_url_include=0", protocol_dup); + php_error_docref(NULL, E_WARNING, "%s:// wrapper is disabled in the server configuration by allow_url_include=0", protocol_dup); } efree(protocol_dup); } @@ -1894,36 +1894,36 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const /* {{{ _php_stream_mkdir */ -PHPAPI int _php_stream_mkdir(const char *path, int mode, int options, php_stream_context *context TSRMLS_DC) +PHPAPI int _php_stream_mkdir(const char *path, int mode, int options, php_stream_context *context) { php_stream_wrapper *wrapper = NULL; - wrapper = php_stream_locate_url_wrapper(path, NULL, 0 TSRMLS_CC); + wrapper = php_stream_locate_url_wrapper(path, NULL, 0); if (!wrapper || !wrapper->wops || !wrapper->wops->stream_mkdir) { return 0; } - return wrapper->wops->stream_mkdir(wrapper, path, mode, options, context TSRMLS_CC); + return wrapper->wops->stream_mkdir(wrapper, path, mode, options, context); } /* }}} */ /* {{{ _php_stream_rmdir */ -PHPAPI int _php_stream_rmdir(const char *path, int options, php_stream_context *context TSRMLS_DC) +PHPAPI int _php_stream_rmdir(const char *path, int options, php_stream_context *context) { php_stream_wrapper *wrapper = NULL; - wrapper = php_stream_locate_url_wrapper(path, NULL, 0 TSRMLS_CC); + wrapper = php_stream_locate_url_wrapper(path, NULL, 0); if (!wrapper || !wrapper->wops || !wrapper->wops->stream_rmdir) { return 0; } - return wrapper->wops->stream_rmdir(wrapper, path, options, context TSRMLS_CC); + return wrapper->wops->stream_rmdir(wrapper, path, options, context); } /* }}} */ /* {{{ _php_stream_stat_path */ -PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) +PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf *ssb, php_stream_context *context) { php_stream_wrapper *wrapper = NULL; const char *path_to_open = path; @@ -1944,9 +1944,9 @@ PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf } } - wrapper = php_stream_locate_url_wrapper(path, &path_to_open, 0 TSRMLS_CC); + wrapper = php_stream_locate_url_wrapper(path, &path_to_open, 0); if (wrapper && wrapper->wops->url_stat) { - ret = wrapper->wops->url_stat(wrapper, path_to_open, flags, ssb, context TSRMLS_CC); + ret = wrapper->wops->url_stat(wrapper, path_to_open, flags, ssb, context); if (ret == 0) { if (!(flags & PHP_STREAM_URL_STAT_NOCACHE)) { /* Drop into cache */ @@ -1973,7 +1973,7 @@ PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf /* {{{ php_stream_opendir */ PHPAPI php_stream *_php_stream_opendir(const char *path, int options, - php_stream_context *context STREAMS_DC TSRMLS_DC) + php_stream_context *context STREAMS_DC) { php_stream *stream = NULL; php_stream_wrapper *wrapper = NULL; @@ -1985,31 +1985,31 @@ PHPAPI php_stream *_php_stream_opendir(const char *path, int options, path_to_open = path; - wrapper = php_stream_locate_url_wrapper(path, &path_to_open, options TSRMLS_CC); + wrapper = php_stream_locate_url_wrapper(path, &path_to_open, options); if (wrapper && wrapper->wops->dir_opener) { stream = wrapper->wops->dir_opener(wrapper, path_to_open, "r", options ^ REPORT_ERRORS, NULL, - context STREAMS_REL_CC TSRMLS_CC); + context STREAMS_REL_CC); if (stream) { stream->wrapper = wrapper; stream->flags |= PHP_STREAM_FLAG_NO_BUFFER | PHP_STREAM_FLAG_IS_DIR; } } else if (wrapper) { - php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS TSRMLS_CC, "not implemented"); + php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS, "not implemented"); } if (stream == NULL && (options & REPORT_ERRORS)) { - php_stream_display_wrapper_errors(wrapper, path, "failed to open dir" TSRMLS_CC); + php_stream_display_wrapper_errors(wrapper, path, "failed to open dir"); } - php_stream_tidy_wrapper_error_log(wrapper TSRMLS_CC); + php_stream_tidy_wrapper_error_log(wrapper); return stream; } /* }}} */ /* {{{ _php_stream_readdir */ -PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_dirent *ent TSRMLS_DC) +PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_dirent *ent) { if (sizeof(php_stream_dirent) == php_stream_read(dirstream, (char*)ent, sizeof(php_stream_dirent))) { @@ -2022,7 +2022,7 @@ PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_ /* {{{ php_stream_open_wrapper_ex */ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mode, int options, - char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) + char **opened_path, php_stream_context *context STREAMS_DC) { php_stream *stream = NULL; php_stream_wrapper *wrapper = NULL; @@ -2036,12 +2036,12 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod } if (!path || !*path) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filename cannot be empty"); + php_error_docref(NULL, E_WARNING, "Filename cannot be empty"); return NULL; } if (options & USE_PATH) { - resolved_path = zend_resolve_path(path, (int)strlen(path) TSRMLS_CC); + resolved_path = zend_resolve_path(path, (int)strlen(path)); if (resolved_path) { path = resolved_path; /* we've found this file, don't re-check include_path or run realpath */ @@ -2052,9 +2052,9 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod path_to_open = path; - wrapper = php_stream_locate_url_wrapper(path, &path_to_open, options TSRMLS_CC); + wrapper = php_stream_locate_url_wrapper(path, &path_to_open, options); if (options & STREAM_USE_URL && (!wrapper || !wrapper->is_url)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "This function may only be used against URLs"); + php_error_docref(NULL, E_WARNING, "This function may only be used against URLs"); if (resolved_path) { efree(resolved_path); } @@ -2063,18 +2063,18 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod if (wrapper) { if (!wrapper->wops->stream_opener) { - php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS TSRMLS_CC, + php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS, "wrapper does not support stream open"); } else { stream = wrapper->wops->stream_opener(wrapper, path_to_open, mode, options ^ REPORT_ERRORS, - opened_path, context STREAMS_REL_CC TSRMLS_CC); + opened_path, context STREAMS_REL_CC); } /* if the caller asked for a persistent stream but the wrapper did not * return one, force an error here */ if (stream && (options & STREAM_OPEN_PERSISTENT) && !stream->is_persistent) { - php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS TSRMLS_CC, + php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS, "wrapper does not support persistent streams"); php_stream_close(stream); stream = NULL; @@ -2127,7 +2127,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod if (options & REPORT_ERRORS) { char *tmp = estrdup(path); php_strip_url_passwd(tmp); - php_error_docref1(NULL TSRMLS_CC, tmp, E_WARNING, "could not make seekable - %s", + php_error_docref1(NULL, tmp, E_WARNING, "could not make seekable - %s", tmp); efree(tmp); @@ -2140,19 +2140,19 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod zend_off_t newpos = 0; /* if opened for append, we need to revise our idea of the initial file position */ - if (0 == stream->ops->seek(stream, 0, SEEK_CUR, &newpos TSRMLS_CC)) { + if (0 == stream->ops->seek(stream, 0, SEEK_CUR, &newpos)) { stream->position = newpos; } } if (stream == NULL && (options & REPORT_ERRORS)) { - php_stream_display_wrapper_errors(wrapper, path, "failed to open stream" TSRMLS_CC); + php_stream_display_wrapper_errors(wrapper, path, "failed to open stream"); if (opened_path && *opened_path) { efree(*opened_path); *opened_path = NULL; } } - php_stream_tidy_wrapper_error_log(wrapper TSRMLS_CC); + php_stream_tidy_wrapper_error_log(wrapper); #if ZEND_DEBUG if (stream == NULL && copy_of_path != NULL) { pefree(copy_of_path, persistent); @@ -2166,7 +2166,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod /* }}} */ /* {{{ context API */ -PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context TSRMLS_DC) +PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context) { php_stream_context *oldcontext = PHP_STREAM_CONTEXT(stream); @@ -2184,10 +2184,10 @@ PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream } PHPAPI void php_stream_notification_notify(php_stream_context *context, int notifycode, int severity, - char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, void * ptr TSRMLS_DC) + char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, void * ptr) { if (context && context->notifier) - context->notifier->func(context, notifycode, severity, xmsg, xcode, bytes_sofar, bytes_max, ptr TSRMLS_CC); + context->notifier->func(context, notifycode, severity, xmsg, xcode, bytes_sofar, bytes_max, ptr); } PHPAPI void php_stream_context_free(php_stream_context *context) @@ -2203,7 +2203,7 @@ PHPAPI void php_stream_context_free(php_stream_context *context) efree(context); } -PHPAPI php_stream_context *php_stream_context_alloc(TSRMLS_D) +PHPAPI php_stream_context *php_stream_context_alloc(void) { php_stream_context *context; @@ -2211,7 +2211,7 @@ PHPAPI php_stream_context *php_stream_context_alloc(TSRMLS_D) context->notifier = NULL; array_init(&context->options); - context->res = ZEND_REGISTER_RESOURCE(NULL, context, php_le_stream_context(TSRMLS_C)); + context->res = ZEND_REGISTER_RESOURCE(NULL, context, php_le_stream_context()); return context; } @@ -2278,7 +2278,7 @@ PHPAPI int php_stream_dirent_alphasortr(const zend_string **a, const zend_string /* {{{ php_stream_scandir */ PHPAPI int _php_stream_scandir(const char *dirname, zend_string **namelist[], int flags, php_stream_context *context, - int (*compare) (const zend_string **a, const zend_string **b) TSRMLS_DC) + int (*compare) (const zend_string **a, const zend_string **b)) { php_stream *stream; php_stream_dirent sdp; diff --git a/main/streams/transports.c b/main/streams/transports.c index 8fd0b91d35..6c68f839be 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -29,23 +29,23 @@ PHPAPI HashTable *php_stream_xport_get_hash(void) return &xport_hash; } -PHPAPI int php_stream_xport_register(const char *protocol, php_stream_transport_factory factory TSRMLS_DC) +PHPAPI int php_stream_xport_register(const char *protocol, php_stream_transport_factory factory) { return zend_hash_str_update_ptr(&xport_hash, protocol, strlen(protocol), factory) ? SUCCESS : FAILURE; } -PHPAPI int php_stream_xport_unregister(const char *protocol TSRMLS_DC) +PHPAPI int php_stream_xport_unregister(const char *protocol) { return zend_hash_str_del(&xport_hash, protocol, strlen(protocol)); } #define ERR_REPORT(out_err, fmt, arg) \ if (out_err) { *out_err = strpprintf(0, fmt, arg); } \ - else { php_error_docref(NULL TSRMLS_CC, E_WARNING, fmt, arg); } + else { php_error_docref(NULL, E_WARNING, fmt, arg); } #define ERR_RETURN(out_err, local_err, fmt) \ if (out_err) { *out_err = local_err; } \ - else { php_error_docref(NULL TSRMLS_CC, E_WARNING, fmt, local_err ? local_err->val : "Unspecified error"); \ + else { php_error_docref(NULL, E_WARNING, fmt, local_err ? local_err->val : "Unspecified error"); \ if (local_err) { zend_string_release(local_err); local_err = NULL; } \ } @@ -55,7 +55,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in php_stream_context *context, zend_string **error_string, int *error_code - STREAMS_DC TSRMLS_DC) + STREAMS_DC) { php_stream *stream = NULL; php_stream_transport_factory factory = NULL; @@ -72,7 +72,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in /* check for a cached persistent socket */ if (persistent_id) { - switch(php_stream_from_persistent_id(persistent_id, &stream TSRMLS_CC)) { + switch(php_stream_from_persistent_id(persistent_id, &stream)) { case PHP_STREAM_PERSISTENT_SUCCESS: /* use a 0 second timeout when checking if the socket * has already died */ @@ -125,16 +125,16 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in if (factory == NULL) { /* should never happen */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not find a factory !?"); + php_error_docref(NULL, E_WARNING, "Could not find a factory !?"); return NULL; } stream = (factory)(protocol, n, (char*)name, namelen, persistent_id, options, flags, timeout, - context STREAMS_REL_CC TSRMLS_CC); + context STREAMS_REL_CC); if (stream) { - php_stream_context_set(stream, context TSRMLS_CC); + php_stream_context_set(stream, context); if ((flags & STREAM_XPORT_SERVER) == 0) { /* client */ @@ -142,7 +142,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in if (flags & (STREAM_XPORT_CONNECT|STREAM_XPORT_CONNECT_ASYNC)) { if (-1 == php_stream_xport_connect(stream, name, namelen, flags & STREAM_XPORT_CONNECT_ASYNC ? 1 : 0, - timeout, &error_text, error_code TSRMLS_CC)) { + timeout, &error_text, error_code)) { ERR_RETURN(error_string, error_text, "connect() failed: %s"); @@ -153,7 +153,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in } else { /* server */ if (flags & STREAM_XPORT_BIND) { - if (0 != php_stream_xport_bind(stream, name, namelen, &error_text TSRMLS_CC)) { + if (0 != php_stream_xport_bind(stream, name, namelen, &error_text)) { ERR_RETURN(error_string, error_text, "bind() failed: %s"); failed = 1; } else if (flags & STREAM_XPORT_LISTEN) { @@ -170,7 +170,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in } } - if (0 != php_stream_xport_listen(stream, backlog, &error_text TSRMLS_CC)) { + if (0 != php_stream_xport_listen(stream, backlog, &error_text)) { ERR_RETURN(error_string, error_text, "listen() failed: %s"); failed = 1; } @@ -196,7 +196,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in PHPAPI int php_stream_xport_bind(php_stream *stream, const char *name, size_t namelen, zend_string **error_text - TSRMLS_DC) + ) { php_stream_xport_param param; int ret; @@ -227,7 +227,7 @@ PHPAPI int php_stream_xport_connect(php_stream *stream, struct timeval *timeout, zend_string **error_text, int *error_code - TSRMLS_DC) + ) { php_stream_xport_param param; int ret; @@ -257,7 +257,7 @@ PHPAPI int php_stream_xport_connect(php_stream *stream, } /* Prepare to listen */ -PHPAPI int php_stream_xport_listen(php_stream *stream, int backlog, zend_string **error_text TSRMLS_DC) +PHPAPI int php_stream_xport_listen(php_stream *stream, int backlog, zend_string **error_text) { php_stream_xport_param param; int ret; @@ -286,7 +286,7 @@ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, void **addr, socklen_t *addrlen, struct timeval *timeout, zend_string **error_text - TSRMLS_DC) + ) { php_stream_xport_param param; int ret; @@ -322,7 +322,7 @@ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer, zend_string **textaddr, void **addr, socklen_t *addrlen - TSRMLS_DC) + ) { php_stream_xport_param param; int ret; @@ -349,7 +349,7 @@ PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer, return ret; } -PHPAPI int php_stream_xport_crypto_setup(php_stream *stream, php_stream_xport_crypt_method_t crypto_method, php_stream *session_stream TSRMLS_DC) +PHPAPI int php_stream_xport_crypto_setup(php_stream *stream, php_stream_xport_crypt_method_t crypto_method, php_stream *session_stream) { php_stream_xport_crypto_param param; int ret; @@ -365,12 +365,12 @@ PHPAPI int php_stream_xport_crypto_setup(php_stream *stream, php_stream_xport_cr return param.outputs.returncode; } - php_error_docref("streams.crypto" TSRMLS_CC, E_WARNING, "this stream does not support SSL/crypto"); + php_error_docref("streams.crypto", E_WARNING, "this stream does not support SSL/crypto"); return ret; } -PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate TSRMLS_DC) +PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate) { php_stream_xport_crypto_param param; int ret; @@ -385,7 +385,7 @@ PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate TSRML return param.outputs.returncode; } - php_error_docref("streams.crypto" TSRMLS_CC, E_WARNING, "this stream does not support SSL/crypto"); + php_error_docref("streams.crypto", E_WARNING, "this stream does not support SSL/crypto"); return ret; } @@ -394,7 +394,7 @@ PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate TSRML * peeking, optionally retrieving OOB data */ PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t buflen, int flags, void **addr, socklen_t *addrlen, zend_string **textaddr - TSRMLS_DC) + ) { php_stream_xport_param param; int ret = 0; @@ -407,7 +407,7 @@ PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t bufle } if (stream->readfilters.head) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot peek or fetch OOB data from a filtered stream"); + php_error_docref(NULL, E_WARNING, "cannot peek or fetch OOB data from a filtered stream"); return -1; } @@ -462,7 +462,7 @@ PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t bufle /* Similar to send() system call; send data to the stream, optionally * sending it as OOB data */ PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t buflen, - int flags, void *addr, socklen_t addrlen TSRMLS_DC) + int flags, void *addr, socklen_t addrlen) { php_stream_xport_param param; int ret = 0; @@ -477,7 +477,7 @@ PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t b oob = (flags & STREAM_OOB) == STREAM_OOB; if ((oob || addr) && stream->writefilters.head) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot write OOB data, or data to a targeted address on a filtered stream"); + php_error_docref(NULL, E_WARNING, "cannot write OOB data, or data to a targeted address on a filtered stream"); return -1; } @@ -501,7 +501,7 @@ PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t b /* Similar to shutdown() system call; shut down part of a full-duplex * connection */ -PHPAPI int php_stream_xport_shutdown(php_stream *stream, stream_shutdown_t how TSRMLS_DC) +PHPAPI int php_stream_xport_shutdown(php_stream *stream, stream_shutdown_t how) { php_stream_xport_param param; int ret = 0; diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 1ff80cdfa6..c3f167636e 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -45,15 +45,15 @@ struct php_user_stream_wrapper { php_stream_wrapper wrapper; }; -static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); -static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); -static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); -static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC); -static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int mode, int options, php_stream_context *context TSRMLS_DC); -static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); -static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, int option, void *value, php_stream_context *context TSRMLS_DC); +static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC); +static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context); +static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context); +static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context); +static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int mode, int options, php_stream_context *context); +static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context); +static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, int option, void *value, php_stream_context *context); static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char *filename, const char *mode, - int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); + int options, char **opened_path, php_stream_context *context STREAMS_DC); static php_stream_wrapper_ops user_stream_wops = { user_wrapper_opener, @@ -70,7 +70,7 @@ static php_stream_wrapper_ops user_stream_wops = { }; -static void stream_wrapper_dtor(zend_resource *rsrc TSRMLS_DC) +static void stream_wrapper_dtor(zend_resource *rsrc) { struct php_user_stream_wrapper * uwrap = (struct php_user_stream_wrapper*)rsrc->ptr; @@ -281,7 +281,7 @@ typedef struct _php_userstream_data php_userstream_data_t; }}} **/ -static void user_stream_create_object(struct php_user_stream_wrapper *uwrap, php_stream_context *context, zval *object TSRMLS_DC) +static void user_stream_create_object(struct php_user_stream_wrapper *uwrap, php_stream_context *context, zval *object) { /* create an instance of our class */ object_init_ex(object, uwrap->ce); @@ -314,8 +314,8 @@ static void user_stream_create_object(struct php_user_stream_wrapper *uwrap, php fcc.called_scope = Z_OBJCE_P(object); fcc.object = Z_OBJ_P(object); - if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute %s::%s()", uwrap->ce->name->val, uwrap->ce->constructor->common.function_name->val); + if (zend_call_function(&fci, &fcc) == FAILURE) { + php_error_docref(NULL, E_WARNING, "Could not execute %s::%s()", uwrap->ce->name->val, uwrap->ce->constructor->common.function_name->val); zval_dtor(object); ZVAL_UNDEF(object); } else { @@ -325,7 +325,7 @@ static void user_stream_create_object(struct php_user_stream_wrapper *uwrap, php } static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *filename, const char *mode, - int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) + int options, char **opened_path, php_stream_context *context STREAMS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; php_userstream_data_t *us; @@ -337,7 +337,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char * /* Try to catch bad usage without preventing flexibility */ if (FG(user_stream_current_filename) != NULL && strcmp(filename, FG(user_stream_current_filename)) == 0) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "infinite recursion prevented"); + php_stream_wrapper_log_error(wrapper, options, "infinite recursion prevented"); return NULL; } FG(user_stream_current_filename) = filename; @@ -356,7 +356,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char * us = emalloc(sizeof(*us)); us->wrapper = uwrap; - user_stream_create_object(uwrap, context, &us->object TSRMLS_CC); + user_stream_create_object(uwrap, context, &us->object); if (Z_TYPE(us->object) == IS_UNDEF) { FG(user_stream_current_filename) = NULL; PG(in_user_include) = old_in_user_include; @@ -377,7 +377,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char * &zfuncname, &zretval, 4, args, - 0, NULL TSRMLS_CC); + 0, NULL ); if (call_result == SUCCESS && Z_TYPE(zretval) != IS_UNDEF && zval_is_true(&zretval)) { /* the stream is now open! */ @@ -391,7 +391,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char * /* set wrapper data to be a reference to our object */ ZVAL_COPY(&stream->wrapperdata, &us->object); } else { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "\"%s::" USERSTREAM_OPEN "\" call failed", + php_stream_wrapper_log_error(wrapper, options, "\"%s::" USERSTREAM_OPEN "\" call failed", us->wrapper->classname); } @@ -415,7 +415,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char * } static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char *filename, const char *mode, - int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) + int options, char **opened_path, php_stream_context *context STREAMS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; php_userstream_data_t *us; @@ -426,7 +426,7 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char /* Try to catch bad usage without preventing flexibility */ if (FG(user_stream_current_filename) != NULL && strcmp(filename, FG(user_stream_current_filename)) == 0) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "infinite recursion prevented"); + php_stream_wrapper_log_error(wrapper, options, "infinite recursion prevented"); return NULL; } FG(user_stream_current_filename) = filename; @@ -434,7 +434,7 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char us = emalloc(sizeof(*us)); us->wrapper = uwrap; - user_stream_create_object(uwrap, context, &us->object TSRMLS_CC); + user_stream_create_object(uwrap, context, &us->object); if (Z_TYPE(us->object) == IS_UNDEF) { FG(user_stream_current_filename) = NULL; efree(us); @@ -452,7 +452,7 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char &zfuncname, &zretval, 2, args, - 0, NULL TSRMLS_CC); + 0, NULL ); if (call_result == SUCCESS && Z_TYPE(zretval) != IS_UNDEF && zval_is_true(&zretval)) { /* the stream is now open! */ @@ -461,7 +461,7 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char /* set wrapper data to be a reference to our object */ ZVAL_COPY(&stream->wrapperdata, &us->object); } else { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "\"%s::" USERSTREAM_DIR_OPEN "\" call failed", + php_stream_wrapper_log_error(wrapper, options, "\"%s::" USERSTREAM_DIR_OPEN "\" call failed", us->wrapper->classname); } @@ -492,7 +492,7 @@ PHP_FUNCTION(stream_wrapper_register) zend_resource *rsrc; zend_long flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &protocol, &classname, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|l", &protocol, &classname, &flags) == FAILURE) { RETURN_FALSE; } @@ -505,20 +505,20 @@ PHP_FUNCTION(stream_wrapper_register) rsrc = ZEND_REGISTER_RESOURCE(NULL, uwrap, le_protocols); - if ((uwrap->ce = zend_lookup_class(classname TSRMLS_CC)) != NULL) { - if (php_register_url_stream_wrapper_volatile(protocol->val, &uwrap->wrapper TSRMLS_CC) == SUCCESS) { + if ((uwrap->ce = zend_lookup_class(classname)) != NULL) { + if (php_register_url_stream_wrapper_volatile(protocol->val, &uwrap->wrapper) == SUCCESS) { RETURN_TRUE; } else { /* We failed. But why? */ if (zend_hash_exists(php_stream_get_url_stream_wrappers_hash(), protocol)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Protocol %s:// is already defined.", protocol->val); + php_error_docref(NULL, E_WARNING, "Protocol %s:// is already defined.", protocol->val); } else { /* Hash doesn't exist so it must have been an invalid protocol scheme */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid protocol scheme specified. Unable to register wrapper class %s to %s://", classname->val, protocol->val); + php_error_docref(NULL, E_WARNING, "Invalid protocol scheme specified. Unable to register wrapper class %s to %s://", classname->val, protocol->val); } } } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "class '%s' is undefined", classname->val); + php_error_docref(NULL, E_WARNING, "class '%s' is undefined", classname->val); } zend_list_delete(rsrc); @@ -533,13 +533,13 @@ PHP_FUNCTION(stream_wrapper_unregister) char *protocol; size_t protocol_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &protocol, &protocol_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &protocol, &protocol_len) == FAILURE) { RETURN_FALSE; } - if (php_unregister_url_stream_wrapper_volatile(protocol TSRMLS_CC) == FAILURE) { + if (php_unregister_url_stream_wrapper_volatile(protocol) == FAILURE) { /* We failed */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to unregister protocol %s://", protocol); + php_error_docref(NULL, E_WARNING, "Unable to unregister protocol %s://", protocol); RETURN_FALSE; } @@ -555,26 +555,26 @@ PHP_FUNCTION(stream_wrapper_restore) php_stream_wrapper *wrapper; HashTable *global_wrapper_hash; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &protocol) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &protocol) == FAILURE) { RETURN_FALSE; } global_wrapper_hash = php_stream_get_url_stream_wrappers_hash_global(); if (php_stream_get_url_stream_wrappers_hash() == global_wrapper_hash) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s:// was never changed, nothing to restore", protocol->val); + php_error_docref(NULL, E_NOTICE, "%s:// was never changed, nothing to restore", protocol->val); RETURN_TRUE; } if ((wrapper = zend_hash_find_ptr(global_wrapper_hash, protocol)) == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s:// never existed, nothing to restore", protocol->val); + php_error_docref(NULL, E_WARNING, "%s:// never existed, nothing to restore", protocol->val); RETURN_FALSE; } /* A failure here could be okay given that the protocol might have been merely unregistered */ - php_unregister_url_stream_wrapper_volatile(protocol->val TSRMLS_CC); + php_unregister_url_stream_wrapper_volatile(protocol->val); - if (php_register_url_stream_wrapper_volatile(protocol->val, wrapper TSRMLS_CC) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to restore original %s:// wrapper", protocol->val); + if (php_register_url_stream_wrapper_volatile(protocol->val, wrapper) == FAILURE) { + php_error_docref(NULL, E_WARNING, "Unable to restore original %s:// wrapper", protocol->val); RETURN_FALSE; } @@ -582,7 +582,7 @@ PHP_FUNCTION(stream_wrapper_restore) } /* }}} */ -static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) +static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t count) { zval func_name; zval retval; @@ -602,7 +602,7 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t &func_name, &retval, 1, args, - 0, NULL TSRMLS_CC); + 0, NULL); zval_ptr_dtor(&args[0]); zval_ptr_dtor(&func_name); @@ -611,13 +611,13 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t convert_to_long(&retval); didwrite = Z_LVAL(retval); } else if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " is not implemented!", + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_WRITE " is not implemented!", us->wrapper->classname); } /* don't allow strange buffer overruns due to bogus return */ if (didwrite > count) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " wrote " ZEND_LONG_FMT " bytes more data than requested (" ZEND_LONG_FMT " written, " ZEND_LONG_FMT " max)", + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_WRITE " wrote " ZEND_LONG_FMT " bytes more data than requested (" ZEND_LONG_FMT " written, " ZEND_LONG_FMT " max)", us->wrapper->classname, (zend_long)(didwrite - count), (zend_long)didwrite, (zend_long)count); didwrite = count; @@ -628,7 +628,7 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t return didwrite; } -static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count) { zval func_name; zval retval; @@ -648,20 +648,20 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count &func_name, &retval, 1, args, - 0, NULL TSRMLS_CC); + 0, NULL); if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { convert_to_string(&retval); didread = Z_STRLEN(retval); if (didread > count) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read " ZEND_LONG_FMT " bytes more data than requested (" ZEND_LONG_FMT " read, " ZEND_LONG_FMT " max) - excess data will be lost", + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_READ " - read " ZEND_LONG_FMT " bytes more data than requested (" ZEND_LONG_FMT " read, " ZEND_LONG_FMT " max) - excess data will be lost", us->wrapper->classname, (zend_long)(didread - count), (zend_long)didread, (zend_long)count); didread = count; } if (didread > 0) memcpy(buf, Z_STRVAL(retval), didread); } else if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " is not implemented!", + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_READ " is not implemented!", us->wrapper->classname); } zval_ptr_dtor(&args[0]); @@ -678,12 +678,12 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, - 0, NULL, 0, NULL TSRMLS_CC); + 0, NULL, 0, NULL); if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF && zval_is_true(&retval)) { stream->eof = 1; } else if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_EOF " is not implemented! Assuming EOF", us->wrapper->classname); @@ -696,7 +696,7 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count return didread; } -static int php_userstreamop_close(php_stream *stream, int close_handle TSRMLS_DC) +static int php_userstreamop_close(php_stream *stream, int close_handle) { zval func_name; zval retval; @@ -710,7 +710,7 @@ static int php_userstreamop_close(php_stream *stream, int close_handle TSRMLS_DC Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, - 0, NULL, 0, NULL TSRMLS_CC); + 0, NULL, 0, NULL); zval_ptr_dtor(&retval); zval_ptr_dtor(&func_name); @@ -723,7 +723,7 @@ static int php_userstreamop_close(php_stream *stream, int close_handle TSRMLS_DC return 0; } -static int php_userstreamop_flush(php_stream *stream TSRMLS_DC) +static int php_userstreamop_flush(php_stream *stream) { zval func_name; zval retval; @@ -738,7 +738,7 @@ static int php_userstreamop_flush(php_stream *stream TSRMLS_DC) Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, - 0, NULL, 0, NULL TSRMLS_CC); + 0, NULL, 0, NULL); if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF && zval_is_true(&retval)) call_result = 0; @@ -751,7 +751,7 @@ static int php_userstreamop_flush(php_stream *stream TSRMLS_DC) return call_result; } -static int php_userstreamop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) +static int php_userstreamop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs) { zval func_name; zval retval; @@ -771,7 +771,7 @@ static int php_userstreamop_seek(php_stream *stream, zend_off_t offset, int when &func_name, &retval, 2, args, - 0, NULL TSRMLS_CC); + 0, NULL); zval_ptr_dtor(&args[0]); zval_ptr_dtor(&args[1]); @@ -805,13 +805,13 @@ static int php_userstreamop_seek(php_stream *stream, zend_off_t offset, int when Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, - 0, NULL, 0, NULL TSRMLS_CC); + 0, NULL, 0, NULL); if (call_result == SUCCESS && Z_TYPE(retval) == IS_LONG) { *newoffs = Z_LVAL(retval); ret = 0; } else if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_TELL " is not implemented!", us->wrapper->classname); + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_TELL " is not implemented!", us->wrapper->classname); ret = -1; } else { ret = -1; @@ -824,7 +824,7 @@ static int php_userstreamop_seek(php_stream *stream, zend_off_t offset, int when /* parse the return value from one of the stat functions and store the * relevant fields into the statbuf provided */ -static int statbuf_from_array(zval *array, php_stream_statbuf *ssb TSRMLS_DC) +static int statbuf_from_array(zval *array, php_stream_statbuf *ssb) { zval *elem; @@ -869,7 +869,7 @@ static int statbuf_from_array(zval *array, php_stream_statbuf *ssb TSRMLS_DC) return SUCCESS; } -static int php_userstreamop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) +static int php_userstreamop_stat(php_stream *stream, php_stream_statbuf *ssb) { zval func_name; zval retval; @@ -883,14 +883,14 @@ static int php_userstreamop_stat(php_stream *stream, php_stream_statbuf *ssb TSR Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, - 0, NULL, 0, NULL TSRMLS_CC); + 0, NULL, 0, NULL); if (call_result == SUCCESS && Z_TYPE(retval) == IS_ARRAY) { - if (SUCCESS == statbuf_from_array(&retval, ssb TSRMLS_CC)) + if (SUCCESS == statbuf_from_array(&retval, ssb)) ret = 0; } else { if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_STAT " is not implemented!", + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_STAT " is not implemented!", us->wrapper->classname); } } @@ -902,7 +902,7 @@ static int php_userstreamop_stat(php_stream *stream, php_stream_statbuf *ssb TSR } -static int php_userstreamop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) { +static int php_userstreamop_set_option(php_stream *stream, int option, int value, void *ptrparam) { zval func_name; zval retval; int call_result; @@ -913,12 +913,12 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value switch (option) { case PHP_STREAM_OPTION_CHECK_LIVENESS: ZVAL_STRINGL(&func_name, USERSTREAM_EOF, sizeof(USERSTREAM_EOF)-1); - call_result = call_user_function_ex(NULL, Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, 0, NULL, 0, NULL TSRMLS_CC); + call_result = call_user_function_ex(NULL, Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, 0, NULL, 0, NULL); if (call_result == SUCCESS && (Z_TYPE(retval) == IS_FALSE || Z_TYPE(retval) == IS_TRUE)) { ret = zval_is_true(&retval) ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; } else { ret = PHP_STREAM_OPTION_RETURN_ERR; - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_EOF " is not implemented! Assuming EOF", us->wrapper->classname); } @@ -951,7 +951,7 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, - 1, args, 0, NULL TSRMLS_CC); + 1, args, 0, NULL); if (call_result == SUCCESS && (Z_TYPE(retval) == IS_FALSE || Z_TYPE(retval) == IS_TRUE)) { ret = (Z_TYPE(retval) == IS_FALSE); @@ -960,7 +960,7 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value /* lock support test (TODO: more check) */ ret = PHP_STREAM_OPTION_RETURN_OK; } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_LOCK " is not implemented!", + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_LOCK " is not implemented!", us->wrapper->classname); ret = PHP_STREAM_OPTION_RETURN_ERR; } @@ -978,7 +978,7 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value case PHP_STREAM_TRUNCATE_SUPPORTED: if (zend_is_callable_ex(&func_name, Z_ISUNDEF(us->object)? NULL : Z_OBJ(us->object), - IS_CALLABLE_CHECK_SILENT, NULL, NULL, NULL TSRMLS_CC)) + IS_CALLABLE_CHECK_SILENT, NULL, NULL, NULL)) ret = PHP_STREAM_OPTION_RETURN_OK; else ret = PHP_STREAM_OPTION_RETURN_ERR; @@ -992,18 +992,18 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, - 1, args, 0, NULL TSRMLS_CC); + 1, args, 0, NULL); if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { if (Z_TYPE(retval) == IS_FALSE || Z_TYPE(retval) == IS_TRUE) { ret = (Z_TYPE(retval) == IS_TRUE) ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_TRUNCATE " did not return a boolean!", us->wrapper->classname); } } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_TRUNCATE " is not implemented!", us->wrapper->classname); } @@ -1056,13 +1056,13 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, - 3, args, 0, NULL TSRMLS_CC); + 3, args, 0, NULL); if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_SET_OPTION " is not implemented!", + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_SET_OPTION " is not implemented!", us->wrapper->classname); ret = PHP_STREAM_OPTION_RETURN_ERR; - } else if (Z_TYPE(retval) != IS_UNDEF && zend_is_true(&retval TSRMLS_CC)) { + } else if (Z_TYPE(retval) != IS_UNDEF && zend_is_true(&retval)) { ret = PHP_STREAM_OPTION_RETURN_OK; } else { ret = PHP_STREAM_OPTION_RETURN_ERR; @@ -1082,7 +1082,7 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value } -static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) +static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval zfuncname, zretval; @@ -1092,7 +1092,7 @@ static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int int ret = 0; /* create an instance of our class */ - user_stream_create_object(uwrap, context, &object TSRMLS_CC); + user_stream_create_object(uwrap, context, &object); if (Z_TYPE(object) == IS_UNDEF) { return ret; } @@ -1107,12 +1107,12 @@ static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int &zfuncname, &zretval, 1, args, - 0, NULL TSRMLS_CC); + 0, NULL ); if (call_result == SUCCESS && (Z_TYPE(zretval) == IS_FALSE || Z_TYPE(zretval) == IS_TRUE)) { ret = (Z_TYPE(zretval) == IS_TRUE); } else if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_UNLINK " is not implemented!", uwrap->classname); + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_UNLINK " is not implemented!", uwrap->classname); } /* clean up */ @@ -1126,7 +1126,7 @@ static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int } static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, - int options, php_stream_context *context TSRMLS_DC) + int options, php_stream_context *context) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval zfuncname, zretval; @@ -1136,7 +1136,7 @@ static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from int ret = 0; /* create an instance of our class */ - user_stream_create_object(uwrap, context, &object TSRMLS_CC); + user_stream_create_object(uwrap, context, &object); if (Z_TYPE(object) == IS_UNDEF) { return ret; } @@ -1152,12 +1152,12 @@ static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from &zfuncname, &zretval, 2, args, - 0, NULL TSRMLS_CC); + 0, NULL ); if (call_result == SUCCESS && (Z_TYPE(zretval) == IS_FALSE || Z_TYPE(zretval) == IS_TRUE)) { ret = (Z_TYPE(zretval) == IS_TRUE); } else if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_RENAME " is not implemented!", uwrap->classname); + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_RENAME " is not implemented!", uwrap->classname); } /* clean up */ @@ -1172,7 +1172,7 @@ static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from } static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int mode, - int options, php_stream_context *context TSRMLS_DC) + int options, php_stream_context *context) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval zfuncname, zretval; @@ -1182,7 +1182,7 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int int ret = 0; /* create an instance of our class */ - user_stream_create_object(uwrap, context, &object TSRMLS_CC); + user_stream_create_object(uwrap, context, &object); if (Z_TYPE(object) == IS_UNDEF) { return ret; } @@ -1199,12 +1199,12 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int &zfuncname, &zretval, 3, args, - 0, NULL TSRMLS_CC); + 0, NULL ); if (call_result == SUCCESS && (Z_TYPE(zretval) == IS_FALSE || Z_TYPE(zretval) == IS_TRUE)) { ret = (Z_TYPE(zretval) == IS_TRUE); } else if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_MKDIR " is not implemented!", uwrap->classname); + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_MKDIR " is not implemented!", uwrap->classname); } /* clean up */ @@ -1220,7 +1220,7 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int } static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, - int options, php_stream_context *context TSRMLS_DC) + int options, php_stream_context *context) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval zfuncname, zretval; @@ -1230,7 +1230,7 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int ret = 0; /* create an instance of our class */ - user_stream_create_object(uwrap, context, &object TSRMLS_CC); + user_stream_create_object(uwrap, context, &object); if (Z_TYPE(object) == IS_UNDEF) { return ret; } @@ -1246,12 +1246,12 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, &zfuncname, &zretval, 2, args, - 0, NULL TSRMLS_CC); + 0, NULL ); if (call_result == SUCCESS && (Z_TYPE(zretval) == IS_FALSE || Z_TYPE(zretval) == IS_TRUE)) { ret = (Z_TYPE(zretval) == IS_TRUE); } else if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_RMDIR " is not implemented!", uwrap->classname); + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_RMDIR " is not implemented!", uwrap->classname); } /* clean up */ @@ -1266,7 +1266,7 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, } static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, int option, - void *value, php_stream_context *context TSRMLS_DC) + void *value, php_stream_context *context) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval zfuncname, zretval; @@ -1294,13 +1294,13 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i ZVAL_STRING(&args[2], value); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option %d for " USERSTREAM_METADATA, option); + php_error_docref(NULL, E_WARNING, "Unknown option %d for " USERSTREAM_METADATA, option); zval_ptr_dtor(&args[2]); return ret; } /* create an instance of our class */ - user_stream_create_object(uwrap, context, &object TSRMLS_CC); + user_stream_create_object(uwrap, context, &object); if (Z_TYPE(object) == IS_UNDEF) { zval_ptr_dtor(&args[2]); return ret; @@ -1317,12 +1317,12 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i &zfuncname, &zretval, 3, args, - 0, NULL TSRMLS_CC); + 0, NULL ); if (call_result == SUCCESS && (Z_TYPE(zretval) == IS_FALSE || Z_TYPE(zretval) == IS_TRUE)) { ret = Z_TYPE(zretval) == IS_TRUE; } else if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_METADATA " is not implemented!", uwrap->classname); + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_METADATA " is not implemented!", uwrap->classname); } /* clean up */ @@ -1339,7 +1339,7 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, int flags, - php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) + php_stream_statbuf *ssb, php_stream_context *context) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval zfuncname, zretval; @@ -1349,7 +1349,7 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, i int ret = -1; /* create an instance of our class */ - user_stream_create_object(uwrap, context, &object TSRMLS_CC); + user_stream_create_object(uwrap, context, &object); if (Z_TYPE(object) == IS_UNDEF) { return ret; } @@ -1365,15 +1365,15 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, i &zfuncname, &zretval, 2, args, - 0, NULL TSRMLS_CC); + 0, NULL ); if (call_result == SUCCESS && Z_TYPE(zretval) == IS_ARRAY) { /* We got the info we needed */ - if (SUCCESS == statbuf_from_array(&zretval, ssb TSRMLS_CC)) + if (SUCCESS == statbuf_from_array(&zretval, ssb)) ret = 0; } else { if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_STATURL " is not implemented!", + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_STATURL " is not implemented!", uwrap->classname); } } @@ -1390,7 +1390,7 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, i } -static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t count) { zval func_name; zval retval; @@ -1410,7 +1410,7 @@ static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t cou &func_name, &retval, 0, NULL, - 0, NULL TSRMLS_CC); + 0, NULL); if (call_result == SUCCESS && Z_TYPE(retval) != IS_FALSE && Z_TYPE(retval) != IS_TRUE) { convert_to_string(&retval); @@ -1418,7 +1418,7 @@ static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t cou didread = sizeof(php_stream_dirent); } else if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_DIR_READ " is not implemented!", + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_DIR_READ " is not implemented!", us->wrapper->classname); } @@ -1428,7 +1428,7 @@ static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t cou return didread; } -static int php_userstreamop_closedir(php_stream *stream, int close_handle TSRMLS_DC) +static int php_userstreamop_closedir(php_stream *stream, int close_handle) { zval func_name; zval retval; @@ -1442,7 +1442,7 @@ static int php_userstreamop_closedir(php_stream *stream, int close_handle TSRMLS Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, - 0, NULL, 0, NULL TSRMLS_CC); + 0, NULL, 0, NULL); zval_ptr_dtor(&retval); zval_ptr_dtor(&func_name); @@ -1454,7 +1454,7 @@ static int php_userstreamop_closedir(php_stream *stream, int close_handle TSRMLS return 0; } -static int php_userstreamop_rewinddir(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) +static int php_userstreamop_rewinddir(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs) { zval func_name; zval retval; @@ -1466,7 +1466,7 @@ static int php_userstreamop_rewinddir(php_stream *stream, zend_off_t offset, int Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, - 0, NULL, 0, NULL TSRMLS_CC); + 0, NULL, 0, NULL); zval_ptr_dtor(&retval); zval_ptr_dtor(&func_name); @@ -1475,7 +1475,7 @@ static int php_userstreamop_rewinddir(php_stream *stream, zend_off_t offset, int } -static int php_userstreamop_cast(php_stream *stream, int castas, void **retptr TSRMLS_DC) +static int php_userstreamop_cast(php_stream *stream, int castas, void **retptr) { php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract; zval func_name; @@ -1500,25 +1500,25 @@ static int php_userstreamop_cast(php_stream *stream, int castas, void **retptr T Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, &retval, - 1, args, 0, NULL TSRMLS_CC); + 1, args, 0, NULL); do { if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_CAST " is not implemented!", + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_CAST " is not implemented!", us->wrapper->classname); break; } - if (Z_ISUNDEF(retval) || !zend_is_true(&retval TSRMLS_CC)) { + if (Z_ISUNDEF(retval) || !zend_is_true(&retval)) { break; } php_stream_from_zval_no_verify(intstream, &retval); if (!intstream) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_CAST " must return a stream resource", + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_CAST " must return a stream resource", us->wrapper->classname); break; } if (intstream == stream) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_CAST " must not return itself", + php_error_docref(NULL, E_WARNING, "%s::" USERSTREAM_CAST " must not return itself", us->wrapper->classname); intstream = NULL; break; diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 7427a794b4..9fa2ae367e 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -55,10 +55,10 @@ php_stream_ops php_stream_unixdg_socket_ops; #endif -static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC); +static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam); /* {{{ Generic socket stream operations */ -static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) +static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; int didwrite; @@ -102,7 +102,7 @@ retry: } while (err == EINTR); } estr = php_socket_strerror(err, NULL, 0); - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "send of " ZEND_LONG_FMT " bytes failed with errno=%ld %s", + php_error_docref(NULL, E_NOTICE, "send of " ZEND_LONG_FMT " bytes failed with errno=%ld %s", (zend_long)count, err, estr); efree(estr); } @@ -118,7 +118,7 @@ retry: return didwrite; } -static void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data_t *sock TSRMLS_DC) +static void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data_t *sock) { int retval; struct timeval *ptimeout; @@ -148,7 +148,7 @@ static void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data } } -static size_t php_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static size_t php_sockop_read(php_stream *stream, char *buf, size_t count) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; ssize_t nr_bytes = 0; @@ -158,7 +158,7 @@ static size_t php_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS } if (sock->is_blocked) { - php_sock_stream_wait_for_data(stream, sock TSRMLS_CC); + php_sock_stream_wait_for_data(stream, sock); if (sock->timeout_event) return 0; } @@ -179,7 +179,7 @@ static size_t php_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS } -static int php_sockop_close(php_stream *stream, int close_handle TSRMLS_DC) +static int php_sockop_close(php_stream *stream, int close_handle) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; #ifdef PHP_WIN32 @@ -222,7 +222,7 @@ static int php_sockop_close(php_stream *stream, int close_handle TSRMLS_DC) return 0; } -static int php_sockop_flush(php_stream *stream TSRMLS_DC) +static int php_sockop_flush(php_stream *stream) { #if 0 php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; @@ -231,7 +231,7 @@ static int php_sockop_flush(php_stream *stream TSRMLS_DC) return 0; } -static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) +static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb) { #if ZEND_WIN32 return 0; @@ -244,7 +244,7 @@ static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC static inline int sock_sendto(php_netstream_data_t *sock, const char *buf, size_t buflen, int flags, struct sockaddr *addr, socklen_t addrlen - TSRMLS_DC) + ) { int ret; if (addr) { @@ -262,7 +262,7 @@ static inline int sock_sendto(php_netstream_data_t *sock, const char *buf, size_ static inline int sock_recvfrom(php_netstream_data_t *sock, char *buf, size_t buflen, int flags, zend_string **textaddr, struct sockaddr **addr, socklen_t *addrlen - TSRMLS_DC) + ) { php_sockaddr_storage sa; socklen_t sl = sizeof(sa); @@ -273,7 +273,7 @@ static inline int sock_recvfrom(php_netstream_data_t *sock, char *buf, size_t bu ret = recvfrom(sock->socket, buf, XP_SOCK_BUF_SIZE(buflen), flags, (struct sockaddr*)&sa, &sl); ret = (ret == SOCK_CONN_ERR) ? -1 : ret; php_network_populate_name_from_sockaddr((struct sockaddr*)&sa, sl, - textaddr, addr, addrlen TSRMLS_CC); + textaddr, addr, addrlen); } else { ret = recv(sock->socket, buf, XP_SOCK_BUF_SIZE(buflen), flags); ret = (ret == SOCK_CONN_ERR) ? -1 : ret; @@ -282,7 +282,7 @@ static inline int sock_recvfrom(php_netstream_data_t *sock, char *buf, size_t bu return ret; } -static int php_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) +static int php_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam) { int oldmode, flags; php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; @@ -323,7 +323,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void case PHP_STREAM_OPTION_BLOCKING: oldmode = sock->is_blocked; - if (SUCCESS == php_set_sock_blocking(sock->socket, value TSRMLS_CC)) { + if (SUCCESS == php_set_sock_blocking(sock->socket, value)) { sock->is_blocked = value; return oldmode; } @@ -353,7 +353,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void xparam->want_textaddr ? &xparam->outputs.textaddr : NULL, xparam->want_addr ? &xparam->outputs.addr : NULL, xparam->want_addr ? &xparam->outputs.addrlen : NULL - TSRMLS_CC); + ); return PHP_STREAM_OPTION_RETURN_OK; case STREAM_XPORT_OP_GET_PEER_NAME: @@ -361,7 +361,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void xparam->want_textaddr ? &xparam->outputs.textaddr : NULL, xparam->want_addr ? &xparam->outputs.addr : NULL, xparam->want_addr ? &xparam->outputs.addrlen : NULL - TSRMLS_CC); + ); return PHP_STREAM_OPTION_RETURN_OK; case STREAM_XPORT_OP_SEND: @@ -373,10 +373,10 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void xparam->inputs.buf, xparam->inputs.buflen, flags, xparam->inputs.addr, - xparam->inputs.addrlen TSRMLS_CC); + xparam->inputs.addrlen); if (xparam->outputs.returncode == -1) { char *err = php_socket_strerror(php_socket_errno(), NULL, 0); - php_error_docref(NULL TSRMLS_CC, E_WARNING, + php_error_docref(NULL, E_WARNING, "%s\n", err); efree(err); } @@ -396,7 +396,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void xparam->want_textaddr ? &xparam->outputs.textaddr : NULL, xparam->want_addr ? &xparam->outputs.addr : NULL, xparam->want_addr ? &xparam->outputs.addrlen : NULL - TSRMLS_CC); + ); return PHP_STREAM_OPTION_RETURN_OK; @@ -427,7 +427,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void } } -static int php_sockop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC) +static int php_sockop_cast(php_stream *stream, int castas, void **ret) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; @@ -518,7 +518,7 @@ php_stream_ops php_stream_unixdg_socket_ops = { /* network socket operations */ #ifdef AF_UNIX -static inline int parse_unix_address(php_stream_xport_param *xparam, struct sockaddr_un *unix_addr TSRMLS_DC) +static inline int parse_unix_address(php_stream_xport_param *xparam, struct sockaddr_un *unix_addr) { memset(unix_addr, 0, sizeof(*unix_addr)); unix_addr->sun_family = AF_UNIX; @@ -532,7 +532,7 @@ static inline int parse_unix_address(php_stream_xport_param *xparam, struct sock * BUT, to get into this branch of code, the name is too long, * so we don't care. */ xparam->inputs.namelen = sizeof(unix_addr->sun_path) - 1; - php_error_docref(NULL TSRMLS_CC, E_NOTICE, + php_error_docref(NULL, E_NOTICE, "socket path exceeded the maximum allowed length of %lu bytes " "and was truncated", (unsigned long)sizeof(unix_addr->sun_path)); } @@ -543,7 +543,7 @@ static inline int parse_unix_address(php_stream_xport_param *xparam, struct sock } #endif -static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *portno, int get_err, zend_string **err TSRMLS_DC) +static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *portno, int get_err, zend_string **err) { char *colon; char *host = NULL; @@ -582,13 +582,13 @@ static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *po return host; } -static inline char *parse_ip_address(php_stream_xport_param *xparam, int *portno TSRMLS_DC) +static inline char *parse_ip_address(php_stream_xport_param *xparam, int *portno) { - return parse_ip_address_ex(xparam->inputs.name, xparam->inputs.namelen, portno, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC); + return parse_ip_address_ex(xparam->inputs.name, xparam->inputs.namelen, portno, xparam->want_errortext, &xparam->outputs.error_text); } static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t *sock, - php_stream_xport_param *xparam TSRMLS_DC) + php_stream_xport_param *xparam) { char *host = NULL; int portno, err; @@ -610,14 +610,14 @@ static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t * return -1; } - parse_unix_address(xparam, &unix_addr TSRMLS_CC); + parse_unix_address(xparam, &unix_addr); return bind(sock->socket, (const struct sockaddr *)&unix_addr, (socklen_t) XtOffsetOf(struct sockaddr_un, sun_path) + xparam->inputs.namelen); } #endif - host = parse_ip_address(xparam, &portno TSRMLS_CC); + host = parse_ip_address(xparam, &portno); if (host == NULL) { return -1; @@ -626,7 +626,7 @@ static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t * #ifdef SO_REUSEPORT if (PHP_STREAM_CONTEXT(stream) && (tmpzval = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "socket", "so_reuseport")) != NULL - && zend_is_true(tmpzval TSRMLS_CC) + && zend_is_true(tmpzval) ) { sockopts |= STREAM_SOCKOP_SO_REUSEPORT; } @@ -636,7 +636,7 @@ static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t * if (stream->ops == &php_stream_udp_socket_ops /* SO_BROADCAST is only applicable for UDP */ && PHP_STREAM_CONTEXT(stream) && (tmpzval = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "socket", "so_broadcast")) != NULL - && zend_is_true(tmpzval TSRMLS_CC) + && zend_is_true(tmpzval) ) { sockopts |= STREAM_SOCKOP_SO_BROADCAST; } @@ -647,7 +647,7 @@ static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t * sockopts, xparam->want_errortext ? &xparam->outputs.error_text : NULL, &err - TSRMLS_CC); + ); if (host) { efree(host); @@ -657,7 +657,7 @@ static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t * } static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_t *sock, - php_stream_xport_param *xparam TSRMLS_DC) + php_stream_xport_param *xparam) { char *host = NULL, *bindto = NULL; int portno, bindport = 0; @@ -679,7 +679,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ return -1; } - parse_unix_address(xparam, &unix_addr TSRMLS_CC); + parse_unix_address(xparam, &unix_addr); ret = php_network_connect_socket(sock->socket, (const struct sockaddr *)&unix_addr, (socklen_t) XtOffsetOf(struct sockaddr_un, sun_path) + xparam->inputs.namelen, @@ -693,7 +693,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ } #endif - host = parse_ip_address(xparam, &portno TSRMLS_CC); + host = parse_ip_address(xparam, &portno); if (host == NULL) { return -1; @@ -707,14 +707,14 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ efree(host); return -1; } - bindto = parse_ip_address_ex(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC); + bindto = parse_ip_address_ex(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text); } #ifdef SO_BROADCAST if (stream->ops == &php_stream_udp_socket_ops /* SO_BROADCAST is only applicable for UDP */ && PHP_STREAM_CONTEXT(stream) && (tmpzval = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "socket", "so_broadcast")) != NULL - && zend_is_true(tmpzval TSRMLS_CC) + && zend_is_true(tmpzval) ) { sockopts |= STREAM_SOCKOP_SO_BROADCAST; } @@ -733,7 +733,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ bindto, bindport, sockopts - TSRMLS_CC); + ); ret = sock->socket == -1 ? -1 : 0; xparam->outputs.error_code = err; @@ -758,7 +758,7 @@ out: } static inline int php_tcp_sockop_accept(php_stream *stream, php_netstream_data_t *sock, - php_stream_xport_param *xparam STREAMS_DC TSRMLS_DC) + php_stream_xport_param *xparam STREAMS_DC) { int clisock; @@ -771,7 +771,7 @@ static inline int php_tcp_sockop_accept(php_stream *stream, php_netstream_data_t xparam->inputs.timeout, xparam->want_errortext ? &xparam->outputs.error_text : NULL, &xparam->outputs.error_code - TSRMLS_CC); + ); if (clisock >= 0) { php_netstream_data_t *clisockdata; @@ -798,7 +798,7 @@ static inline int php_tcp_sockop_accept(php_stream *stream, php_netstream_data_t return xparam->outputs.client == NULL ? -1 : 0; } -static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) +static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; php_stream_xport_param *xparam; @@ -810,23 +810,23 @@ static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, switch(xparam->op) { case STREAM_XPORT_OP_CONNECT: case STREAM_XPORT_OP_CONNECT_ASYNC: - xparam->outputs.returncode = php_tcp_sockop_connect(stream, sock, xparam TSRMLS_CC); + xparam->outputs.returncode = php_tcp_sockop_connect(stream, sock, xparam); return PHP_STREAM_OPTION_RETURN_OK; case STREAM_XPORT_OP_BIND: - xparam->outputs.returncode = php_tcp_sockop_bind(stream, sock, xparam TSRMLS_CC); + xparam->outputs.returncode = php_tcp_sockop_bind(stream, sock, xparam); return PHP_STREAM_OPTION_RETURN_OK; case STREAM_XPORT_OP_ACCEPT: - xparam->outputs.returncode = php_tcp_sockop_accept(stream, sock, xparam STREAMS_CC TSRMLS_CC); + xparam->outputs.returncode = php_tcp_sockop_accept(stream, sock, xparam STREAMS_CC); return PHP_STREAM_OPTION_RETURN_OK; default: /* fall through */ ; } } - return php_sockop_set_option(stream, option, value, ptrparam TSRMLS_CC); + return php_sockop_set_option(stream, option, value, ptrparam); } @@ -834,7 +834,7 @@ PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, size_t p const char *resourcename, size_t resourcenamelen, const char *persistent_id, int options, int flags, struct timeval *timeout, - php_stream_context *context STREAMS_DC TSRMLS_DC) + php_stream_context *context STREAMS_DC) { php_stream *stream = NULL; php_netstream_data_t *sock; |