From: Xinchen Hui Date: Mon, 25 Feb 2013 07:29:54 +0000 (+0800) Subject: coding style improve X-Git-Tag: php-5.5.0beta1~42^2~36^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3da5b830c2233da590ae2ccd0ab4d82e37009c7c;p=php coding style improve --- diff --git a/Optimizer/block_pass.c b/Optimizer/block_pass.c index acd149eeef..77af8d70cb 100644 --- a/Optimizer/block_pass.c +++ b/Optimizer/block_pass.c @@ -42,7 +42,7 @@ static int zend_get_persistent_constant(char *name, uint name_len, zval *result, static inline void print_block(zend_code_block *block, zend_op *opcodes, char *txt) { - fprintf(stderr, "%sBlock: %d-%d (%d)", txt, block->start_opline - opcodes, block->start_opline - opcodes+block->len-1, block->len); + fprintf(stderr, "%sBlock: %d-%d (%d)", txt, block->start_opline - opcodes, block->start_opline - opcodes + block->len - 1, block->len); if (!block->access) { fprintf(stderr, " unused"); } @@ -229,7 +229,7 @@ static zend_code_block *find_code_blocks(zend_op_array *op_array) } } cur_block->len = end - cur_block->start_opline; - cur_block->next = &blocks[op_array->last+1]; + cur_block->next = &blocks[op_array->last + 1]; print_block(cur_block, op_array->opcodes, ""); /* The op_array doesn't have BRK, CONT, GOTO opcodes anyway */ @@ -787,7 +787,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, memcpy(tmp, Z_STRVAL(ZEND_OP1_LITERAL(last_op)), l + 1); Z_STRVAL(ZEND_OP1_LITERAL(last_op)) = tmp; } else { - Z_STRVAL(ZEND_OP1_LITERAL(last_op)) = erealloc(Z_STRVAL(ZEND_OP1_LITERAL(last_op)), l+1); + Z_STRVAL(ZEND_OP1_LITERAL(last_op)) = erealloc(Z_STRVAL(ZEND_OP1_LITERAL(last_op)), l + 1); } memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op))+Z_STRLEN(ZEND_OP1_LITERAL(last_op)), Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline))); Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0'; @@ -1058,7 +1058,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, /* strip the inside NOPs */ opline = block->start_opline; - end = opline+block->len; + end = opline + block->len; while (opline < end) { if (opline->opcode == ZEND_NOP) { zend_op *nop = opline + 1; @@ -1087,17 +1087,17 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, /* Rebuild plain (optimized) op_array from CFG */ static void assemble_code_blocks(zend_code_block *blocks, zend_op_array *op_array) { - zend_op *new_opcodes = emalloc(op_array->last*sizeof(zend_op)); + zend_op *new_opcodes = emalloc(op_array->last * sizeof(zend_op)); zend_op *opline = new_opcodes; zend_code_block *cur_block = blocks; /* Copy code of reachable blocks into a single buffer */ while (cur_block) { if (cur_block->access) { - memcpy(opline, cur_block->start_opline, cur_block->len*sizeof(zend_op)); + memcpy(opline, cur_block->start_opline, cur_block->len * sizeof(zend_op)); cur_block->start_opline = opline; opline += cur_block->len; - if ((opline-1)->opcode == ZEND_JMP) { + if ((opline - 1)->opcode == ZEND_JMP) { zend_code_block *next; next = cur_block->next; while (next && !next->access) { @@ -1107,7 +1107,7 @@ static void assemble_code_blocks(zend_code_block *blocks, zend_op_array *op_arra /* JMP to the next block - strip it */ cur_block->follow_to = cur_block->op1_to; cur_block->op1_to = NULL; - MAKE_NOP((opline-1)); + MAKE_NOP((opline - 1)); opline--; cur_block->len--; } @@ -1115,7 +1115,7 @@ static void assemble_code_blocks(zend_code_block *blocks, zend_op_array *op_arra } else { /* this block will not be used, delete all constants there */ zend_op *_opl; - zend_op *end = cur_block->start_opline+cur_block->len; + zend_op *end = cur_block->start_opline + cur_block->len; for (_opl = cur_block->start_opline; _opl && _opl < end; _opl++) { if (ZEND_OP1_TYPE(_opl) == IS_CONST) { literal_dtor(&ZEND_OP1_LITERAL(_opl)); @@ -1160,18 +1160,18 @@ static void assemble_code_blocks(zend_code_block *blocks, zend_op_array *op_arra continue; } if (cur_block->op1_to) { - ZEND_OP1(&cur_block->start_opline[cur_block->len-1]).opline_num = cur_block->op1_to->start_opline - new_opcodes; + ZEND_OP1(&cur_block->start_opline[cur_block->len - 1]).opline_num = cur_block->op1_to->start_opline - new_opcodes; } if (cur_block->op2_to) { - ZEND_OP2(&cur_block->start_opline[cur_block->len-1]).opline_num = cur_block->op2_to->start_opline - new_opcodes; + ZEND_OP2(&cur_block->start_opline[cur_block->len - 1]).opline_num = cur_block->op2_to->start_opline - new_opcodes; } if (cur_block->ext_to) { - cur_block->start_opline[cur_block->len-1].extended_value = cur_block->ext_to->start_opline - new_opcodes; + cur_block->start_opline[cur_block->len - 1].extended_value = cur_block->ext_to->start_opline - new_opcodes; } print_block(cur_block, new_opcodes, "Out "); } efree(op_array->opcodes); - op_array->opcodes = erealloc(new_opcodes, op_array->last*sizeof(zend_op)); + op_array->opcodes = erealloc(new_opcodes, op_array->last * sizeof(zend_op)); #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO /* adjust early binding list */ @@ -1738,7 +1738,7 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char * while (next_block) { zend_op *opline = next_block->start_opline; - zend_op *end = opline+next_block->len; + zend_op *end = opline + next_block->len; if (!next_block->access) { next_block = next_block->next; @@ -1768,14 +1768,14 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char * #if DEBUG_BLOCKPASS { int i; - for (i=0; i< op_array->T; i++) { + for (i = 0; i< op_array->T; i++) { fprintf(stderr, "T%d: %c\n", i, used_ext[i] + '0'); } } #endif while (block) { - zend_op *opline = block->start_opline+block->len - 1; + zend_op *opline = block->start_opline + block->len - 1; if (!block->access) { block = block->next; diff --git a/Optimizer/nop_removal.c b/Optimizer/nop_removal.c index ccac6f4540..b2fb667ed5 100644 --- a/Optimizer/nop_removal.c +++ b/Optimizer/nop_removal.c @@ -12,7 +12,7 @@ static void nop_removal(zend_op_array *op_array) shiftlist = (zend_uint *)DO_ALLOCA(sizeof(zend_uint) * op_array->last); i = new_count = shift = 0; - end = op_array->opcodes+op_array->last; + end = op_array->opcodes + op_array->last; for (opline = op_array->opcodes; opline < end; opline++) { #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO diff --git a/Optimizer/optimize_temp_vars_5.c b/Optimizer/optimize_temp_vars_5.c index 7cf43bf11e..976a7b21ac 100644 --- a/Optimizer/optimize_temp_vars_5.c +++ b/Optimizer/optimize_temp_vars_5.c @@ -84,12 +84,12 @@ static void optimize_temporary_variables(zend_op_array *op_array) int var_to_free = -1; taken_T = (char *) emalloc(T); - start_of_T = (zend_op **) emalloc(T*sizeof(zend_op *)); + start_of_T = (zend_op **) emalloc(T * sizeof(zend_op *)); valid_T = (char *) emalloc(T); - map_T = (int *) emalloc(T*sizeof(int)); + map_T = (int *) emalloc(T * sizeof(int)); end = op_array->opcodes; - opline = &op_array->opcodes[op_array->last-1]; + opline = &op_array->opcodes[op_array->last - 1]; /* Find T definition points */ while (opline >= end) { @@ -111,7 +111,7 @@ static void optimize_temporary_variables(zend_op_array *op_array) memset(taken_T, 0, T); end = op_array->opcodes; - opline = &op_array->opcodes[op_array->last-1]; + opline = &op_array->opcodes[op_array->last - 1]; while (opline >= end) { if ((ZEND_OP1_TYPE(opline) & (IS_VAR | IS_TMP_VAR)) @@ -166,14 +166,14 @@ static void optimize_temporary_variables(zend_op_array *op_array) /* Allocate OP_DATA->op2 after "opernds", but before "result" */ if (opline->opcode == ZEND_ASSIGN_DIM && - (opline+1)->opcode == ZEND_OP_DATA && - ZEND_OP2_TYPE(opline+1) & (IS_VAR | IS_TMP_VAR)) { - currT = VAR_NUM(ZEND_OP2(opline+1).var); + (opline + 1)->opcode == ZEND_OP_DATA && + ZEND_OP2_TYPE(opline + 1) & (IS_VAR | IS_TMP_VAR)) { + currT = VAR_NUM(ZEND_OP2(opline + 1).var); GET_AVAILABLE_T(); map_T[currT] = i; valid_T[currT] = 1; taken_T[i] = 0; - ZEND_OP2(opline+1).var = NUM_VAR(i); + ZEND_OP2(opline + 1).var = NUM_VAR(i); var_to_free = i; } diff --git a/Optimizer/pass1_5.c b/Optimizer/pass1_5.c index a2287ea3f9..7a69689fa7 100644 --- a/Optimizer/pass1_5.c +++ b/Optimizer/pass1_5.c @@ -274,8 +274,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { break; } last_op = next_op; - final_length += (requires_conversion ? 1 : ZEND_OP2_LITERAL(opline).value.str.len); - ptr = (char *)emalloc(final_length+1); + final_length += (requires_conversion? 1 : ZEND_OP2_LITERAL(opline).value.str.len); + ptr = (char *)emalloc(final_length + 1); ptr[final_length] = '\0'; if (requires_conversion) { /* ZEND_ADD_CHAR */ char chval = (char)ZEND_OP2_LITERAL(opline).value.lval; @@ -321,8 +321,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (ZEND_OP1_TYPE(opline) == IS_UNUSED && ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING && - Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__")-1 && - memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1) == 0) { + Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 && + memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1) == 0) { /* substitute __COMPILER_HALT_OFFSET__ constant */ zend_bool orig_in_execution = EG(in_execution); zend_op_array *orig_op_array = EG(active_op_array); @@ -330,7 +330,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { EG(in_execution) = 1; EG(active_op_array) = op_array; - if (zend_get_constant("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1, &offset TSRMLS_CC)) { + if (zend_get_constant("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1, &offset TSRMLS_CC)) { literal_dtor(&ZEND_OP2_LITERAL(opline)); ZEND_OP1_TYPE(opline) = IS_CONST; #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO diff --git a/Optimizer/pass3.c b/Optimizer/pass3.c index 269f523e98..fd2a190009 100644 --- a/Optimizer/pass3.c +++ b/Optimizer/pass3.c @@ -26,7 +26,7 @@ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) { zend_op *opline; - zend_op *end = op_array->opcodes+op_array->last; + zend_op *end = op_array->opcodes + op_array->last; zend_uint *jmp_hitlist; int jmp_hitlist_count; int i; @@ -204,7 +204,7 @@ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) { /* JMPZ(X,L1), L1: JMPZ(X,L2) => JMPZ(X,L2), L1: JMPZ(X,L2) */ CHECK_JMP2(target, done_jmp_optimization); ZEND_OP2(opline).opline_num = ZEND_OP2(&op_array->opcodes[target]).opline_num; - } else if (op_array->opcodes[target].opcode == opline->opcode+3 && + } else if (op_array->opcodes[target].opcode == opline->opcode + 3 && SAME_VAR(opline->op1, op_array->opcodes[target].op1)) { /* convert JMPZ(X,L1), L1: T JMPZ_EX(X,L2) to T = JMPZ_EX(X, L2) */ @@ -215,13 +215,13 @@ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) { SAME_VAR(opline->op1, op_array->opcodes[target].op1)) { /* convert JMPZ(X,L1), L1: JMPNZ(X,L2) to JMPZ(X,L1+1) */ - ZEND_OP2(opline).opline_num = target+1; + ZEND_OP2(opline).opline_num = target + 1; break; } else if (op_array->opcodes[target].opcode == INV_COND_EX(opline->opcode) && SAME_VAR(opline->op1, op_array->opcodes[target].op1)) { /* convert JMPZ(X,L1), L1: T = JMPNZ_EX(X,L2) to T = JMPZ_EX(X,L1+1) */ - ZEND_OP2(opline).opline_num = target+1; + ZEND_OP2(opline).opline_num = target + 1; opline->opcode += 3; COPY_NODE(opline->result, op_array->opcodes[target].result); break; @@ -284,7 +284,7 @@ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) { SAME_VAR(opline->op1, op_array->opcodes[target].op1)) { /* convert JMPZ_EX(X,L1), L1: JMPNZ_EX(X,L2) to JMPZ_EX(X,L1+1) */ - ZEND_OP2(opline).opline_num = target+1; + ZEND_OP2(opline).opline_num = target + 1; break; } else { break; diff --git a/ZendAccelerator.c b/ZendAccelerator.c index eb540eddeb..7f1c8f84b2 100644 --- a/ZendAccelerator.c +++ b/ZendAccelerator.c @@ -682,8 +682,9 @@ static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_ha if (GetFileAttributesEx(file_handle->opened_path, GetFileExInfoStandard, &fdata) != 0) { unsigned __int64 ftime; - if (CompareFileTime (&fdata.ftLastWriteTime, &utc_base_ft) < 0) + if (CompareFileTime (&fdata.ftLastWriteTime, &utc_base_ft) < 0) { return 0; + } ftime = (((unsigned __int64)fdata.ftLastWriteTime.dwHighDateTime) << 32) + fdata.ftLastWriteTime.dwLowDateTime - utc_base; ftime /= 10000000L; @@ -943,7 +944,7 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt } /* Calculate key length */ - key_length = cwd_len + path_length+include_path_len + 2; + key_length = cwd_len + path_length + include_path_len + 2; if (parent_script_len) { key_length += parent_script_len + 1; } diff --git a/ZendAccelerator.h b/ZendAccelerator.h index 230ee86544..83e7cd185e 100644 --- a/ZendAccelerator.h +++ b/ZendAccelerator.h @@ -143,16 +143,16 @@ extern int lock_file; #if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO # ifdef ALLOCA_FLAG - #define DO_ALLOCA(x) do_alloca_with_limit(x,use_heap) - #define FREE_ALLOCA(x) free_alloca_with_limit(x,use_heap) + #define DO_ALLOCA(x) do_alloca_with_limit(x, use_heap) + #define FREE_ALLOCA(x) free_alloca_with_limit(x, use_heap) # else #define ALLOCA_FLAG(x) #define DO_ALLOCA(x) do_alloca(x) #define FREE_ALLOCA(x) free_alloca(x) # endif #else - #define DO_ALLOCA(x) do_alloca(x,use_heap) - #define FREE_ALLOCA(x) free_alloca(x,use_heap) + #define DO_ALLOCA(x) do_alloca(x, use_heap) + #define FREE_ALLOCA(x) free_alloca(x, use_heap) #endif diff --git a/shared_alloc_win32.c b/shared_alloc_win32.c index 40f941d1c0..819ef5cc3c 100644 --- a/shared_alloc_win32.c +++ b/shared_alloc_win32.c @@ -76,26 +76,26 @@ static void zend_win_error_message(int type, char *msg, int err) static char *create_name_with_username(char *name) { - static char newname[MAXPATHLEN+UNLEN+4]; - char uname[UNLEN+1]; + static char newname[MAXPATHLEN + UNLEN + 4]; + char uname[UNLEN + 1]; DWORD unsize = UNLEN; GetUserName(uname, &unsize); - snprintf(newname, sizeof(newname)-1, "%s@%s", name, uname); + snprintf(newname, sizeof(newname) - 1, "%s@%s", name, uname); return newname; } static char *get_mmap_base_file() { - static char windir[MAXPATHLEN+UNLEN+3+sizeof("\\\\@")]; - char uname[UNLEN+1]; + static char windir[MAXPATHLEN+UNLEN + 3 + sizeof("\\\\@")]; + char uname[UNLEN + 1]; DWORD unsize = UNLEN; int l; GetTempPath(MAXPATHLEN, windir); GetUserName(uname, &unsize); l = strlen(windir); - snprintf(windir+l, sizeof(windir)-l-1, "\\%s@%s", ACCEL_FILEMAP_BASE, uname); + snprintf(windir + l, sizeof(windir) - l - 1, "\\%s@%s", ACCEL_FILEMAP_BASE, uname); return windir; } @@ -187,8 +187,9 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_ do { memfile = OpenFileMapping(FILE_MAP_WRITE, 0, create_name_with_username(ACCEL_FILEMAP_NAME)); err = GetLastError(); - if (memfile == NULL) + if (memfile == NULL) { break; + } ret = zend_shared_alloc_reattach(requested_size, error_in); err = GetLastError(); @@ -196,7 +197,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_ /* Mapping failed, wait for mapping object to get freed and retry */ CloseHandle(memfile); memfile = NULL; - Sleep(1000*(map_retries+1)); + Sleep(1000 * (map_retries + 1)); } else { return ret; } @@ -242,9 +243,10 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if (! GetVersionEx ((OSVERSIONINFO *) &osvi)) { - osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + if (!GetVersionEx((OSVERSIONINFO *)&osvi)) { break; + } } GetSystemInfo(&si); @@ -252,8 +254,9 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_ /* Are we running Vista ? */ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion == 6) { /* Assert that platform is 32 bit (for 64 bit we need to test a different set */ - if (si.wProcessorArchitecture != PROCESSOR_ARCHITECTURE_INTEL) + if (si.wProcessorArchitecture != PROCESSOR_ARCHITECTURE_INTEL) { DebugBreak(); + } wanted_mapping_base = vista_mapping_base_set; } @@ -262,7 +265,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_ char *s = ZCG(accel_directives).mmap_base; /* skip leading 0x, %p assumes hexdeciaml format anyway */ - if (*s == '0' && *(s+1) == 'x') { + if (*s == '0' && *(s + 1) == 'x') { s += 2; } if (sscanf(s, "%p", &default_mapping_base_set[0]) != 1) { @@ -273,8 +276,9 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_ do { shared_segment->p = mapping_base = MapViewOfFileEx(memfile, FILE_MAP_ALL_ACCESS, 0, 0, 0, *wanted_mapping_base); - if (*wanted_mapping_base == NULL) /* Auto address (NULL) is the last option on the array */ + if (*wanted_mapping_base == NULL) { /* Auto address (NULL) is the last option on the array */ break; + } wanted_mapping_base++; } while (!mapping_base); diff --git a/zend_accelerator_blacklist.c b/zend_accelerator_blacklist.c index f3fd91236e..5191fdb020 100644 --- a/zend_accelerator_blacklist.c +++ b/zend_accelerator_blacklist.c @@ -98,7 +98,7 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist) regexp[1] = '('; clen = 2; - for (j = end; j <= i ;j++) { + for (j = end; j <= i; j++) { int c; if (j != end) { diff --git a/zend_accelerator_module.c b/zend_accelerator_module.c index 58fc48d030..04133f64b6 100644 --- a/zend_accelerator_module.c +++ b/zend_accelerator_module.c @@ -66,7 +66,7 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption) /* keep the compiler happy */ (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage; - p = (long *) (base+(size_t) mh_arg1); + p = (long *) (base + (size_t)mh_arg1); memsize = atoi(new_value); /* sanity check we must use at least 8 MB */ if (memsize < 8) { @@ -74,8 +74,8 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption) zend_ini_entry *ini_entry; memsize = 8; - zend_accel_error(ACCEL_LOG_WARNING, "zend_optimizerplus.memory_consumption is set below the required 8MB.\n" ); - zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use the minimal 8MB cofiguration.\n" ); + zend_accel_error(ACCEL_LOG_WARNING, "zend_optimizerplus.memory_consumption is set below the required 8MB.\n"); + zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use the minimal 8MB cofiguration.\n"); if (zend_hash_find(EG(ini_directives), "zend_optimizerplus.memory_consumption", @@ -104,7 +104,7 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles) /* keep the compiler happy */ (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage; - p = (long *) (base+(size_t) mh_arg1); + p = (long *) (base + (size_t)mh_arg1); size = atoi(new_value); /* sanity check we must use a value between MIN_ACCEL_FILES and MAX_ACCEL_FILES */ @@ -115,14 +115,14 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles) if (size < MIN_ACCEL_FILES) { size = MIN_ACCEL_FILES; new_new_value = TOKENTOSTR(MIN_ACCEL_FILES); - zend_accel_error(ACCEL_LOG_WARNING, "zend_optimizerplus.max_accelerated_files is set below the required minimum (%d).\n", MIN_ACCEL_FILES ); - zend_accel_error(ACCEL_LOG_WARNING,ACCELERATOR_PRODUCT_NAME " will use the minimal cofiguration.\n" ); + zend_accel_error(ACCEL_LOG_WARNING, "zend_optimizerplus.max_accelerated_files is set below the required minimum (%d).\n", MIN_ACCEL_FILES); + zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use the minimal cofiguration.\n"); } if (size > MAX_ACCEL_FILES) { size = MAX_ACCEL_FILES; new_new_value = TOKENTOSTR(MAX_ACCEL_FILES); - zend_accel_error(ACCEL_LOG_WARNING, "zend_optimizerplus.max_accelerated_files is set above the limit (%d).\n", MAX_ACCEL_FILES ); - zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use the maximal cofiguration.\n" ); + zend_accel_error(ACCEL_LOG_WARNING, "zend_optimizerplus.max_accelerated_files is set above the limit (%d).\n", MAX_ACCEL_FILES); + zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use the maximal cofiguration.\n"); } if (zend_hash_find(EG(ini_directives), "zend_optimizerplus.max_accelerated_files", @@ -150,7 +150,7 @@ static ZEND_INI_MH(OnUpdateMaxWastedPercentage) /* keep the compiler happy */ (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage; - p = (double *) (base+(size_t) mh_arg1); + p = (double *) (base + (size_t)mh_arg1); percentage = atoi(new_value); if (percentage <= 0 || percentage > 50) { @@ -159,7 +159,7 @@ static ZEND_INI_MH(OnUpdateMaxWastedPercentage) percentage = 5; zend_accel_error(ACCEL_LOG_WARNING, "zend_optimizerplus.max_wasted_percentage must be ser netweeb 1 and 50.\n"); - zend_accel_error(ACCEL_LOG_WARNING,ACCELERATOR_PRODUCT_NAME " will use 5%.\n" ); + zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use 5%.\n"); if (zend_hash_find(EG(ini_directives), "zend_optimizerplus.max_wasted_percentage", sizeof("zend_optimizerplus.max_wasted_percentage"), @@ -189,7 +189,7 @@ static ZEND_INI_MH(OnUpdateAccelBlacklist) return FAILURE; } - p = (char **) (base+(size_t) mh_arg1); + p = (char **) (base + (size_t)mh_arg1); *p = new_value; zend_accel_blacklist_init(&accel_blacklist); @@ -244,7 +244,7 @@ static int ZEND_DECLARE_INHERITED_CLASS_DELAYED_HANDLER(ZEND_OPCODE_HANDLER_ARGS { zend_class_entry **pce, **pce_orig; - if (zend_hash_find(EG(class_table), Z_STRVAL(EX(opline)->op2.u.constant), Z_STRLEN(EX(opline)->op2.u.constant)+1, (void **)&pce) == FAILURE || + if (zend_hash_find(EG(class_table), Z_STRVAL(EX(opline)->op2.u.constant), Z_STRLEN(EX(opline)->op2.u.constant) + 1, (void **)&pce) == FAILURE || (zend_hash_find(EG(class_table), Z_STRVAL(EX(opline)->op1.u.constant), Z_STRLEN(EX(opline)->op1.u.constant), (void**)&pce_orig) == SUCCESS && *pce != *pce_orig)) { do_bind_inherited_class(EX(opline), EG(class_table), EX_T(EX(opline)->extended_value).class_entry, 0 TSRMLS_CC); @@ -265,14 +265,14 @@ static int filename_is_in_cache(char *filename, int filename_len TSRMLS_DC) handle.type = ZEND_HANDLE_FILENAME; if (IS_ABSOLUTE_PATH(filename, filename_len)) { - persistent_script = zend_accel_hash_find(&ZCSG(hash), filename, filename_len+1); + persistent_script = zend_accel_hash_find(&ZCSG(hash), filename, filename_len + 1); if (persistent_script) { return !persistent_script->corrupted; } } if ((key = accel_make_persistent_key_ex(&handle, filename_len, &key_length TSRMLS_CC)) != NULL) { - persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length+1); + persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length + 1); return persistent_script && !persistent_script->corrupted; } @@ -483,7 +483,7 @@ static ZEND_FUNCTION(accelerator_get_status) add_assoc_long(memory_usage, "free_memory", zend_shared_alloc_get_free_memory()); add_assoc_long(memory_usage, "wasted_memory", ZSMMG(wasted_shared_memory)); add_assoc_double(memory_usage, "current_wasted_percentage", (((double) ZSMMG(wasted_shared_memory))/ZCG(accel_directives).memory_consumption)*100.0); - add_assoc_zval(return_value, "memory_usage",memory_usage); + add_assoc_zval(return_value, "memory_usage", memory_usage); /* Accelerator statistics */ MAKE_STD_ZVAL(statistics); @@ -497,12 +497,12 @@ static ZEND_FUNCTION(accelerator_get_status) reqs = ZCSG(hits)+ZCSG(misses); add_assoc_double(statistics, "blacklist_miss_ratio", reqs?(((double) ZCSG(blacklist_misses))/reqs)*100.0:0); add_assoc_double(statistics, "accelerator_hit_rate", reqs?(((double) ZCSG(hits))/reqs)*100.0:0); - add_assoc_zval(return_value, "accelerator_statistics",statistics); + add_assoc_zval(return_value, "accelerator_statistics", statistics); /* acceleratred scripts */ scripts = accelerator_get_scripts(TSRMLS_C); if (scripts) { - add_assoc_zval(return_value, "scripts",scripts); + add_assoc_zval(return_value, "scripts", scripts); } } @@ -555,20 +555,20 @@ static ZEND_FUNCTION(accelerator_get_configuration) add_assoc_bool(directives, "zend_optimizerplus.enable_file_override", ZCG(accel_directives).file_override_enabled); add_assoc_long(directives, "zend_optimizerplus.optimization_level", ZCG(accel_directives).optimization_level); - add_assoc_zval(return_value, "directives",directives); + add_assoc_zval(return_value, "directives", directives); /*version */ MAKE_STD_ZVAL(version); array_init(version); add_assoc_string(version, "version", ACCELERATOR_VERSION, 1); add_assoc_string(version, "accelerator_product_name", ACCELERATOR_PRODUCT_NAME, 1); - add_assoc_zval(return_value, "version",version); + add_assoc_zval(return_value, "version", version); /* blacklist */ MAKE_STD_ZVAL(blacklist); array_init(blacklist); zend_accel_blacklist_apply(&accel_blacklist, (apply_func_arg_t) add_blacklist_path, blacklist TSRMLS_CC); - add_assoc_zval(return_value, "blacklist",blacklist); + add_assoc_zval(return_value, "blacklist", blacklist); } /* {{{ proto void accelerator_reset() diff --git a/zend_persist.c b/zend_persist.c index f3438a05bf..9efd028e99 100644 --- a/zend_persist.c +++ b/zend_persist.c @@ -169,7 +169,7 @@ static void zend_persist_zval_ptr(zval **zp TSRMLS_DC) static void zend_protect_zval(zval *z TSRMLS_DC) { PZ_SET_ISREF_P(z); - PZ_SET_REFCOUNT_P(z,2); + PZ_SET_REFCOUNT_P(z, 2); } static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_script* main_persistent_script TSRMLS_DC) @@ -245,7 +245,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc zend_op *end = new_opcodes + op_array->last; int offset = 0; - for (;opline PHP_5_3_X_API_NO opline->op1.zv = (zval*)((char*)opline->op1.zv + ((char*)op_array->literals - (char*)orig_literals)); diff --git a/zend_persist_calc.c b/zend_persist_calc.c index 72755325bf..00c8784a84 100644 --- a/zend_persist_calc.c +++ b/zend_persist_calc.c @@ -178,7 +178,7 @@ static uint zend_persist_op_array_calc(zend_op_array *op_array TSRMLS_DC) zend_uint i; ADD_DUP_SIZE(op_array->arg_info, sizeof(zend_arg_info) * op_array->num_args); - for (i = 0;i < op_array->num_args; i++) { + for (i = 0; i < op_array->num_args; i++) { if (op_array->arg_info[i].name) { ADD_INTERNED_STRING(op_array->arg_info[i].name, op_array->arg_info[i].name_len + 1); }