From: Sascha Schumann <sas@php.net>
Date: Fri, 11 Feb 2000 13:41:30 +0000 (+0000)
Subject: More cosmetic things
X-Git-Tag: BEFORE_SAPI_POST_PATCH_17_FEB_2000~85
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12d3e3d77582029226e81f5a1f9ed79054b4b2ed;p=php

More cosmetic things
---

diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index f5ab4bf8a5..60870affb1 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -30,7 +30,7 @@
 #include <dirent.h>
 #endif
 
-#if WIN32||WINNT
+#if PHP_WIN32
 #define NEEDRDH 1
 #include "win32/readdir.h"
 #endif
@@ -56,7 +56,7 @@ ps_module ps_mod_files = {
 	PS_MOD(files)
 };
 
-#if WIN32|WINNT
+#if PHP_WIN32
 #define DIR_DELIMITER '\\'
 #else
 #define DIR_DELIMITER '/'
@@ -69,9 +69,9 @@ static int _ps_files_valid_key(const char *key)
 	char c;
 	int ret = 1;
 
-	for(p = key; (c = *p); p++) {
+	for (p = key; (c = *p); p++) {
 		/* valid characters are a..z,A..Z,0..9 */
-		if(!((c >= 'a' && c <= 'z') ||
+		if (!((c >= 'a' && c <= 'z') ||
 				(c >= 'A' && c <= 'Z') ||
 				(c >= '0' && c <= '9'))) {
 			ret = 0;
@@ -81,9 +81,8 @@ static int _ps_files_valid_key(const char *key)
 
 	len = p - key;
 	
-	if(len == 0) {
+	if (len == 0)
 		ret = 0;
-	}
 	
 	return ret;
 }
@@ -96,12 +95,12 @@ static char *_ps_files_path_create(char *buf, size_t buflen, ps_files *data, con
 	int n;
 	
 	keylen = strlen(key);
-	if(keylen <= data->dirdepth || buflen < 
+	if (keylen <= data->dirdepth || buflen < 
 			(strlen(data->basedir) + 2 * data->dirdepth + keylen + 5 + sizeof(FILE_PREFIX))) 
 		return NULL;
 	p = key;
 	n = sprintf(buf, "%s/", data->basedir);
-	for(i = 0; i < data->dirdepth; i++) {
+	for (i = 0; i < data->dirdepth; i++) {
 		buf[n++] = *p++;
 		buf[n++] = DIR_DELIMITER;
 	}
@@ -116,17 +115,17 @@ static void _ps_files_open(ps_files *data, const char *key)
 {
 	char buf[MAXPATHLEN];
 
-	if(data->fd < 0 || !data->lastkey || strcmp(key, data->lastkey)) {
-		if(data->lastkey) {
+	if (data->fd < 0 || !data->lastkey || strcmp(key, data->lastkey)) {
+		if (data->lastkey) {
 			efree(data->lastkey);
 			data->lastkey = NULL;
 		}
-		if(data->fd != -1) {
+		if (data->fd != -1) {
 			close(data->fd);
 			data->fd = -1;
 		}
 		
-		if(!_ps_files_valid_key(key) || 
+		if (!_ps_files_valid_key(key) || 
 				!_ps_files_path_create(buf, sizeof(buf), data, key))
 			return;
 		
@@ -143,9 +142,8 @@ static void _ps_files_open(ps_files *data, const char *key)
 		}
 #else
 		data->fd = open(buf, O_CREAT | O_RDWR, 0600);
-		if(data->fd != -1) {
+		if (data->fd != -1)
 			flock(data->fd, LOCK_EX);
-		}
 #endif
 	}
 }
@@ -159,13 +157,13 @@ static void _ps_files_cleanup_dir(const char *dirname, int maxlifetime)
 	time_t now;
 
 	dir = opendir(dirname);
-	if(!dir) return;
+	if (!dir) return;
 
 	time(&now);
 
 	while((entry = readdir(dir))) {
 		/* does the file start with our prefix? */
-		if(!strncmp(entry->d_name, FILE_PREFIX, sizeof(FILE_PREFIX) - 1) &&
+		if (!strncmp(entry->d_name, FILE_PREFIX, sizeof(FILE_PREFIX) - 1) &&
 				/* create full path */
 				snprintf(buf, MAXPATHLEN, "%s%c%s", dirname, DIR_DELIMITER,
 					entry->d_name) > 0 &&
@@ -191,7 +189,7 @@ PS_OPEN_FUNC(files)
 	PS_SET_MOD_DATA(data);
 
 	data->fd = -1;
-	if((p = strchr(save_path, ':'))) {
+	if ((p = strchr(save_path, ':'))) {
 		data->dirdepth = strtol(save_path, NULL, 10);
 		save_path = p + 1;
 	}
@@ -204,8 +202,10 @@ PS_CLOSE_FUNC(files)
 {
 	PS_FILES_DATA;
 
-	if(data->fd > -1) close(data->fd);
-	if(data->lastkey) efree(data->lastkey);
+	if (data->fd > -1) 
+		close(data->fd);
+	if (data->lastkey) 
+		efree(data->lastkey);
 	efree(data->basedir);
 	efree(data);
 	*mod_data = NULL;
@@ -220,13 +220,11 @@ PS_READ_FUNC(files)
 	PS_FILES_DATA;
 
 	_ps_files_open(data, key);
-	if(data->fd < 0) {
+	if (data->fd < 0)
 		return FAILURE;
-	}
 	
-	if(fstat(data->fd, &sbuf)) {
+	if (fstat(data->fd, &sbuf))
 		return FAILURE;
-	}
 	
 	lseek(data->fd, 0, SEEK_SET);
 
@@ -234,7 +232,7 @@ PS_READ_FUNC(files)
 	*val = emalloc(sbuf.st_size);
 
 	n = read(data->fd, *val, sbuf.st_size);
-	if(n != sbuf.st_size) {
+	if (n != sbuf.st_size) {
 		efree(*val);
 		return FAILURE;
 	}
@@ -247,9 +245,8 @@ PS_WRITE_FUNC(files)
 	PS_FILES_DATA;
 
 	_ps_files_open(data, key);
-	if(data->fd < 0) {
+	if (data->fd < 0)
 		return FAILURE;
-	}
 
 	ftruncate(data->fd, 0);
 	lseek(data->fd, 0, SEEK_SET);
@@ -263,7 +260,7 @@ PS_DESTROY_FUNC(files)
 	char buf[MAXPATHLEN];
 	PS_FILES_DATA;
 
-	if(!_ps_files_path_create(buf, sizeof(buf), data, key))
+	if (!_ps_files_path_create(buf, sizeof(buf), data, key))
 		return FAILURE;
 	
 	unlink(buf);
@@ -279,11 +276,8 @@ PS_GC_FUNC(files)
 	   we return SUCCESS, since all cleanup should be handled by
 	   an external entity (i.e. find -ctime x | xargs rm) */
 	   
-	if(data->dirdepth > 0) {
-		return SUCCESS;
-	}
-
-	_ps_files_cleanup_dir(data->basedir, maxlifetime);
+	if (data->dirdepth == 0)
+		_ps_files_cleanup_dir(data->basedir, maxlifetime);
 	
 	return SUCCESS;
 }
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
index c34778519d..c407619d1d 100644
--- a/ext/session/mod_mm.c
+++ b/ext/session/mod_mm.c
@@ -74,11 +74,10 @@ static unsigned int ps_sd_hash(const char *data)
 {
 	unsigned int val, i;
 	
-	for(val = 0; *data; data++) {
+	for (val = 0; *data; data++) {
 		val = (val << ONE_EIGTH) + *data;
-		if((i = val & HIGH_BITS) != 0) {
+		if ((i = val & HIGH_BITS) != 0)
 			val = (val ^ (i >> THREE_QUARTERS)) & -HIGH_BITS;
-		}
 	}
 	
 	return val;
@@ -93,13 +92,12 @@ static ps_sd *ps_sd_new(ps_mm *data, const char *key, const void *sdata, size_t
 	h = ps_sd_hash(key) % HASH_SIZE;
 	
 	sd = mm_malloc(data->mm, sizeof(*sd));
-	if(!sd) {
+	if (!sd)
 		return NULL;
-	}
 	sd->ctime = 0;
 	
 	sd->data = mm_malloc(data->mm, sdatalen);
-	if(!sd->data) {
+	if (!sd->data) {
 		mm_free(data->mm, sd);
 		return NULL;
 	}
@@ -107,7 +105,7 @@ static ps_sd *ps_sd_new(ps_mm *data, const char *key, const void *sdata, size_t
 	sd->datalen = sdatalen;
 	
 	sd->key = mm_strdup(data->mm, key);
-	if(!sd->key) {
+	if (!sd->key) {
 		mm_free(data->mm, sd->data);
 		mm_free(data->mm, sd);
 		return NULL;
@@ -115,7 +113,7 @@ static ps_sd *ps_sd_new(ps_mm *data, const char *key, const void *sdata, size_t
 	
 	memcpy(sd->data, sdata, sdatalen);
 	
-	if((sd->next = data->hash[h]))
+	if ((sd->next = data->hash[h]))
 		sd->next->prev = sd;
 	sd->prev = NULL;
 	
@@ -132,16 +130,17 @@ static void ps_sd_destroy(ps_mm *data, ps_sd *sd)
 
 	h = ps_sd_hash(sd->key) % HASH_SIZE;
 	
-	if(sd->next)
+	if (sd->next)
 		sd->next->prev = sd->prev;
-	if(sd->prev)
+	if (sd->prev)
 		sd->prev->next = sd->next;
 	
-	if(data->hash[h] == sd)
+	if (data->hash[h] == sd)
 		data->hash[h] = sd->next;
 		
 	mm_free(data->mm, sd->key);
-	if(sd->data) mm_free(data->mm, sd->data);
+	if (sd->data) 
+		mm_free(data->mm, sd->data);
 	mm_free(data->mm, sd);
 }
 
@@ -152,10 +151,11 @@ static ps_sd *ps_sd_lookup(ps_mm *data, const char *key, int rw)
 
 	h = ps_sd_hash(key) % HASH_SIZE;
 
-	for(ret = data->hash[h]; ret; ret = ret->next)
-		if(!strcmp(ret->key, key)) break;
+	for (ret = data->hash[h]; ret; ret = ret->next)
+		if (!strcmp(ret->key, key)) 
+			break;
 
-	if(ret && rw && ret != data->hash[h]) {
+	if (ret && rw && ret != data->hash[h]) {
 		data->hash[h]->prev = ret;
 		ret->next = data->hash[h];
 		data->hash[h] = ret;
@@ -187,12 +187,11 @@ static void ps_mm_destroy(ps_mm *data)
 	int h;
 	ps_sd *sd, *next;
 
-	for(h = 0; h < HASH_SIZE; h++) {
-		for(sd = data->hash[h]; sd; sd = next) {
+	for (h = 0; h < HASH_SIZE; h++)
+		for (sd = data->hash[h]; sd; sd = next) {
 			next = sd->next;
 			ps_sd_destroy(data, sd);
 		}
-	}
 	
 	mm_free(data->mm, data->hash);
 	mm_destroy(data->mm);
@@ -216,9 +215,8 @@ PS_OPEN_FUNC(mm)
 {
 	ps_mm_debug("open: ps_mm_instance=%x\n", ps_mm_instance);
 	
-	if(!ps_mm_instance) {
+	if (!ps_mm_instance)
 		return FAILURE;
-	}
 	
 	PS_SET_MOD_DATA(ps_mm_instance);
 	
@@ -241,7 +239,7 @@ PS_READ_FUNC(mm)
 	mm_lock(data->mm, MM_LOCK_RD);
 	
 	sd = ps_sd_lookup(data, key, 0);
-	if(sd) {
+	if (sd) {
 		*vallen = sd->datalen;
 		*val = emalloc(sd->datalen);
 		memcpy(*val, sd->data, sd->datalen);
@@ -261,7 +259,7 @@ PS_WRITE_FUNC(mm)
 	mm_lock(data->mm, MM_LOCK_RW);
 
 	sd = ps_sd_lookup(data, key, 1);
-	if(!sd) {
+	if (!sd) {
 		sd = ps_sd_new(data, key, val, vallen);
 		ps_mm_debug(stderr, "new one for %s\n", key);
 	} else {
@@ -269,15 +267,15 @@ PS_WRITE_FUNC(mm)
 		mm_free(data->mm, sd->data);
 		sd->datalen = vallen;
 		sd->data = mm_malloc(data->mm, vallen);
-		if(!sd->data) {
+		if (!sd->data) {
 			ps_sd_destroy(data, sd);
 			sd = NULL;
-		} else {
+		} else
 			memcpy(sd->data, val, vallen);
-		}
 	}
 
-	if(sd) time(&sd->ctime);
+	if (sd)
+		time(&sd->ctime);
 
 	mm_unlock(data->mm);
 	
@@ -292,9 +290,8 @@ PS_DESTROY_FUNC(mm)
 	mm_lock(data->mm, MM_LOCK_RW);
 	
 	sd = ps_sd_lookup(data, key, 0);
-	if(sd) {
+	if (sd)
 		ps_sd_destroy(data, sd);
-	}
 	
 	mm_unlock(data->mm);
 	
@@ -314,15 +311,13 @@ PS_GC_FUNC(mm)
 	
 	time(&now);
 
-	for(h = 0; h < HASH_SIZE; h++) {
-		for(sd = data->hash[h]; sd; sd = next) {
+	for (h = 0; h < HASH_SIZE; h++)
+		for (sd = data->hash[h]; sd; sd = next) {
 			next = sd->next;
 			ps_mm_debug("looking at %s\n", sd->key);
-			if((now - sd->ctime) > maxlifetime) {
+			if ((now - sd->ctime) > maxlifetime)
 				ps_sd_destroy(data, sd);
-			}
 		}
-	}
 
 	mm_unlock(data->mm);
 	
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index 10e5cdc7de..58a5534daa 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -55,13 +55,13 @@ static zval *ps_call_handler(char *name, int argc, zval **argv)
 	zval *retval = NULL;
 	ELS_FETCH();
 	
-	if(name && name[0] != '\0') {
+	if (name && name[0] != '\0') {
 		zval *func;
 
 		SESS_ZVAL_STRING(name, func);
 		MAKE_STD_ZVAL(retval);
 
-		if(call_user_function(EG(function_table), NULL, func, retval, 
+		if (call_user_function(EG(function_table), NULL, func, retval, 
 					argc, argv) == FAILURE) {
 			zval_dtor(retval);
 			efree(retval);
@@ -71,7 +71,7 @@ static zval *ps_call_handler(char *name, int argc, zval **argv)
 		efree(func);
 	}
 
-	for(i = 0; i < argc; i++) {
+	for (i = 0; i < argc; i++) {
 		zval_dtor(argv[i]);
 		efree(argv[i]);
 	}
@@ -83,12 +83,13 @@ static zval *ps_call_handler(char *name, int argc, zval **argv)
 	zval *retval; 							\
 	int ret = FAILURE; 						\
 	ps_user *mdata = PS_GET_MOD_DATA();		\
-	if(!mdata) return FAILURE
+	if (!mdata) 							\
+		return FAILURE
 
 #define PSF(a) mdata->name.ps_##a
 
 #define FINISH 								\
-	if(retval) {							\
+	if (retval) {							\
 		convert_to_long(retval);			\
 		ret = retval->value.lval;			\
 		zval_dtor(retval);					\
@@ -116,9 +117,8 @@ PS_CLOSE_FUNC(user)
 
 	retval = ps_call_handler(PSF(close), 0, NULL);
 
-	for(i = 0; i < 6; i++) {
+	for (i = 0; i < 6; i++)
 		efree(mdata->names[i]);
-	}
 	efree(mdata);
 
 	PS_SET_MOD_DATA(NULL);
@@ -135,8 +135,8 @@ PS_READ_FUNC(user)
 
 	retval = ps_call_handler(PSF(read), 1, args);
 	
-	if(retval) {
-		if(retval->type == IS_STRING) {
+	if (retval) {
+		if (retval->type == IS_STRING) {
 			*val = estrndup(retval->value.str.val, retval->value.str.len);
 			*vallen = retval->value.str.len;
 			ret = SUCCESS;
diff --git a/ext/session/session.c b/ext/session/session.c
index 7dc880b86b..1fa912ddca 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -17,19 +17,19 @@
    +----------------------------------------------------------------------+
  */
 
-#ifndef PHP_WIN32
-#include <sys/time.h>
-#else
+#include "php.h"
+
+#if PHP_WIN32
 #include "win32/time.h"
+#else
+#include <sys/time.h>
 #endif
 
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#include "php.h"
 #include "php_ini.h"
 #include "SAPI.h"
-
 #include "php_session.h"
 #include "ext/standard/md5.h"
 #include "ext/standard/php_var.h"
@@ -270,7 +270,8 @@ PS_SERIALIZER_ENCODE_FUNC(wddx)
 	ENCODE_VARS;
 
 	packet = php_wddx_constructor();
-	if (!packet) return FAILURE;
+	if (!packet)
+		return FAILURE;
 
 	php_wddx_packet_start(packet, NULL);
 	php_wddx_add_chunk(packet, WDDX_STRUCT_S);
@@ -284,7 +285,8 @@ PS_SERIALIZER_ENCODE_FUNC(wddx)
 	*newstr = php_wddx_gather(packet);
 	php_wddx_destructor(packet);
 	
-	if (newlen) *newlen = strlen(*newstr);
+	if (newlen)
+		*newlen = strlen(*newstr);
 
 	return SUCCESS;
 }
@@ -299,7 +301,8 @@ PS_SERIALIZER_DECODE_FUNC(wddx)
 	int hash_type;
 	int dofree = 1;
 
-	if (vallen == 0) return FAILURE;
+	if (vallen == 0) 
+		return FAILURE;
 	
 	MAKE_STD_ZVAL(retval);
 
@@ -350,9 +353,8 @@ static char *_php_session_encode(int *newlen PSLS_DC)
 {
 	char *ret = NULL;
 
-	if (PS(serializer)->encode(&ret, newlen PSLS_CC) == FAILURE) {
+	if (PS(serializer)->encode(&ret, newlen PSLS_CC) == FAILURE)
 		ret = NULL;
-	}
 
 	return ret;
 }
@@ -404,7 +406,8 @@ static char *_php_create_id(int *newlen PSLS_DC)
 		sprintf(buf + (i << 1), "%02x", digest[i]);
 	buf[i << 1] = '\0';
 	
-	if (newlen) *newlen = i << 1;
+	if (newlen) 
+		*newlen = i << 1;
 	return estrdup(buf);
 }
 
@@ -602,12 +605,11 @@ static ps_module *_php_find_ps_module(char *name PSLS_DC)
 	ps_module **mod;
 	ps_module **end = ps_modules + (sizeof(ps_modules)/sizeof(ps_module*));
 
-	for (mod = ps_modules; mod < end; mod++) {
+	for (mod = ps_modules; mod < end; mod++)
 		if (*mod && !strcasecmp(name, (*mod)->name)) {
 			ret = *mod;
 			break;
 		}
-	}
 	
 	return ret;
 }
@@ -617,12 +619,11 @@ static const ps_serializer *_php_find_ps_serializer(char *name PSLS_DC)
 	const ps_serializer *ret = NULL;
 	const ps_serializer *mod;
 
-	for (mod = ps_serializers; mod->name; mod++) {
+	for (mod = ps_serializers; mod->name; mod++)
 		if (!strcasecmp(name, mod->name)) {
 			ret = mod;
 			break;
 		}
-	}
 
 	return ret;
 }
@@ -645,7 +646,8 @@ static void _php_session_start(PSLS_D)
 	int lensess;
 	ELS_FETCH();
 
-	if (PS(nr_open_sessions) != 0) return;
+	if (PS(nr_open_sessions) != 0) 
+		return;
 
 	lensess = strlen(PS(session_name));
 	
@@ -657,9 +659,8 @@ static void _php_session_start(PSLS_D)
 		return;
 	}
 
-	if (!track_vars && PS(use_cookies)) {
+	if (!track_vars && PS(use_cookies))
 		php_error(E_NOTICE, "Because track_vars are disabled, the session module will not be able to determine whether the user has sent a cookie. SID will always be defined.");
-	}
 	
 	/*
 	 * If our only resource is the global symbol_table, then check it.
@@ -745,18 +746,16 @@ static void _php_session_start(PSLS_D)
 		define_sid = 1;
 	}
 	
-	if (!PS(id)) {
+	if (!PS(id))
 		PS(id) = _php_create_id(NULL PSLS_CC);
-	}
 	
 	if (!PS(use_cookies) && send_cookie) {
 		define_sid = 1;
 		send_cookie = 0;
 	}
 	
-	if (send_cookie) {
+	if (send_cookie)
 		_php_session_send_cookie(PSLS_C);
-	}
 	
 	if (define_sid) {
 		char *buf;
@@ -764,9 +763,8 @@ static void _php_session_start(PSLS_D)
 		buf = emalloc(strlen(PS(session_name)) + strlen(PS(id)) + 5);
 		sprintf(buf, "%s=%s", PS(session_name), PS(id));
 		REGISTER_STRING_CONSTANT("SID", buf, 0);
-	} else {
+	} else
 		REGISTER_STRING_CONSTANT("SID", empty_string, 0);
-	}
 	PS(define_sid) = define_sid;
 
 	PS(nr_open_sessions)++;
@@ -784,8 +782,7 @@ static void _php_session_start(PSLS_D)
 
 static void _php_session_destroy(PSLS_D)
 {
-	if (PS(nr_open_sessions) == 0)
-	{
+	if (PS(nr_open_sessions) == 0) {
 		php_error(E_WARNING, "Trying to destroy uninitialized session");
 		return;
 	}
@@ -809,9 +806,8 @@ PHP_FUNCTION(session_set_cookie_params)
 		return;
 
     if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 3 ||
-		zend_get_parameters_ex(ZEND_NUM_ARGS(), &lifetime, &path, &domain) == FAILURE) {
+		zend_get_parameters_ex(ZEND_NUM_ARGS(), &lifetime, &path, &domain) == FAILURE)
 		WRONG_PARAM_COUNT;
-	}
 
 	convert_to_long_ex(lifetime);
 	PS(cookie_lifetime) = (*lifetime)->value.lval;
@@ -844,9 +840,8 @@ PHP_FUNCTION(session_name)
 
 	old = estrdup(PS(session_name));
 
-	if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) {
+	if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
 		WRONG_PARAM_COUNT;
-	}
 
 	if (ac == 1) {
 		convert_to_string_ex(p_name);
@@ -869,9 +864,8 @@ PHP_FUNCTION(session_module_name)
 
 	old = estrdup(PS(mod)->name);
 
-	if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) {
+	if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
 		WRONG_PARAM_COUNT;
-	}
 
 	if (ac == 1) {
 		ps_module *tempmod;
@@ -903,13 +897,11 @@ PHP_FUNCTION(session_set_save_handler)
 	ps_user *mdata;
 	PSLS_FETCH();
 
-	if (ARG_COUNT(ht) != 6 || zend_get_parameters_array_ex(6, args) == FAILURE) {
+	if (ARG_COUNT(ht) != 6 || zend_get_parameters_array_ex(6, args) == FAILURE)
 		WRONG_PARAM_COUNT;
-	}
 	
-	if (PS(nr_open_sessions) > 0) {
+	if (PS(nr_open_sessions) > 0)
 		RETURN_FALSE;
-	}
 	
 	PS(mod) = _php_find_ps_module("user" PSLS_CC);
 
@@ -937,9 +929,8 @@ PHP_FUNCTION(session_save_path)
 
 	old = estrdup(PS(save_path));
 
-	if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) {
+	if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
 		WRONG_PARAM_COUNT;
-	}
 
 	if (ac == 1) {
 		convert_to_string_ex(p_name);
@@ -963,9 +954,8 @@ PHP_FUNCTION(session_id)
 	if (PS(id))
 		old = estrdup(PS(id));
 
-	if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) {
+	if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
 		WRONG_PARAM_COUNT;
-	}
 
 	if (ac == 1) {
 		convert_to_string_ex(p_name);
@@ -981,21 +971,20 @@ PHP_FUNCTION(session_id)
 /* {{{ static void php_register_var(zval** entry PSLS_DC PLS_DC) */
 static void php_register_var(zval** entry PSLS_DC PLS_DC)
 {
-	zval**   value;
+	zval **value;
 	
 	if ((*entry)->type == IS_ARRAY) {
 		zend_hash_internal_pointer_reset((*entry)->value.ht);
 
-		while(zend_hash_get_current_data((*entry)->value.ht, (void**)&value) == SUCCESS) {
+		while (zend_hash_get_current_data((*entry)->value.ht, (void**)&value) == SUCCESS) {
 			php_register_var(value PSLS_CC PLS_CC);
 			zend_hash_move_forward((*entry)->value.ht);
 		}
 	} else {
 		convert_to_string_ex(entry);
 
-		if (!PG(track_vars) || strcmp((*entry)->value.str.val, "HTTP_STATE_VARS") != 0) {
+		if (!PG(track_vars) || strcmp((*entry)->value.str.val, "HTTP_STATE_VARS") != 0)
 			PS_ADD_VARL((*entry)->value.str.val, (*entry)->value.str.len);
-		}
 	}
 }
 /* }}} */
@@ -1005,15 +994,15 @@ static void php_register_var(zval** entry PSLS_DC PLS_DC)
    adds varname(s) to the list of variables which are freezed at the session end */
 PHP_FUNCTION(session_register)
 {
-	zval***  args;
+	zval  ***args;
 	int      argc = ARG_COUNT(ht);
 	int      i;
 	PSLS_FETCH();
 	PLS_FETCH();
 
-	if (argc <= 0) {
-		RETURN_FALSE;
-	} else
+	if (argc <= 0)
+		RETURN_FALSE
+	else
 		args = (zval ***)emalloc(argc * sizeof(zval **));
 	
 	if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
@@ -1021,13 +1010,12 @@ PHP_FUNCTION(session_register)
 		WRONG_PARAM_COUNT;
 	}
 
-	if (!PS(nr_open_sessions)) _php_session_start(PSLS_C);
+	if (PS(nr_open_sessions) == 0)
+		_php_session_start(PSLS_C);
 
-	for (i=0; i<argc; i++)
-	{
-		if ((*args[i])->type == IS_ARRAY) {
+	for (i = 0; i < argc; i++) {
+		if ((*args[i])->type == IS_ARRAY)
 			SEPARATE_ZVAL(args[i]);
-		}
 		php_register_var(args[i] PSLS_CC PLS_CC);
 	}	
 	
@@ -1045,9 +1033,8 @@ PHP_FUNCTION(session_unregister)
 	int ac = ARG_COUNT(ht);
 	PSLS_FETCH();
 
-	if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) {
+	if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
 		WRONG_PARAM_COUNT;
-	}
 	
 	convert_to_string_ex(p_name);
 	
@@ -1067,18 +1054,16 @@ PHP_FUNCTION(session_is_registered)
 	int ac = ARG_COUNT(ht);
 	PSLS_FETCH();
 
-	if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) {
+	if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
 		WRONG_PARAM_COUNT;
-	}
 	
 	convert_to_string_ex(p_name);
 	
-	if (zend_hash_find(&PS(vars), (*p_name)->value.str.val, (*p_name)->value.str.len+1,
-					   (void **)&p_var) == SUCCESS) {
-		RETURN_TRUE;
-	} else {
+	if (zend_hash_find(&PS(vars), (*p_name)->value.str.val, 
+				(*p_name)->value.str.len+1, (void **)&p_var) == SUCCESS)
+		RETURN_TRUE
+	else
 		RETURN_FALSE;
-	}
 }
 /* }}} */
 
@@ -1103,9 +1088,8 @@ PHP_FUNCTION(session_decode)
 	pval **str;
 	PSLS_FETCH();
 
-	if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
+	if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &str) == FAILURE)
 		WRONG_PARAM_COUNT;
-	}
 
 	convert_to_string_ex(str);
 
@@ -1165,9 +1149,8 @@ PHP_FUNCTION(session_unset)
 			zend_hash_get_current_key(&PS(vars), &variable, &num_key) == HASH_KEY_IS_STRING;
 			zend_hash_move_forward(&PS(vars))) {
 		if (zend_hash_find(&EG(symbol_table), variable, strlen(variable) + 1, (void **) &tmp)
-				== SUCCESS) {
+				== SUCCESS)
 			zend_hash_del(&EG(symbol_table), variable, strlen(variable) + 1);
-		}
 		efree(variable);
 	}
 }
@@ -1203,11 +1186,12 @@ static void php_rshutdown_session_globals(PSLS_D)
 {
 	if (PS(mod_data))
 		PS(mod)->close(&PS(mod_data));
-	if (PS(entropy_file)) efree(PS(entropy_file));
-	if (PS(extern_referer_chk)) efree(PS(extern_referer_chk));
-	if (PS(save_path)) efree(PS(save_path));
-	if (PS(session_name)) efree(PS(session_name));
-	if (PS(id)) efree(PS(id));
+	if (PS(id)) 
+		efree(PS(id));
+	efree(PS(entropy_file));
+	efree(PS(extern_referer_chk));
+	efree(PS(save_path));
+	efree(PS(session_name));
 	efree(PS(cache_limiter));
 	efree(PS(cookie_path));
 	efree(PS(cookie_domain));
@@ -1227,10 +1211,8 @@ PHP_RINIT_FUNCTION(session)
 		return SUCCESS;
 	}
 
-
-	if (INI_INT("session.auto_start")) {
+	if (INI_INT("session.auto_start"))
 		_php_session_start(PSLS_C);
-	}
 
 	return SUCCESS;
 }