]> granicus.if.org Git - php/commitdiff
* Fix a buglet in the session module
authorZeev Suraski <zeev@php.net>
Fri, 11 Jun 1999 09:23:00 +0000 (09:23 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 11 Jun 1999 09:23:00 +0000 (09:23 +0000)
* Make some renames in the session module - avoid having a function called 'delete'
  so that we don't piss any C++ compilers.  Also rename the {startup,shutdown}_globals
  to {startup,shutdown}_session_globals, so that they're a bit less general names,
  and made them static.
* Remove uselss variables

ext/session/mod_files.c
ext/session/php_session.h
ext/session/session.c
ext/standard/basic_functions.c
ext/standard/file.c
main/main.c

index 88c2fb6a39b0b319654689d1d97c2aeee6fb114a..1ac35fea30a84a7c9945369f42099725648ae60d 100644 (file)
@@ -165,7 +165,7 @@ PS_WRITE_FUNC(files)
        return SUCCESS;
 }
 
-PS_DELETE_FUNC(files)
+PS_DESTROY_FUNC(files)
 {
        char buf[MAXPATHLEN];
        PS_FILES_DATA;
index 0637b2910717468edbf04df9524902ef01ee36f9..356a24f605ed254bba92180dffd847dc18850fe4 100644 (file)
@@ -39,7 +39,7 @@ typedef enum {
 #define PS_CLOSE_ARGS void **mod_data
 #define PS_READ_ARGS void **mod_data, const char *key, char **val, int *vallen
 #define PS_WRITE_ARGS void **mod_data, const char *key, const char *val, const int vallen
-#define PS_DELETE_ARGS void **mod_data, const char *key
+#define PS_DESTROY_ARGS void **mod_data, const char *key
 #define PS_GC_ARGS void **mod_data, int maxlifetime
 
 typedef struct ps_module_struct {
@@ -48,7 +48,7 @@ typedef struct ps_module_struct {
        int (*close)(PS_CLOSE_ARGS);
        int (*read)(PS_READ_ARGS);
        int (*write)(PS_WRITE_ARGS);
-       int (*delete)(PS_DELETE_ARGS);
+       int (*destroy)(PS_DESTROY_ARGS);
        int (*gc)(PS_GC_ARGS);
 } ps_module;
 
@@ -57,7 +57,7 @@ typedef struct ps_module_struct {
 #define PS_CLOSE_FUNC(x)       int _ps_close_##x(PS_CLOSE_ARGS)
 #define PS_READ_FUNC(x)        int _ps_read_##x(PS_READ_ARGS)
 #define PS_WRITE_FUNC(x)       int _ps_write_##x(PS_WRITE_ARGS)
-#define PS_DELETE_FUNC(x)      int _ps_delete_##x(PS_DELETE_ARGS)
+#define PS_DESTROY_FUNC(x)     int _ps_delete_##x(PS_DESTROY_ARGS)
 #define PS_GC_FUNC(x)          int _ps_gc_##x(PS_GC_ARGS)
 
 #define PS_FUNCS(x) \
@@ -65,7 +65,7 @@ typedef struct ps_module_struct {
        PS_CLOSE_FUNC(x); \
        PS_READ_FUNC(x); \
        PS_WRITE_FUNC(x); \
-       PS_DELETE_FUNC(x); \
+       PS_DESTROY_FUNC(x); \
        PS_GC_FUNC(x)
 
 
index c357afa7f636129cd6c5372e6805a85ac7a8d98e..9396d0dce90dce0f4cb01d5e3bba7dda915147d5 100644 (file)
@@ -86,7 +86,7 @@ static int php_rinit_session(INIT_FUNC_ARGS);
 static int php_mshutdown_session(SHUTDOWN_FUNC_ARGS);
 static int php_rshutdown_session(SHUTDOWN_FUNC_ARGS);
 static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS);
-static void php_rshutdown_globals(PSLS_D);
+static void php_rshutdown_session_globals(PSLS_D);
 
 zend_module_entry session_module_entry = {
        "session",
@@ -308,7 +308,7 @@ static void _php_session_start(PSLS_D)
 
        if(PS(mod_data) && PS(gc_probability) > 0) {
                srand(time(NULL));
-               nrand = (100.0*rand()/RAND_MAX);
+               nrand = (int) (100.0*rand()/RAND_MAX);
                if(nrand >= PS(gc_probability)) 
                        PS(mod)->gc(&PS(mod_data), PS(gc_maxlifetime));
        }
@@ -319,8 +319,8 @@ static void _php_session_destroy(PSLS_D)
        if(PS(nr_open_sessions) == 0)
                return;
 
-       PS(mod)->delete(&PS(mod_data), &PS(id));
-       php_rshutdown_globals(PSLS_C);
+       PS(mod)->destroy(&PS(mod_data), PS(id));
+       php_rshutdown_session_globals(PSLS_C);
        PS(nr_open_sessions)--;
 }
 
@@ -521,7 +521,7 @@ PHP_FUNCTION(session_destroy)
 }
 /* }}} */
 
-void php_rinit_globals(PSLS_D)
+static void php_rinit_session_globals(PSLS_D)
 {
        PS(mod) = _php_find_ps_module(INI_STR("session_module_name") PSLS_CC);
                
@@ -535,7 +535,7 @@ void php_rinit_globals(PSLS_D)
        PS(mod_data) = NULL;
 }
 
-void php_rshutdown_globals(PSLS_D)
+static void php_rshutdown_session_globals(PSLS_D)
 {
        if(PS(mod_data))
                PS(mod)->close(&PS(mod_data));
@@ -549,7 +549,7 @@ int php_rinit_session(INIT_FUNC_ARGS)
 {
        PSLS_FETCH();
 
-       php_rinit_globals(PSLS_C);
+       php_rinit_session_globals(PSLS_C);
 
        if(INI_INT("session_auto_start")) {
                _php_session_start(PSLS_C);
@@ -568,7 +568,7 @@ int php_rshutdown_session(SHUTDOWN_FUNC_ARGS)
                _php_session_save_current_state(PSLS_C);
                PS(nr_open_sessions)--;
        }
-       php_rshutdown_globals(PSLS_C);
+       php_rshutdown_session_globals(PSLS_C);
        return SUCCESS;
 }
 
index 977dd0ea229f69d5a1d31a7373c89ed6dc87730a..8f138e71acc2a37dc11f981aa6521594834f3baf 100644 (file)
@@ -2744,8 +2744,8 @@ PHP_FUNCTION(array_slice)
                                 length_val,    /* Value of the length argument */
                                 num_in,                /* Number of elements in the input array */
                                 pos,                   /* Current position in the array */
-                                argc,                  /* Number of function arguments */
-                                i;                             /* Loop counter */
+                                argc;                  /* Number of function arguments */
+                                
        char            *string_key;
        ulong            num_key;
        
index 399804bb82c7b8e27c85bbc91e81d4d1367ab4ce..eef2696b9208c508b41bcef52d5b4eb4c68069f3 100644 (file)
@@ -1526,8 +1526,8 @@ PHP_FUNCTION(fgetcsv) {
 
        pval *fd, *bytes;
        FILE *fp;
-       int id, len, br, type;
-       char *buf, *p, *rbuf, *rp, c, lc;
+       int id, len, type;
+       char *buf;
        int issock=0;
        int *sock,socketd=0;
 
index 5218c570be733284915c0acbe5a3b1158a2cbda8..8f3e41ae7f1652a5d2c8aed14085cab01ce79ecc 100644 (file)
@@ -688,10 +688,6 @@ int return_one(void *p)
 
 void php_request_shutdown(void *dummy)
 {
-#if FHTTPD
-       char tmpline[128];
-       int i, serverdefined;
-#endif
        CLS_FETCH();
        ELS_FETCH();
        PLS_FETCH();
@@ -712,7 +708,6 @@ void php_request_shutdown(void *dummy)
        php3_unset_timeout();
 
 
-
 #if CGI_BINARY
        fflush(stdout);
        if(request_info.php_argv0) {
@@ -720,47 +715,6 @@ void php_request_shutdown(void *dummy)
                request_info.php_argv0 = NULL;
        }
 #endif
-#if FHTTPD
-       if (response) {
-               if (!headermade) {
-                       makestandardheader(response, 200, "text/html", "fhttpd", req && req->keepalive);
-               } else {
-                       if (headerfirstline)
-                               putlinetoheader(response, headerfirstline);
-                       else
-                               putlinetoheader(response, "HTTP/1.0 200 OK\r\n");
-                       serverdefined = 0;
-                       for (i = 0; i < headerlines; i++) {
-                               if (!strncmp(currentheader[i], "Server:", 7))
-                                       serverdefined = 1;
-                               putlinetoheader(response, currentheader[i]);
-                       }
-                       if (!serverdefined)
-                               putlinetoheader(response, "Server: fhttpd\r\n");
-                       if (response->datasize) {
-                               sprintf(tmpline, "Content-Length: %ld\r\n", response->datasize);
-                               putlinetoheader(response, tmpline);
-                               if (req && req->keepalive)
-                                       putlinetoheader(response,
-                                                                       "Connection: Keep-Alive\r\nKeep-Alive: max=0, timeout=30\r\n");
-                       }
-                       php3_fhttpd_free_header();
-               }
-               sendresponse(server, response);
-               if (response->datasize)
-                       finishresponse(server, response);
-               else
-                       finishdropresponse(server, response);
-               deleteresponse(response);
-       }
-       response = NULL;
-       if (req)
-               deleterequest(req);
-       req = NULL;
-#endif
-#if USE_SAPI
-       sapi_rqst->flush(sapi_rqst->scid);
-#endif
 }
 
 
@@ -1018,54 +972,6 @@ int _php3_hash_environment(PLS_D ELS_DC)
                _php3_hash_update(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void *) &tmp, sizeof(pval *), NULL);
        }
 #else
-#if FHTTPD
-       {
-               int i, j;
-               if (req) {
-                       for (i = 0; i < req->nlines; i++) {
-                               if (req->lines[i].paramc > 1 && req->lines[i].params[0] && req->lines[i].params[1]) {
-                                       tmp = (pval *) emalloc(sizeof(pval));
-                                       tmp->value.str.len = strlen(req->lines[i].params[1]);
-                                       tmp->value.str.val = estrndup(req->lines[i].params[1], tmp->value.str.len);
-                                       tmp->type = IS_STRING;
-                                       tmp->refcount=1;
-                                       tmp->is_ref=0;
-                                       _php3_hash_update(&EG(symbol_table), req->lines[i].params[0],
-                                                                       strlen(req->lines[i].params[0]) + 1, &tmp, 
-                                                                       sizeof(pval *), NULL);
-                               }
-                       }
-                       if (req->script_name_resolved) {
-                               i = strlen(req->script_name_resolved);
-                               tmp = (pval *) emalloc(sizeof(pval));
-                               tmp->value.str.len = i;
-                               tmp->value.str.val = estrndup(req->script_name_resolved, i);
-                               tmp->type = IS_STRING;
-                               tmp->refcount=1;
-                               tmp->is_ref=0;
-                               _php3_hash_update(&EG(symbol_table), "PATH_TRANSLATED",
-                                                               sizeof("PATH_TRANSLATED"),
-                                                               &tmp, sizeof(pval *), NULL);
-                               if (req->script_name) {
-                                       j = i - strlen(req->script_name);
-                                       if (j > 0
-                                               && !strcmp(req->script_name_resolved + j,
-                                                                  req->script_name)) {
-                                               tmp = (pval *) emalloc(sizeof(pval));
-                                               tmp->value.str.len = j;
-                                               tmp->value.str.val = estrndup(req->script_name_resolved, j);
-                                               tmp->type = IS_STRING;
-                                               tmp->refcount=1;
-                                               tmp->is_ref=0;
-                                               _php3_hash_update(&EG(symbol_table), "DOCUMENT_ROOT",
-                                                                               sizeof("DOCUMENT_ROOT"),
-                                                          &tmp, sizeof(pval *), NULL);
-                                       }
-                               }
-                       }
-               }
-       }
-#endif
        {
                /* Build the special-case PHP_SELF variable for the CGI version */
                char *pi;