Re: [PHP4BETA] cvs: /php4/ext/session session.c

From: Date: Fri, 17 Sep 1999 10:23:38 +0000
Subject: Re: [PHP4BETA] cvs: /php4/ext/session session.c
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-4569@lists.php.net to get a copy of this message
sascha, i still believe the convert_to_string_ex needs some discussion - and i really think it needs more work (see my previous post regarding strlen). i don't think we should go ahead and convert everything to that yet! regards, tc On Fri, 17 Sep 1999, Sascha Schumann wrote: > sas Fri Sep 17 05:26:03 1999 EDT > > Modified files: > /php4/ext/session session.c > Log: > Convert module to use Ex API. > > > Index: php4/ext/session/session.c > diff -u php4/ext/session/session.c:1.53 php4/ext/session/session.c:1.54 > --- php4/ext/session/session.c:1.53 Fri Sep 17 01:40:59 1999 > +++ php4/ext/session/session.c Fri Sep 17 05:26:03 1999 > @@ -553,21 +553,21 @@ > return the current session name. if newname is given, the session name is replaced with > newname */ > PHP_FUNCTION(session_name) > { > - pval *p_name; > + pval **p_name; > int ac = ARG_COUNT(ht); > char *old; > PSLS_FETCH(); > > old = estrdup(PS(session_name)); > > - if(ac < 0 || ac > 1 || getParameters(ht, ac, &p_name) == FAILURE) { > + if(ac < 0 || ac > 1 || getParametersEx(ac, &p_name) == FAILURE) { > WRONG_PARAM_COUNT; > } > > if(ac == 1) { > - convert_to_string(p_name); > + convert_to_string_ex(p_name); > efree(PS(session_name)); > - PS(session_name) = estrndup(p_name->value.str.val, p_name->value.str.len); > + PS(session_name) = estrndup((*p_name)->value.str.val, (*p_name)->value.str.len); > } > > RETVAL_STRING(old, 0); > @@ -578,22 +578,22 @@ > return the current module name used for accessing session data. if newname is given, the > module name is replaced with newname */ > PHP_FUNCTION(session_module_name) > { > - pval *p_name; > + pval **p_name; > int ac = ARG_COUNT(ht); > char *old; > PSLS_FETCH(); > > old = estrdup(PS(mod)->name); > > - if(ac < 0 || ac > 1 || getParameters(ht, ac, &p_name) == FAILURE) { > + if(ac < 0 || ac > 1 || getParametersEx(ac, &p_name) == FAILURE) { > WRONG_PARAM_COUNT; > } > > if(ac == 1) { > ps_module *tempmod; > > - convert_to_string(p_name); > - tempmod = _php_find_ps_module(p_name->value.str.val PSLS_CC); > + convert_to_string_ex(p_name); > + tempmod = _php_find_ps_module((*p_name)->value.str.val PSLS_CC); > if(tempmod) { > if(PS(mod_data)) > PS(mod)->close(&PS(mod_data)); > @@ -601,7 +601,7 @@ > } else { > efree(old); > php_error(E_ERROR, "Cannot find named PHP session module (%s)", > - p_name->value.str.val); > + (*p_name)->value.str.val); > RETURN_FALSE; > } > } > @@ -646,21 +646,21 @@ > return the current save path passed to module_name. if newname is given, the save path is > replaced with newname */ > PHP_FUNCTION(session_save_path) > { > - pval *p_name; > + pval **p_name; > int ac = ARG_COUNT(ht); > char *old; > PSLS_FETCH(); > > old = estrdup(PS(save_path)); > > - if(ac < 0 || ac > 1 || getParameters(ht, ac, &p_name) == FAILURE) { > + if(ac < 0 || ac > 1 || getParametersEx(ac, &p_name) == FAILURE) { > WRONG_PARAM_COUNT; > } > > if(ac == 1) { > - convert_to_string(p_name); > + convert_to_string_ex(p_name); > efree(PS(save_path)); > - PS(save_path) = estrndup(p_name->value.str.val, p_name->value.str.len); > + PS(save_path) = estrndup((*p_name)->value.str.val, (*p_name)->value.str.len); > } > > RETVAL_STRING(old, 0); > @@ -671,7 +671,7 @@ > return the current session id. if newid is given, the session id is replaced with newid */ > PHP_FUNCTION(session_id) > { > - pval *p_name; > + pval **p_name; > int ac = ARG_COUNT(ht); > char *old = empty_string; > PSLS_FETCH(); > @@ -679,14 +679,14 @@ > if(PS(id)) > old = estrdup(PS(id)); > > - if(ac < 0 || ac > 1 || getParameters(ht, ac, &p_name) == FAILURE) { > + if(ac < 0 || ac > 1 || getParametersEx(ac, &p_name) == FAILURE) { > WRONG_PARAM_COUNT; > } > > if(ac == 1) { > - convert_to_string(p_name); > + convert_to_string_ex(p_name); > if(PS(id)) efree(PS(id)); > - PS(id) = estrndup(p_name->value.str.val, p_name->value.str.len); > + PS(id) = estrndup((*p_name)->value.str.val, (*p_name)->value.str.len); > } > > RETVAL_STRING(old, 0); > @@ -697,18 +697,18 @@ > adds varname to the list of variables which are freezed at the session end */ > PHP_FUNCTION(session_register) > { > - pval *p_name; > + pval **p_name; > int ac = ARG_COUNT(ht); > PSLS_FETCH(); > > - if(ac != 1 || getParameters(ht, ac, &p_name) == FAILURE) { > + if(ac != 1 || getParametersEx(ac, &p_name) == FAILURE) { > WRONG_PARAM_COUNT; > } > > - convert_to_string(p_name); > + convert_to_string_ex(p_name); > > if(!PS(nr_open_sessions)) _php_session_start(PSLS_C); > - PS_ADD_VAR(p_name->value.str.val); > + PS_ADD_VAR((*p_name)->value.str.val); > } > /* }}} */ > > @@ -716,17 +716,17 @@ > removes varname from the list of variables which are freezed at the session end */ > PHP_FUNCTION(session_unregister) > { > - pval *p_name; > + pval **p_name; > int ac = ARG_COUNT(ht); > PSLS_FETCH(); > > - if(ac != 1 || getParameters(ht, ac, &p_name) == FAILURE) { > + if(ac != 1 || getParametersEx(ac, &p_name) == FAILURE) { > WRONG_PARAM_COUNT; > } > > - convert_to_string(p_name); > + convert_to_string_ex(p_name); > > - PS_DEL_VAR(p_name->value.str.val); > + PS_DEL_VAR((*p_name)->value.str.val); > } > /* }}} */ > > @@ -735,18 +735,18 @@ > checks if a variable is registered in session */ > PHP_FUNCTION(session_is_registered) > { > - pval *p_name; > + pval **p_name; > pval *p_var; > int ac = ARG_COUNT(ht); > PSLS_FETCH(); > > - if(ac != 1 || getParameters(ht, ac, &p_name) == FAILURE) { > + if(ac != 1 || getParametersEx(ac, &p_name) == FAILURE) { > WRONG_PARAM_COUNT; > } > > - convert_to_string(p_name); > + convert_to_string_ex(p_name); > > - if (zend_hash_find(&PS(vars), p_name->value.str.val, p_name->value.str.len+1, > + if (zend_hash_find(&PS(vars), (*p_name)->value.str.val, (*p_name)->value.str.len+1, > (void **)&p_var) == SUCCESS) { > RETURN_TRUE; > } else { > @@ -773,14 +773,16 @@ > deserializes data and reinitializes the variables */ > PHP_FUNCTION(session_decode) > { > - pval *str; > + pval **str; > PSLS_FETCH(); > > - if(ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) { > + if(ARG_COUNT(ht) != 1 || getParametersEx(1, &str) == FAILURE) { > WRONG_PARAM_COUNT; > } > > - _php_session_decode(str->value.str.val, str->value.str.len PSLS_CC); > + convert_to_string_ex(str); > + > + _php_session_decode((*str)->value.str.val, (*str)->value.str.len PSLS_CC); > } > /* }}} */ > > > > > -- > PHP 4 Beta > > Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!" Digital Collections Phone +49 40 235350 Fax +49 40 23535180 Hammerbrookstr. 93 20097 Hamburg / Germany

« previous php.version4 (#4569) next »