Permalink
Browse files

some more eliminate-fetches-or-escalate-them-at-least

  • Loading branch information...
Sascha Schumann
Sascha Schumann committed Aug 5, 2001
1 parent 373b3e1 commit b349df63645e48eade0481238e6ca3feb90f18fa
Showing with 34 additions and 30 deletions.
  1. +1 −1 ext/cpdf/cpdf.c
  2. +1 −1 ext/gd/gd.c
  3. +4 −2 ext/gd/gd_ctx.c
  4. +3 −1 ext/ming/ming.c
  5. +3 −2 ext/pdf/pdf.c
  6. +1 −1 ext/pgsql/pgsql.c
  7. +1 −1 ext/standard/basic_functions.c
  8. +1 −1 ext/swf/swf.c
  9. +1 −1 ext/zlib/zlib.c
  10. +6 −9 main/main.c
  11. +2 −2 main/php.h
  12. +1 −1 main/php_main.h
  13. +5 −5 sapi/cgi/cgi_main.c
  14. +4 −2 sapi/servlet/servlet.c
View
@@ -2335,7 +2335,7 @@ PHP_FUNCTION(cpdf_output_buffer)
buffer = cpdf_getBufferForPDF(pdf, &lenght);
- php_write(buffer, lenght);
+ php_write(buffer, lenght TSRMLS_CC);
RETURN_TRUE;
}
View
@@ -1382,7 +1382,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0);
#endif
while ((b = fread(buf, 1, sizeof(buf), tmp)) > 0) {
- php_write(buf, b);
+ php_write(buf, b TSRMLS_CC);
}
fclose(tmp);
View
@@ -5,12 +5,14 @@
static void _php_image_output_putc(struct gdIOCtx *ctx, int c)
{
- php_write(&c, 1);
+ TSRMLS_FETCH();
+ php_write(&c, 1 TSRMLS_CC);
}
static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l)
{
- return php_write((void *)buf, l);
+ TSRMLS_FETCH();
+ return php_write((void *)buf, l TSRMLS_CC);
}
static void _php_image_output_ctxfree(struct gdIOCtx *ctx)
View
@@ -1489,7 +1489,9 @@ PHP_FUNCTION(swfmovie_remove)
void phpByteOutputMethod(byte b, void *data)
{
- php_write(&b, 1);
+ TSRMLS_FETCH();
+
+ php_write(&b, 1 TSRMLS_CC);
}
PHP_FUNCTION(swfmovie_output)
View
@@ -325,8 +325,9 @@ static void pdf_efree(PDF *p, void *mem)
*/
static size_t pdf_flushwrite(PDF *p, void *data, size_t size)
{
- return(php_write(data, size));
- return 0;
+ TSRMLS_FETCH();
+
+ return(php_write(data, size TSRMLS_CC));
}
/* }}} */
View
@@ -174,7 +174,7 @@ _notice_handler(void *arg, const char *message)
TSRMLS_FETCH();
if (! PGG(ignore_notices)) {
- php_log_err((char *) message);
+ php_log_err((char *) message TSRMLS_CC);
if (PGG(last_notice) != NULL) {
efree(PGG(last_notice));
}
@@ -1614,7 +1614,7 @@ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers T
fclose(logfile);
break;
default:
- php_log_err(message);
+ php_log_err(message TSRMLS_CC);
break;
}
return SUCCESS;
View
@@ -255,7 +255,7 @@ PHP_FUNCTION(swf_closefile)
}
while ((b = fread(buf, 1, sizeof(buf), f)) > 0)
- php_write(buf, b);
+ php_write(buf, b TSRMLS_CC);
fclose(f);
View
@@ -67,7 +67,7 @@
#define PUTC(a) PUTS(a)
#endif
#ifndef PHPWRITE
-#define PHPWRITE(a,n) php_write((a),(n))
+#define PHPWRITE(a,n) php_write((a),(n) TSRMLS_CC)
#endif
#endif
View
@@ -263,13 +263,12 @@ static int module_initialized = 0;
/* {{{ php_log_err
*/
-PHPAPI void php_log_err(char *log_message)
+PHPAPI void php_log_err(char *log_message TSRMLS_DC)
{
FILE *log_file;
char error_time_str[128];
struct tm tmbuf;
time_t error_time;
- TSRMLS_FETCH();
/* Try to use the specified logging location. */
if (PG(error_log) != NULL) {
@@ -304,9 +303,8 @@ PHPAPI void php_log_err(char *log_message)
/* {{{ php_write
wrapper for modules to use PHPWRITE */
-PHPAPI int php_write(void *buf, uint size)
+PHPAPI int php_write(void *buf, uint size TSRMLS_DC)
{
- TSRMLS_FETCH();
return PHPWRITE(buf, size);
}
/* }}} */
@@ -388,7 +386,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
}
#endif
snprintf(log_buffer, 1024, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno);
- php_log_err(log_buffer);
+ php_log_err(log_buffer TSRMLS_CC);
}
if (module_initialized && PG(display_errors)
&& (!PG(during_request_startup) || PG(display_startup_errors))) {
@@ -553,7 +551,6 @@ static void php_message_handler_for_zend(long message, void *data)
if (EG(error_reporting)&E_WARNING) {
#if ZEND_DEBUG
char memory_leak_buf[512];
- TSRMLS_FETCH();
if (message==ZMSG_MEMORY_LEAK_DETECTED) {
zend_mem_header *t = (zend_mem_header *) data;
@@ -931,17 +928,17 @@ void php_module_shutdown_for_exec()
*/
int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals)
{
- php_module_shutdown();
+ TSRMLS_FETCH();
+ php_module_shutdown(TSRMLS_C);
return SUCCESS;
}
/* }}} */
/* {{{ php_module_shutdown
*/
-void php_module_shutdown()
+void php_module_shutdown(TSRMLS_D)
{
int module_number=0; /* for UNREGISTER_INI_ENTRIES() */
- TSRMLS_FETCH();
if (!module_initialized) {
return;
View
@@ -245,9 +245,9 @@ ssize_t pread(int, void *, size_t, off64_t);
#endif
void phperror(char *error);
-PHPAPI int php_write(void *buf, uint size);
+PHPAPI int php_write(void *buf, uint size TSRMLS_DC);
PHPAPI int php_printf(const char *format, ...);
-PHPAPI void php_log_err(char *log_message);
+PHPAPI void php_log_err(char *log_message TSRMLS_DC);
int Debug(char *format, ...);
int cfgparse(void);
View
@@ -32,7 +32,7 @@ PHPAPI int php_request_startup(TSRMLS_D);
PHPAPI void php_request_shutdown(void *dummy);
PHPAPI void php_request_shutdown_for_exec(void *dummy);
PHPAPI int php_module_startup(sapi_module_struct *sf);
-PHPAPI void php_module_shutdown(void);
+PHPAPI void php_module_shutdown(TSRMLS_D);
PHPAPI void php_module_shutdown_for_exec(void);
PHPAPI int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals);
View
@@ -563,7 +563,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
case 'i': /* php info & quit */
if (php_request_startup(TSRMLS_C)==FAILURE) {
- php_module_shutdown();
+ php_module_shutdown(TSRMLS_C);
return FAILURE;
}
if (no_headers) {
@@ -611,7 +611,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
case 'v': /* show php version & quit */
no_headers = 1;
if (php_request_startup(TSRMLS_C)==FAILURE) {
- php_module_shutdown();
+ php_module_shutdown(TSRMLS_C);
return FAILURE;
}
if (no_headers) {
@@ -668,7 +668,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
}
if (php_request_startup(TSRMLS_C)==FAILURE) {
- php_module_shutdown();
+ php_module_shutdown(TSRMLS_C);
return FAILURE;
}
if (no_headers) {
@@ -714,7 +714,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
if(!argv0 || !(file_handle.handle.fp = VCWD_FOPEN(argv0, "rb"))) {
PUTS("No input file specified.\n");
php_request_shutdown((void *) 0);
- php_module_shutdown();
+ php_module_shutdown(TSRMLS_C);
return FAILURE;
}
file_handle.filename = argv0;
@@ -782,7 +782,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
exit_status = -1;
} zend_end_try();
- php_module_shutdown();
+ php_module_shutdown(TSRMLS_C);
#ifdef ZTS
tsrm_shutdown();
View
@@ -269,7 +269,9 @@ JNIEXPORT void JNICALL Java_net_php_servlet_startup
JNIEXPORT void JNICALL Java_net_php_servlet_shutdown
(JNIEnv *jenv, jobject self)
{
- php_module_shutdown();
+ TSRMLS_FETCH();
+
+ php_module_shutdown(TSRMLS_C);
#ifdef ZTS
tsrm_shutdown();
#endif
@@ -361,7 +363,7 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send
if (retval == FAILURE) {
php_request_shutdown((void *) 0);
- php_module_shutdown();
+ php_module_shutdown(TSRMLS_C);
ThrowIOException(jenv, file_handle.filename);
return;
}

0 comments on commit b349df6

Please sign in to comment.