summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2001-07-31 06:28:05 +0000
committerZeev Suraski <zeev@php.net>2001-07-31 06:28:05 +0000
commitbc42c37513a730b0b3ff9cf29e14e45e4ec50c71 (patch)
treec4857143995f88a04e3f9d56cb5f8d757fa07575 /main
parent0b7fdbb690b0270d13266a83521d1fd03e2c270c (diff)
downloadphp-git-bc42c37513a730b0b3ff9cf29e14e45e4ec50c71.tar.gz
More TSRMLS_FETCH work. Got it under 400 now.
Diffstat (limited to 'main')
-rw-r--r--main/SAPI.c18
-rw-r--r--main/SAPI.h12
-rw-r--r--main/fopen_wrappers.c28
-rw-r--r--main/fopen_wrappers.h10
-rw-r--r--main/main.c10
-rw-r--r--main/output.c2
-rw-r--r--main/php_logos.c2
-rw-r--r--main/php_logos.h2
-rw-r--r--main/safe_mode.c2
9 files changed, 34 insertions, 52 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index 08fa6afcc5..b38fd1edb5 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -366,12 +366,11 @@ static int sapi_extract_response_code(const char *header_line)
/* This function expects a *duplicated* string, that was previously emalloc()'d.
* Pointers sent to this functions will be automatically freed by the framework.
*/
-SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace)
+SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC)
{
int retval, free_header = 0;
sapi_header_struct sapi_header;
char *colon_offset;
- TSRMLS_FETCH();
if (SG(headers_sent) && !SG(request_info).no_headers) {
char *output_start_filename = php_get_output_start_filename();
@@ -465,11 +464,10 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo
}
-SAPI_API int sapi_send_headers()
+SAPI_API int sapi_send_headers(TSRMLS_D)
{
int retval;
int ret = FAILURE;
- TSRMLS_FETCH();
if (SG(headers_sent) || SG(request_info).no_headers) {
return SUCCESS;
@@ -555,11 +553,9 @@ SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRML
}
-SAPI_API int sapi_flush()
+SAPI_API int sapi_flush(TSRMLS_D)
{
if (sapi_module.flush) {
- TSRMLS_FETCH();
-
sapi_module.flush(SG(server_context));
return SUCCESS;
} else {
@@ -567,10 +563,8 @@ SAPI_API int sapi_flush()
}
}
-SAPI_API struct stat *sapi_get_stat()
+SAPI_API struct stat *sapi_get_stat(TSRMLS_D)
{
- TSRMLS_FETCH();
-
if (sapi_module.get_stat) {
return sapi_module.get_stat(TSRMLS_C);
} else {
@@ -582,11 +576,9 @@ SAPI_API struct stat *sapi_get_stat()
}
-SAPI_API char *sapi_getenv(char *name, size_t name_len)
+SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC)
{
if (sapi_module.getenv) {
- TSRMLS_FETCH();
-
return sapi_module.getenv(name, name_len TSRMLS_CC);
} else {
return NULL;
diff --git a/main/SAPI.h b/main/SAPI.h
index 95015a7f81..def26a08f3 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -130,10 +130,10 @@ SAPI_API void sapi_activate(TSRMLS_D);
SAPI_API void sapi_deactivate(TSRMLS_D);
SAPI_API void sapi_initialize_empty_request(TSRMLS_D);
-SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace);
+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(header_line, header_line_len, duplicate) \
- sapi_add_header_ex((header_line), (header_line_len), (duplicate), 1)
-SAPI_API int sapi_send_headers(void);
+ sapi_add_header_ex((header_line), (header_line_len), (duplicate), 1 TSRMLS_CC)
+SAPI_API int sapi_send_headers(TSRMLS_D);
SAPI_API void sapi_free_header(sapi_header_struct *sapi_header);
SAPI_API void sapi_handle_post(void *arg TSRMLS_DC);
@@ -142,9 +142,9 @@ 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)(TSRMLS_D));
-SAPI_API int sapi_flush(void);
-SAPI_API struct stat *sapi_get_stat(void);
-SAPI_API char *sapi_getenv(char *name, size_t name_len);
+SAPI_API int sapi_flush(TSRMLS_D);
+SAPI_API struct stat *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);
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index df72859581..b3ecfcbfa3 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -90,10 +90,8 @@ HashTable fopen_url_wrappers_hash;
/* {{{ php_register_url_wrapper
*/
-PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path))
+PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path) TSRMLS_DC)
{
- TSRMLS_FETCH();
-
if(PG(allow_url_fopen)) {
return zend_hash_add(&fopen_url_wrappers_hash, protocol, strlen(protocol), &wrapper, sizeof(wrapper), NULL);
} else {
@@ -104,10 +102,8 @@ PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path
/* {{{ php_unregister_url_wrapper
*/
-PHPAPI int php_unregister_url_wrapper(char *protocol)
+PHPAPI int php_unregister_url_wrapper(char *protocol TSRMLS_DC)
{
- TSRMLS_FETCH();
-
if(PG(allow_url_fopen)) {
return zend_hash_del(&fopen_url_wrappers_hash, protocol, strlen(protocol));
} else {
@@ -118,27 +114,22 @@ PHPAPI int php_unregister_url_wrapper(char *protocol)
/* {{{ php_init_fopen_wrappers
*/
-int php_init_fopen_wrappers(void)
+int php_init_fopen_wrappers(TSRMLS_D)
{
- TSRMLS_FETCH();
-
- if(PG(allow_url_fopen))
+ if(PG(allow_url_fopen)) {
return zend_hash_init(&fopen_url_wrappers_hash, 0, NULL, NULL, 1);
-
+ }
return SUCCESS;
}
/* }}} */
/* {{{ php_shutdown_fopen_wrappers
*/
-int php_shutdown_fopen_wrappers(void)
+int php_shutdown_fopen_wrappers(TSRMLS_D)
{
- TSRMLS_FETCH();
-
if(PG(allow_url_fopen)) {
zend_hash_destroy(&fopen_url_wrappers_hash);
}
-
return SUCCESS;
}
/* }}} */
@@ -196,10 +187,8 @@ PHPAPI int php_check_specific_open_basedir(char *basedir, char *path TSRMLS_DC)
/* {{{ php_check_open_basedir
*/
-PHPAPI int php_check_open_basedir(char *path)
+PHPAPI int php_check_open_basedir(char *path TSRMLS_DC)
{
- TSRMLS_FETCH();
-
/* Only check when open_basedir is available */
if (PG(open_basedir) && *PG(open_basedir)) {
char *pathbuf;
@@ -240,8 +229,9 @@ PHPAPI int php_check_open_basedir(char *path)
static FILE *php_fopen_and_set_opened_path(const char *path, char *mode, char **opened_path)
{
FILE *fp;
+ TSRMLS_FETCH();
- if (php_check_open_basedir((char *)path)) {
+ if (php_check_open_basedir((char *)path TSRMLS_CC)) {
return NULL;
}
fp = VCWD_FOPEN(path, mode);
diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h
index 18a8610c03..040dae6cb6 100644
--- a/main/fopen_wrappers.h
+++ b/main/fopen_wrappers.h
@@ -69,7 +69,7 @@ PHPAPI FILE *php_fopen_wrapper(char *filename, char *mode, int options, int *iss
PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle);
PHPAPI char *expand_filepath(const char *filepath, char *real_path);
-PHPAPI int php_check_open_basedir(char *path);
+PHPAPI int php_check_open_basedir(char *path TSRMLS_DC);
PHPAPI int php_check_specific_open_basedir(char *basedir, char *path TSRMLS_DC);
PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path);
@@ -78,10 +78,10 @@ PHPAPI int php_is_url(char *path);
PHPAPI char *php_strip_url_passwd(char *path);
-int php_init_fopen_wrappers(void);
-int php_shutdown_fopen_wrappers(void);
-PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path));
-PHPAPI int php_unregister_url_wrapper(char *protocol);
+int php_init_fopen_wrappers(TSRMLS_D);
+int php_shutdown_fopen_wrappers(TSRMLS_D);
+PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path) TSRMLS_DC);
+PHPAPI int php_unregister_url_wrapper(char *protocol TSRMLS_DC);
#endif
/*
diff --git a/main/main.c b/main/main.c
index 8e9c1c0dc2..87bf427aad 100644
--- a/main/main.c
+++ b/main/main.c
@@ -686,7 +686,7 @@ void php_request_shutdown(void *dummy)
} zend_end_try();
zend_try {
- sapi_send_headers();
+ sapi_send_headers(TSRMLS_C);
} zend_end_try();
if (PG(modules_activated)) zend_try {
@@ -860,7 +860,7 @@ int php_module_startup(sapi_module_struct *sf)
/* initialize fopen wrappers registry
(this uses configuration parameters from php.ini)
*/
- if (php_init_fopen_wrappers() == FAILURE) {
+ if (php_init_fopen_wrappers(TSRMLS_C) == FAILURE) {
php_printf("PHP: Unable to initialize fopen url wrappers.\n");
return FAILURE;
}
@@ -959,10 +959,10 @@ void php_module_shutdown()
#endif
php_shutdown_ticks(TSRMLS_C);
- sapi_flush();
+ sapi_flush(TSRMLS_C);
zend_shutdown(TSRMLS_C);
- php_shutdown_fopen_wrappers();
+ php_shutdown_fopen_wrappers(TSRMLS_C);
php_shutdown_info_logos();
UNREGISTER_INI_ENTRIES();
#ifndef ZTS
@@ -1177,7 +1177,7 @@ PHPAPI int php_handle_special_queries(TSRMLS_D)
{
if (SG(request_info).query_string && SG(request_info).query_string[0]=='='
&& PG(expose_php)) {
- if (php_info_logos(SG(request_info).query_string+1)) {
+ if (php_info_logos(SG(request_info).query_string+1 TSRMLS_CC)) {
return 1;
} else if (!strcmp(SG(request_info).query_string+1, PHP_CREDITS_GUID)) {
php_print_credits(PHP_CREDITS_ALL);
diff --git a/main/output.c b/main/output.c
index cf5272acdd..4e52d458f4 100644
--- a/main/output.c
+++ b/main/output.c
@@ -470,7 +470,7 @@ static int php_ub_body_write_no_header(const char *str, uint str_length)
result = OG(php_header_write)(str, str_length);
if (OG(implicit_flush)) {
- sapi_flush();
+ sapi_flush(TSRMLS_C);
}
return result;
diff --git a/main/php_logos.c b/main/php_logos.c
index c9eb588911..eb3c523492 100644
--- a/main/php_logos.c
+++ b/main/php_logos.c
@@ -67,7 +67,7 @@ int php_shutdown_info_logos(void)
}
#define CONTENT_TYPE_HEADER "Content-Type: "
-int php_info_logos(const char *logo_string)
+int php_info_logos(const char *logo_string TSRMLS_DC)
{
php_info_logo *logo_image;
char *content_header;
diff --git a/main/php_logos.h b/main/php_logos.h
index 42df0a87ae..e6e2028bae 100644
--- a/main/php_logos.h
+++ b/main/php_logos.h
@@ -5,6 +5,6 @@ PHPAPI int php_register_info_logo(char *logo_string, char *mimetype, unsigned ch
PHPAPI int php_unregister_info_logo(char *logo_string);
int php_init_info_logos(void);
int php_shutdown_info_logos(void);
-int php_info_logos(const char *logo_string);
+int php_info_logos(const char *logo_string TSRMLS_DC);
#endif /* _PHP_LOGOS_H */
diff --git a/main/safe_mode.c b/main/safe_mode.c
index fdf6f161de..675a3d7ab4 100644
--- a/main/safe_mode.c
+++ b/main/safe_mode.c
@@ -166,7 +166,7 @@ PHPAPI char *php_get_current_user()
USE_SAPI is defined, because cgi will also be
interfaced in USE_SAPI */
- pstat = sapi_get_stat();
+ pstat = sapi_get_stat(TSRMLS_C);
if (!pstat) {
return empty_string;