]> granicus.if.org Git - php/commitdiff
some more eliminate-fetches-or-escalate-them-at-least
authorSascha Schumann <sas@php.net>
Sun, 5 Aug 2001 16:21:33 +0000 (16:21 +0000)
committerSascha Schumann <sas@php.net>
Sun, 5 Aug 2001 16:21:33 +0000 (16:21 +0000)
14 files changed:
ext/cpdf/cpdf.c
ext/gd/gd.c
ext/gd/gd_ctx.c
ext/ming/ming.c
ext/pdf/pdf.c
ext/pgsql/pgsql.c
ext/standard/basic_functions.c
ext/swf/swf.c
ext/zlib/zlib.c
main/main.c
main/php.h
main/php_main.h
sapi/cgi/cgi_main.c
sapi/servlet/servlet.c

index bb1ce59fcaf8de4c72b3e8abe8e36ebade76b12d..3543f72c0fa12dffe24dace515f5b44ff23d0010 100644 (file)
@@ -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;
 }
index eafac5858dcff05aea86608b771de204ceec58af..c60dafbd616d2243a83788b15284db837fa8e33b 100644 (file)
@@ -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);
index 3c389a38bafad374af61f711c3c7bc9aa5155533..3c599cab65ec937b43222ceb9f0d1d7c52e5e18c 100644 (file)
@@ -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)
index 60a3ff8050b2df2b40b6c57185086ffb973a3ce4..46aec90a0fa7f07d031cfd723fce30a16184e5b6 100644 (file)
@@ -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)
index 7274b0e15a669260197840999cc6e529b063dfdc..dfb17b328cd7ba6b268e2ab3d2e1860e0b0d7cd3 100644 (file)
@@ -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));
 }
 /* }}} */
 
index 1061ef85834a17cc14b4498c2122f3e4775e81bf..81fef71dcf1b0f120ccb8de1e93cafeb75752b06 100644 (file)
@@ -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));
                }
index 6370c5e4b2895d357c98b9eade7af52ea327fd9a..cc19b0dfaa0b9929ea83d0b07a1d77ef424cb5ec 100644 (file)
@@ -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;
index b06eba7fd6155432876c423661d55d3d1b217827..3b0ca328b73320f172a94ded25ff695a6cd8d49e 100644 (file)
@@ -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);
                
index a0137878d520d9e7a35a23145b8c5c7ca3bcf450..3b5c7ed0ba889099d20ead7fbefd10a974a777fa 100644 (file)
@@ -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
 
index fc11bad4b29d993cd8488c3abd434098fbc13266..9562470cef363c9648f857d2cf980d12b4ff6252 100644 (file)
@@ -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;
index d7f6c13f307fa741d8780bd61981e710345ceac4..fb2f62f6662ecf0f8753dbdcdb61b5cfe0a34415 100644 (file)
@@ -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);
 
index 304d199ff8f5bb5be330f1a9298a32e0117e905d..9595df11dbdf54d07756642650364fade8a18930 100644 (file)
@@ -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);
 
index 5e09d5a6948cec28dceb67c9cc704c509dadf9a1..2ab43d3239d034657864a49c5776e02d8d5deb28 100644 (file)
@@ -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();
index aaf4589b3fce92e38764e50d095acd120e54c775..1cb890bae35c84c751f072e9fea5fc8e3e97122c 100644 (file)
@@ -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;
                }