]> granicus.if.org Git - php/commitdiff
Thread-safe header_is_being_sent
authorZeev Suraski <zeev@php.net>
Fri, 23 Apr 1999 20:20:30 +0000 (20:20 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 23 Apr 1999 20:20:30 +0000 (20:20 +0000)
ext/standard/head.c
main.h
main/main.c
main/php_globals.h

index 6c2772a5479b0767827d4cfbf1544eb05cbd06f0..6f06a4b031deb71ca2f7f5827801fcafeb596582 100644 (file)
@@ -236,17 +236,17 @@ PHPAPI int php3_header(void)
 #if APACHE || defined(USE_SAPI) || FHTTPD
        char *tempstr;
 #endif
-TLS_VARS;
+       PLS_FETCH();
 
-       if (GLOBAL(header_is_being_sent)) {
+       if (PG(header_is_being_sent)) {
                return 0;
        } else {
-               GLOBAL(header_is_being_sent) = 1;
+               PG(header_is_being_sent) = 1;
        }
 
 #if APACHE
        if (!GLOBAL(php3_rqst)) {  /* we're not in a request, allow output */
-               GLOBAL(header_is_being_sent) = 0;
+               PG(header_is_being_sent) = 0;
                return 1;
        }
        if ((GLOBAL(php3_PrintHeader) && !GLOBAL(php3_HeaderPrinted)) || (GLOBAL(php3_PrintHeader) && GLOBAL(php3_HeaderPrinted) == 2)) {
@@ -324,7 +324,7 @@ TLS_VARS;
                send_http_header(GLOBAL(php3_rqst));
                if (GLOBAL(php3_rqst)->header_only) {
                        set_header_request(1);
-                       GLOBAL(header_is_being_sent) = 0;
+                       PG(header_is_being_sent) = 0;
                        return(0);
                }
        }
@@ -382,7 +382,7 @@ TLS_VARS;
                GLOBAL(header_called) = 1;
        }
 #endif
-       GLOBAL(header_is_being_sent) = 0;
+       PG(header_is_being_sent) = 0;
        return(1);
 }
 
diff --git a/main.h b/main.h
index 3f4501210c3a692139ce4a91e7ba18f047ada4fd..d19d0208ccb78d9fb5c37d7e10688e6d54bd1957 100644 (file)
--- a/main.h
+++ b/main.h
@@ -55,7 +55,6 @@ extern void php3_module_shutdown();
 extern void php3_module_shutdown_for_exec(void);
 
 #ifndef THREAD_SAFE
-extern unsigned char header_is_being_sent;
 extern int initialized;
 #endif
 
index 5a0cf38eefe21100a3f89b94a2f0c8f6aebe426f..4b706ae375e1f67f193ffb75eef6bf119599bc29 100644 (file)
@@ -250,7 +250,6 @@ PHP_INI_END()
  */
 int initialized;                               /* keep track of which resources were successfully initialized */
 static int module_initialized = 0;
-unsigned char header_is_being_sent;
 
 #if WIN32|WINNT
 unsigned int wintimer;
@@ -648,7 +647,7 @@ int php3_request_startup(CLS_D ELS_DC PLS_DC)
 
        /* initialize global variables */
        {
-               GLOBAL(header_is_being_sent) = 0;
+               PG(header_is_being_sent)=0;
        }
 
        if (php3_init_request_info(NULL)) {
index 19dbaa8804c54f960f3a6be0f71226d44fc406c7..969d7cab667811a8f678c95450f802dbb7755f84 100644 (file)
@@ -63,7 +63,9 @@ struct _php_core_globals {
     long track_vars;
 
     long y2k_compliance;
+
+       unsigned char header_is_being_sent;
 };
 
 
-#endif /* _PHP_GLOBALS_H */
\ No newline at end of file
+#endif /* _PHP_GLOBALS_H */