diff options
author | Jani Taskinen <jani@php.net> | 2007-09-27 15:53:28 +0000 |
---|---|---|
committer | Jani Taskinen <jani@php.net> | 2007-09-27 15:53:28 +0000 |
commit | c1a4cc358cc7cdd420e74a7a905ce2a251fc0e18 (patch) | |
tree | d4e80dd57ffc9a11603ac8561269353ac8208d6e /Zend/zend_ini.c | |
parent | bea9591f4777eaf6e3b31eeadb60334c3b6d2a96 (diff) | |
download | php-git-c1a4cc358cc7cdd420e74a7a905ce2a251fc0e18.tar.gz |
MFH: ws + cs (more to follow)
Diffstat (limited to 'Zend/zend_ini.c')
-rw-r--r-- | Zend/zend_ini.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index ab726c8d59..05e60bd9a7 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -26,7 +26,7 @@ #include "zend_operators.h" #include "zend_strtod.h" -static HashTable *registered_zend_ini_directives; +static HashTable *registered_zend_ini_directives; #define NO_VALUE_PLAINTEXT "no value" #define NO_VALUE_HTML "<i>no value</i>" @@ -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(); } @@ -84,7 +84,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; @@ -126,7 +126,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)); @@ -139,15 +139,15 @@ static int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ { Bucket *f; Bucket *s; - + 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 */ return zend_binary_strcasecmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength); @@ -189,13 +189,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 ((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, default_value.value.str.val, default_value.value.str.len, 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, default_value.value.str.val, default_value.value.str.len, 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 = default_value.value.str.val; hashed_ini_entry->value_length = default_value.value.str.len; config_directive_success = 1; @@ -247,7 +247,7 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val zend_bool modified; 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; } @@ -277,7 +277,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 (modified && ini_entry->orig_value != ini_entry->value) { /* we already changed the value, free the changed value */ efree(ini_entry->value); } @@ -296,8 +296,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; } @@ -305,7 +305,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; } /* }}} */ @@ -314,7 +314,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; } @@ -332,7 +332,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) { @@ -349,7 +349,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) { @@ -366,7 +366,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 { @@ -378,7 +378,7 @@ ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) /* {{{ */ } /* }}} */ -#if TONY_20070307 +#if TONY_20070307 static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */ { if (ini_entry->displayer) { @@ -398,7 +398,7 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */ } else { display_string = NO_VALUE_PLAINTEXT; display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1; - } + } } } else if (ini_entry->value && ini_entry->value[0]) { display_string = ini_entry->value; @@ -410,7 +410,7 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */ } else { display_string = NO_VALUE_PLAINTEXT; display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1; - } + } } ZEND_WRITE(display_string, display_string_length); } @@ -423,7 +423,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) { @@ -445,7 +445,7 @@ ZEND_INI_DISP(zend_ini_boolean_displayer_cb) /* {{{ */ } else { value = 0; } - + if (value) { ZEND_PUTS("On"); } else { @@ -458,7 +458,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; @@ -470,13 +470,13 @@ ZEND_INI_DISP(zend_ini_color_displayer_cb) /* {{{ */ zend_printf("<font style=\"color: %s\">%s</font>", value, value); } else { ZEND_PUTS(value); - } + } } else { if (zend_uv.html_errors) { ZEND_PUTS(NO_VALUE_HTML); } else { ZEND_PUTS(NO_VALUE_PLAINTEXT); - } + } } } /* }}} */ @@ -485,7 +485,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; @@ -494,7 +494,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); @@ -517,15 +517,15 @@ 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 { *p = (zend_bool) atoi(new_value); } |