summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-06-11 09:23:00 +0000
committerZeev Suraski <zeev@php.net>1999-06-11 09:23:00 +0000
commit1798a0183a962342948bd9110435994d87853a8b (patch)
tree15263717d49a83ac2d4d2230030c27ace9fc91a1
parentc1f75b6fda70a9f127f61fe2568dcd6aad56be13 (diff)
downloadphp-git-1798a0183a962342948bd9110435994d87853a8b.tar.gz
* Fix a buglet in the session module
* 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
-rw-r--r--ext/session/mod_files.c2
-rw-r--r--ext/session/php_session.h8
-rw-r--r--ext/session/session.c16
-rw-r--r--ext/standard/basic_functions.c4
-rw-r--r--ext/standard/file.c4
-rw-r--r--main/main.c94
6 files changed, 17 insertions, 111 deletions
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index 88c2fb6a39..1ac35fea30 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -165,7 +165,7 @@ PS_WRITE_FUNC(files)
return SUCCESS;
}
-PS_DELETE_FUNC(files)
+PS_DESTROY_FUNC(files)
{
char buf[MAXPATHLEN];
PS_FILES_DATA;
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index 0637b29107..356a24f605 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -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)
diff --git a/ext/session/session.c b/ext/session/session.c
index c357afa7f6..9396d0dce9 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -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;
}
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 977dd0ea22..8f138e71ac 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -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;
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 399804bb82..eef2696b92 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -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;
diff --git a/main/main.c b/main/main.c
index 5218c570be..8f3e41ae7f 100644
--- a/main/main.c
+++ b/main/main.c
@@ -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;