]> granicus.if.org Git - php/commitdiff
Align ZTS handling of globals with common usage
authorSascha Schumann <sas@php.net>
Sun, 10 Dec 2000 23:22:20 +0000 (23:22 +0000)
committerSascha Schumann <sas@php.net>
Sun, 10 Dec 2000 23:22:20 +0000 (23:22 +0000)
sapi/apache/mod_php4.c
sapi/apache/mod_php4.h
sapi/apache/php_apache.c

index 16faa88facc9b8e3a875fafacc670c4dec49d34b..23580a911bd6e9ec4a80176187e6121e01055d55 100644 (file)
@@ -108,8 +108,6 @@ typedef struct _php_per_dir_entry {
        int type;
 } php_per_dir_entry;
 
-php_apache_info_struct php_apache_info;                /* active config */
-
 /* some systems are missing these from their header files */
 
 void php_save_umask(void)
@@ -437,6 +435,7 @@ int send_php(request_rec *r, int display_source_mode, char *filename)
        ELS_FETCH();
        CLS_FETCH();
        PLS_FETCH();
+       APLS_FETCH();
 
        if (setjmp(EG(bailout))!=0) {
                return OK;
@@ -460,7 +459,7 @@ int send_php(request_rec *r, int display_source_mode, char *filename)
        /* If PHP parser engine has been turned off with an "engine off"
         * directive, then decline to handle this request
         */
-       if (!php_apache_info.engine) {
+       if (!AP(engine)) {
                r->content_type = php_apache_get_default_mimetype(r SLS_CC);
                r->allowed |= (1 << METHODS) - 1;
                return DECLINED;
@@ -475,7 +474,7 @@ int send_php(request_rec *r, int display_source_mode, char *filename)
                return retval;
 #endif
 
-       if (php_apache_info.last_modified) {
+       if (AP(last_modified)) {
 #if MODULE_MAGIC_NUMBER < 19970912
                if ((retval = set_last_modified(r, r->finfo.st_mtime))) {
                        return retval;
index 3b2813dad486bd11dbb360cd43f6eb687c65e0ad..461805550c91c4f16f71c4252ee5c7fa4728d3d4 100644 (file)
@@ -33,7 +33,19 @@ typedef struct {
 } php_apache_info_struct;
 
 extern zend_module_entry apache_module_entry;
+
+#ifdef ZTS
+extern int php_apache_info_id;
+#define APLS_D php_apache_info_struct *apache_globals
+#define AP(v) (apache_globals->v)
+#define APLS_FETCH() APLS_D = ts_resource(php_apache_info_id)
+#else
 extern php_apache_info_struct php_apache_info;
+#define APLS_D
+#define AP(v) (php_apache_info.v)
+#define APLS_FETCH()
+#endif
+
 
 #ifdef WIN32
 #define S_IXUSR _S_IEXEC
index 13968ec5f0b001b30d7d8550fbf7816652dfa1d0..64898b8916450521ab155bbf275b1dbac1f765ce 100644 (file)
 #include "php_apache_http.h"
 #include "http_request.h"
 
-static int php_apache_info_id;
+#ifdef ZTS
+int php_apache_info_id;
+#else
+php_apache_info_struct php_apache_info;
+#endif
 
 #ifdef PHP_WIN32
 #include "zend.h"
@@ -74,34 +78,34 @@ function_entry apache_functions[] = {
        {NULL, NULL, NULL}
 };
 
-#ifndef PHP_WIN32
+
 PHP_INI_BEGIN()
        STD_PHP_INI_ENTRY("xbithack",                   "0",                            PHP_INI_ALL,            OnUpdateInt,            xbithack, php_apache_info_struct, php_apache_info)
        STD_PHP_INI_ENTRY("engine",                             "1",                            PHP_INI_ALL,            OnUpdateInt,            engine, php_apache_info_struct, php_apache_info)
        STD_PHP_INI_ENTRY("last_modified",              "0",                            PHP_INI_ALL,            OnUpdateInt,            last_modified, php_apache_info_struct, php_apache_info)
 PHP_INI_END()
 
+
 static PHP_MINIT_FUNCTION(apache)
 {
+#ifdef ZTS
+       php_apache_info_id = ts_allocate_id(sizeof(php_apache_info_struct), NULL, NULL);
+#endif
        REGISTER_INI_ENTRIES();
        return SUCCESS;
 }
 
+
 static PHP_MSHUTDOWN_FUNCTION(apache)
 {
        UNREGISTER_INI_ENTRIES();
        return SUCCESS;
 }
 
+
 zend_module_entry apache_module_entry = {
        "apache", apache_functions, PHP_MINIT(apache), PHP_MSHUTDOWN(apache), NULL, NULL, PHP_MINFO(apache), STANDARD_MODULE_PROPERTIES
 };
-#else
-zend_module_entry apache_module_entry = {
-       "apache", apache_functions, NULL, NULL, NULL, NULL, PHP_MINFO(apache), STANDARD_MODULE_PROPERTIES
-};
-#endif
-
 
 /* {{{ proto string apache_note(string note_name [, string note_value])
    Get and set Apache request notes */