ws + cs (more to follow)

This commit is contained in:
Jani Taskinen 2007-09-27 15:52:56 +00:00
parent 9bb7a2fcc7
commit b117c94942

View File

@ -51,7 +51,7 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS
zend_try {
/* even if on_modify bails out, we have to continue on with restoring,
since there can be allocated variables that would be freed on MM shutdown
and would lead to memory corruption later ini entry is modified again */
and would lead to memory corruption later ini entry is modified again */
ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC);
} zend_end_try();
}
@ -82,7 +82,7 @@ ZEND_API int zend_ini_startup(TSRMLS_D) /* {{{ */
EG(ini_directives) = registered_zend_ini_directives;
EG(modified_ini_directives) = NULL;
if (zend_hash_init_ex(registered_zend_ini_directives, 100, NULL, NULL, 1, 0)==FAILURE) {
if (zend_hash_init_ex(registered_zend_ini_directives, 100, NULL, NULL, 1, 0) == FAILURE) {
return FAILURE;
}
return SUCCESS;
@ -124,7 +124,7 @@ ZEND_API int zend_copy_ini_directives(TSRMLS_D) /* {{{ */
EG(modified_ini_directives) = NULL;
EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable));
if (zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0)==FAILURE) {
if (zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0) == FAILURE) {
return FAILURE;
}
zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, NULL, &ini_entry, sizeof(zend_ini_entry));
@ -141,14 +141,14 @@ static int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */
f = *((Bucket **) a);
s = *((Bucket **) b);
if (f->nKeyLength==0 && s->nKeyLength==0) { /* both numeric */
if (f->nKeyLength == 0 && s->nKeyLength == 0) { /* both numeric */
return ZEND_NORMALIZE_BOOL(f->nKeyLength - s->nKeyLength);
} else if (f->nKeyLength==0) { /* f is numeric, s is not */
} else if (f->nKeyLength == 0) { /* f is numeric, s is not */
return -1;
} else if (s->nKeyLength==0) { /* s is numeric, f is not */
} else if (s->nKeyLength == 0) { /* s is numeric, f is not */
return 1;
} else { /* both strings */
/*FIXME: unicode hash*/
/* FIXME: unicode hash */
return zend_binary_strcasecmp(f->key.arKey.s, f->nKeyLength, s->key.arKey.s, s->nKeyLength);
}
}
@ -188,13 +188,13 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
while (p->name) {
p->module_number = module_number;
config_directive_success = 0;
if (zend_hash_add(directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
if (zend_hash_add(directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry) == FAILURE) {
zend_unregister_ini_entries(module_number TSRMLS_CC);
return FAILURE;
}
if ((zend_get_configuration_directive(p->name, p->name_length, &default_value))==SUCCESS) {
if (!hashed_ini_entry->on_modify
|| hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRLEN(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC)==SUCCESS) {
|| hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRLEN(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS) {
hashed_ini_entry->value = Z_STRVAL(default_value);
hashed_ini_entry->value_length = Z_STRLEN(default_value);
config_directive_success = 1;
@ -245,7 +245,7 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val
char *duplicate;
TSRMLS_FETCH();
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) {
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == FAILURE) {
return FAILURE;
}
@ -262,7 +262,7 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val
duplicate = estrndup(new_value, new_value_length);
if (!ini_entry->on_modify
|| ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC)==SUCCESS) {
|| ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC) == SUCCESS) {
if (!ini_entry->modified) {
ini_entry->orig_value = ini_entry->value;
ini_entry->orig_value_length = ini_entry->value_length;
@ -271,7 +271,7 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val
ALLOC_HASHTABLE(EG(modified_ini_directives));
zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0);
}
zend_hash_add(EG(modified_ini_directives), name, name_length, &ini_entry, sizeof(zend_ini_entry*), NULL);
zend_hash_add(EG(modified_ini_directives), name, name_length, &ini_entry, sizeof(zend_ini_entry *), NULL);
} else { /* we already changed the value, free the changed value */
efree(ini_entry->value);
}
@ -290,8 +290,8 @@ ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) /*
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE ||
(stage == ZEND_INI_STAGE_RUNTIME && (ini_entry->modifiable & ZEND_INI_USER) == 0)) {
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == FAILURE ||
(stage == ZEND_INI_STAGE_RUNTIME && (ini_entry->modifiable & ZEND_INI_USER) == 0)) {
return FAILURE;
}
@ -299,7 +299,7 @@ ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) /*
zend_restore_ini_entry_cb(ini_entry, stage TSRMLS_CC);
zend_hash_del(EG(modified_ini_directives), name, name_length);
}
return SUCCESS;
}
/* }}} */
@ -308,7 +308,7 @@ ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*di
{
zend_ini_entry *ini_entry;
if (zend_hash_find(registered_zend_ini_directives, name, name_length, (void **) &ini_entry)==FAILURE) {
if (zend_hash_find(registered_zend_ini_directives, name, name_length, (void **) &ini_entry) == FAILURE) {
return FAILURE;
}
@ -325,7 +325,7 @@ ZEND_API long zend_ini_long(char *name, uint name_length, int orig) /* {{{ */
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == SUCCESS) {
if (orig && ini_entry->modified) {
return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0);
} else if (ini_entry->value) {
@ -342,7 +342,7 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ *
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == SUCCESS) {
if (orig && ini_entry->modified) {
return (double) (ini_entry->orig_value ? zend_strtod(ini_entry->orig_value, NULL) : 0.0);
} else if (ini_entry->value) {
@ -359,7 +359,7 @@ ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) /* {{{ */
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == SUCCESS) {
if (orig && ini_entry->modified) {
return ini_entry->orig_value;
} else {
@ -380,17 +380,17 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */
char *display_string;
uint display_string_length;
if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
if (ini_entry->orig_value) {
display_string = ini_entry->orig_value;
display_string_length = ini_entry->orig_value_length;
} else {
if (zend_uv.html_errors) {
display_string = NO_VALUE_HTML;
display_string_length = sizeof(NO_VALUE_HTML)-1;
display_string_length = sizeof(NO_VALUE_HTML) - 1;
} else {
display_string = NO_VALUE_PLAINTEXT;
display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1;
display_string_length = sizeof(NO_VALUE_PLAINTEXT) - 1;
}
}
} else if (ini_entry->value && ini_entry->value[0]) {
@ -399,10 +399,10 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */
} else {
if (zend_uv.html_errors) {
display_string = NO_VALUE_HTML;
display_string_length = sizeof(NO_VALUE_HTML)-1;
display_string_length = sizeof(NO_VALUE_HTML) - 1;
} else {
display_string = NO_VALUE_PLAINTEXT;
display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1;
display_string_length = sizeof(NO_VALUE_PLAINTEXT) - 1;
}
}
ZEND_WRITE(display_string, display_string_length);
@ -416,7 +416,7 @@ ZEND_INI_DISP(zend_ini_boolean_displayer_cb) /* {{{ */
int value, tmp_value_len;
char *tmp_value;
if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL );
tmp_value_len = ini_entry->orig_value_length;
} else if (ini_entry->value) {
@ -451,7 +451,7 @@ ZEND_INI_DISP(zend_ini_color_displayer_cb) /* {{{ */
{
char *value;
if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
value = ini_entry->orig_value;
} else if (ini_entry->value) {
value = ini_entry->value;
@ -478,7 +478,7 @@ ZEND_INI_DISP(display_link_numbers) /* {{{ */
{
char *value;
if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
value = ini_entry->orig_value;
} else if (ini_entry->value) {
value = ini_entry->value;
@ -487,7 +487,7 @@ ZEND_INI_DISP(display_link_numbers) /* {{{ */
}
if (value) {
if (atoi(value)==-1) {
if (atoi(value) == -1) {
ZEND_PUTS("Unlimited");
} else {
zend_printf("%s", value);
@ -510,13 +510,13 @@ ZEND_API ZEND_INI_MH(OnUpdateBool) /* {{{ */
p = (zend_bool *) (base+(size_t) mh_arg1);
if (new_value_length==2 && strcasecmp("on", new_value)==0) {
if (new_value_length == 2 && strcasecmp("on", new_value) == 0) {
*p = (zend_bool) 1;
}
else if (new_value_length==3 && strcasecmp("yes", new_value)==0) {
else if (new_value_length == 3 && strcasecmp("yes", new_value) == 0) {
*p = (zend_bool) 1;
}
else if (new_value_length==4 && strcasecmp("true", new_value)==0) {
else if (new_value_length == 4 && strcasecmp("true", new_value) == 0) {
*p = (zend_bool) 1;
}
else {