fat Tue, 19 Jul 2011 22:38:04 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=313456
Log:
- Dropped restriction of not setting the same value multiple times, the last
one holds (giovanni at giacobbi dot net)
Changed paths:
U php/php-src/branches/PHP_5_4/NEWS
U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c
U php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c
Modified: php/php-src/branches/PHP_5_4/NEWS
===================================================================
--- php/php-src/branches/PHP_5_4/NEWS 2011-07-19 22:29:55 UTC (rev 313455)
+++ php/php-src/branches/PHP_5_4/NEWS 2011-07-19 22:38:04 UTC (rev 313456)
@@ -4,6 +4,8 @@
- Improved PHP-FPM SAPI:
. Added process.max to control the number of process FPM can fork. FR #55166.
(fat)
+ . Dropped restriction of not setting the same value multiple times, the last
+ one holds. (giovanni at giacobbi dot net, fat)
14 Jul 2011, PHP 5.4.0 Alpha 2
- General improvements:
Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c 2011-07-19
22:29:55 UTC (rev 313455)
+++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c 2011-07-19
22:38:04 UTC (rev 313456)
@@ -195,21 +195,25 @@
static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset)
/* {{{ */
{
- char *new;
- char **old = (char **) ((char *) *config + offset);
- if (*old) {
- return "it's already been defined. Can't do that twice.";
+ char **config_val = (char **) ((char *) *config + offset);
+
+ if (!config_val) {
+ return "internal error: NULL value";
}
- new = strdup(Z_STRVAL_P(value));
- if (!new) {
+ /* Check if there is a previous value to deallocate */
+ if (*config_val) {
+ free(*config_val);
+ }
+
+ *config_val = strdup(Z_STRVAL_P(value));
+ if (!*config_val) {
return "fpm_conf_set_string(): strdup() failed";
}
- if (fpm_conf_expand_pool_name(&new) == -1) {
+ if (fpm_conf_expand_pool_name(config_val) == -1) {
return "Can't use '$pool' when the pool is not defined";
}
- *old = new;
return NULL;
}
/* }}} */
@@ -219,8 +223,9 @@
char *val = Z_STRVAL_P(value);
char *p;
+ /* we don't use strtol because we don't want to allow negative values */
for (p = val; *p; p++) {
- if ( p == val && *p == '-' ) continue;
+ if (p == val && *p == '-') continue;
if (*p < '0' || *p > '9') {
return "is not a valid number (greater or equal than
zero)";
}
Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-07-19 22:29:55 UTC (rev
313455)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-07-19 22:38:04 UTC (rev
313456)
@@ -195,21 +195,25 @@
static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset)
/* {{{ */
{
- char *new;
- char **old = (char **) ((char *) *config + offset);
- if (*old) {
- return "it's already been defined. Can't do that twice.";
+ char **config_val = (char **) ((char *) *config + offset);
+
+ if (!config_val) {
+ return "internal error: NULL value";
}
- new = strdup(Z_STRVAL_P(value));
- if (!new) {
+ /* Check if there is a previous value to deallocate */
+ if (*config_val) {
+ free(*config_val);
+ }
+
+ *config_val = strdup(Z_STRVAL_P(value));
+ if (!*config_val) {
return "fpm_conf_set_string(): strdup() failed";
}
- if (fpm_conf_expand_pool_name(&new) == -1) {
+ if (fpm_conf_expand_pool_name(config_val) == -1) {
return "Can't use '$pool' when the pool is not defined";
}
- *old = new;
return NULL;
}
/* }}} */
@@ -219,8 +223,9 @@
char *val = Z_STRVAL_P(value);
char *p;
+ /* we don't use strtol because we don't want to allow negative values */
for (p = val; *p; p++) {
- if ( p == val && *p == '-' ) continue;
+ if (p == val && *p == '-') continue;
if (*p < '0' || *p > '9') {
return "is not a valid number (greater or equal than
zero)";
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php