]> granicus.if.org Git - php/commitdiff
Codes style improve
authorXinchen Hui <laruence@gmail.com>
Fri, 22 Feb 2013 06:56:05 +0000 (14:56 +0800)
committerXinchen Hui <laruence@gmail.com>
Fri, 22 Feb 2013 06:56:05 +0000 (14:56 +0800)
17 files changed:
Optimizer/block_pass.c
Optimizer/nop_removal.c
Optimizer/optimize_temp_vars_5.c
Optimizer/pass1_5.c
Optimizer/pass2.c
Optimizer/pass3.c
ZendAccelerator.c
shared_alloc_mmap.c
shared_alloc_posix.c
shared_alloc_shm.c
shared_alloc_win32.c
zend_accelerator_blacklist.c
zend_accelerator_module.c
zend_accelerator_util_funcs.c
zend_persist.c
zend_persist_calc.c
zend_shared_alloc.c

index 966cf26fbc4c93a66866c3965d502405859f0343..f72cc582891a5f6c1e8e1a12e21a90323fd02113 100644 (file)
@@ -8,25 +8,25 @@ static int zend_get_persistent_constant(char *name, uint name_len, zval *result,
        int retval = 1;
        ALLOCA_FLAG(use_heap);
 
-       if (zend_hash_find(EG(zend_constants), name, name_len+1, (void **) &c) == FAILURE) {
-               lookup_name = DO_ALLOCA(name_len+1);
-               memcpy(lookup_name, name, name_len+1);
+       if (zend_hash_find(EG(zend_constants), name, name_len + 1, (void **) &c) == FAILURE) {
+               lookup_name = DO_ALLOCA(name_len + 1);
+               memcpy(lookup_name, name, name_len + 1);
                zend_str_tolower(lookup_name, name_len);
 
-               if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) {
+               if (zend_hash_find(EG(zend_constants), lookup_name, name_len + 1, (void **) &c) == SUCCESS) {
                        if (!(c->flags & CONST_CT_SUBST) || (c->flags & CONST_CS)) {
-                               retval=0;
+                               retval = 0;
                        }
                } else {
-                       retval=0;
+                       retval = 0;
                }
                FREE_ALLOCA(lookup_name);
        }
 
        if (retval) {
-               if(c->flags & CONST_PERSISTENT) {
+               if (c->flags & CONST_PERSISTENT) {
                        *result = c->value;
-                       if(copy) {
+                       if (copy) {
                                zval_copy_ctor(result);
                        }
                } else {
@@ -43,26 +43,26 @@ 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);
-       if(!block->access) {
+       if (!block->access) {
                fprintf(stderr, " unused");
        }
-       if(block->op1_to) {
+       if (block->op1_to) {
                fprintf(stderr, " 1: %d", block->op1_to->start_opline - opcodes);
        }
-       if(block->op2_to) {
+       if (block->op2_to) {
                fprintf(stderr, " 2: %d", block->op2_to->start_opline - opcodes);
        }
-       if(block->ext_to) {
+       if (block->ext_to) {
                fprintf(stderr, " e: %d", block->ext_to->start_opline - opcodes);
        }
-       if(block->follow_to) {
+       if (block->follow_to) {
                fprintf(stderr, " f: %d", block->follow_to->start_opline - opcodes);
        }
 
-       if(block->sources) {
+       if (block->sources) {
                zend_block_source *bs = block->sources;
                fprintf(stderr, " s:");
-               while(bs) {
+               while (bs) {
                        fprintf(stderr, " %d", bs->from->start_opline - opcodes);
                        bs = bs->next;
                }
@@ -83,8 +83,8 @@ static inline void print_block(zend_code_block *block, zend_op *opcodes, char *t
 static zend_code_block *find_code_blocks(zend_op_array *op_array)
 {
        zend_op *opline;
-       zend_op *end = op_array->opcodes+op_array->last;
-       zend_code_block *blocks = ecalloc(op_array->last+2, sizeof(zend_code_block));
+       zend_op *end = op_array->opcodes + op_array->last;
+       zend_code_block *blocks = ecalloc(op_array->last + 2, sizeof(zend_code_block));
        zend_code_block *cur_block;
        zend_uint opno = 0;
 
@@ -92,11 +92,11 @@ static zend_code_block *find_code_blocks(zend_op_array *op_array)
        blocks[0].start_opline = opline;
        blocks[0].start_opline_no = 0;
        /* first find block start points */
-       if(op_array->last_try_catch) {
-               int i;
+       if (op_array->last_try_catch) {
+               int i = 0;
                blocks->try = ecalloc(op_array->last_try_catch, sizeof(zend_code_block *));
                blocks->catch = ecalloc(op_array->last_try_catch, sizeof(zend_code_block *));
-               for(i=0; i< op_array->last_try_catch; i++) {
+               for (; i< op_array->last_try_catch; i++) {
                        blocks->try[i] = &blocks[op_array->try_catch_array[i].try_op];
                        blocks->catch[i] = &blocks[op_array->try_catch_array[i].catch_op];
                        START_BLOCK_OP(op_array->try_catch_array[i].try_op);
@@ -104,7 +104,7 @@ static zend_code_block *find_code_blocks(zend_op_array *op_array)
                        blocks[op_array->try_catch_array[i].try_op].is_try = 1;
                }
        }
-       while (opline<end) {
+       while (opline < end) {
                switch((unsigned)opline->opcode) {
                        case ZEND_BRK:
                        case ZEND_CONT:
@@ -134,13 +134,13 @@ static zend_code_block *find_code_blocks(zend_op_array *op_array)
                        case ZEND_EXIT:
                        case ZEND_THROW:
                                /* start new block from this+1 */
-                               START_BLOCK_OP(opno+1);
+                               START_BLOCK_OP(opno + 1);
                                break;
                                /* TODO: if conditional jmp depends on constant,
                                                 don't start block that won't be executed */
                        case ZEND_CATCH:
                                START_BLOCK_OP(opline->extended_value);
-                               START_BLOCK_OP(opno+1);
+                               START_BLOCK_OP(opno + 1);
                                break;
                        case ZEND_JMPZNZ:
                                START_BLOCK_OP(opline->extended_value);
@@ -158,7 +158,7 @@ static zend_code_block *find_code_blocks(zend_op_array *op_array)
                        case ZEND_JMP_SET_VAR:
 #endif
                                START_BLOCK_OP(ZEND_OP2(opline).opline_num);
-                               START_BLOCK_OP(opno+1);
+                               START_BLOCK_OP(opno + 1);
                                break;
 
                }
@@ -168,13 +168,13 @@ static zend_code_block *find_code_blocks(zend_op_array *op_array)
 
        /* Build CFG (Control Flow Graph) */
        cur_block = blocks;
-       for(opno = 1; opno < op_array->last; opno++) {
-               if(blocks[opno].start_opline) {
+       for (opno = 1; opno < op_array->last; opno++) {
+               if (blocks[opno].start_opline) {
                        /* found new block start */
                        cur_block->len = blocks[opno].start_opline - cur_block->start_opline;
                        cur_block->next = &blocks[opno];
                        /* what is the last OP of previous block? */
-                       opline = blocks[opno].start_opline-1;
+                       opline = blocks[opno].start_opline - 1;
                        switch((unsigned)opline->opcode) {
                                case ZEND_RETURN:
 #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
@@ -229,7 +229,7 @@ static zend_code_block *find_code_blocks(zend_op_array *op_array)
        print_block(cur_block, op_array->opcodes, "");
 
        /* The op_array doesn't have BRK, CONT, GOTO opcodes anyway */
-       if(op_array->brk_cont_array) {
+       if (op_array->brk_cont_array) {
                efree(op_array->brk_cont_array);
        }
        op_array->brk_cont_array = NULL;
@@ -242,8 +242,8 @@ static zend_code_block *find_code_blocks(zend_op_array *op_array)
 
 #define ADD_SOURCE(fromb, tob) { \
        zend_block_source *__s = tob->sources; \
-    while(__s && __s->from != fromb) __s = __s->next; \
-       if(__s == NULL) { \
+    while (__s && __s->from != fromb) __s = __s->next; \
+       if (__s == NULL) { \
                zend_block_source *__t = emalloc(sizeof(zend_block_source)); \
                __t->next = tob->sources; \
                tob->sources = __t; \
@@ -264,17 +264,17 @@ static inline void replace_source(zend_block_source *list, zend_code_block *old,
        zend_block_source **cs;
        int found = 0;
 
-       for(cs = &list; *cs; cs = &((*cs)->next)) {
-               if((*cs)->from == new) {
-                       if(found) {
+       for (cs = &list; *cs; cs = &((*cs)->next)) {
+               if ((*cs)->from == new) {
+                       if (found) {
                                DEL_SOURCE(cs);
                        } else {
                                found = 1;
                        }
                }
 
-               if((*cs)->from == old) {
-                       if(found) {
+               if ((*cs)->from == old) {
+                       if (found) {
                                DEL_SOURCE(cs);
                        } else {
                                (*cs)->from = new;
@@ -289,37 +289,36 @@ static inline void del_source(zend_code_block *from, zend_code_block *to)
        /* delete source 'from' from 'to'-s sources list */
        zend_block_source **cs = &to->sources;
 
-       if(to->sources == NULL) {
+       if (to->sources == NULL) {
                to->access = 0;
                return;
        }
 
-       while(*cs) {
-               if((*cs)->from == from) {
-                       DEL_SOURCE(cs);
+       while (*cs) {
+               if ((*cs)->from == from) {
+                       DEL_SOURCE(cs);
                        break;
                }
                cs = &((*cs)->next);
        }
 
-       if(to->sources == NULL) {
+       if (to->sources == NULL) {
                /* 'to' has no more sources - it's unused, will be stripped */
                to->access = 0;
                return;
        }
 
-       if(to->sources->next == NULL) {
+       if (to->sources->next == NULL) {
                /* source to only one block */
                zend_code_block *from_block = to->sources->from;
-               
-               if(from_block->access && from_block->follow_to == to &&
-                  from_block->op1_to == NULL &&
-                  from_block->op2_to == NULL &&
-                  from_block->ext_to == NULL
-                  ) {
+
+               if (from_block->access && from_block->follow_to == to &&
+                   from_block->op1_to == NULL &&
+                   from_block->op2_to == NULL &&
+                   from_block->ext_to == NULL) {
                        /* this block follows it's only predecessor - we can join them */
                        zend_op *new_to = from_block->start_opline + from_block->len;
-                       if(new_to != to->start_opline) {
+                       if (new_to != to->start_opline) {
                                /* move block to new location */
                                memmove(new_to, to->start_opline, sizeof(zend_op)*to->len);
                        }
@@ -331,19 +330,19 @@ static inline void del_source(zend_code_block *from, zend_code_block *to)
                        efree(to->sources);
                        to->sources = NULL;
                        from_block->follow_to = to->follow_to;
-                       if(to->op1_to) {
+                       if (to->op1_to) {
                                from_block->op1_to = to->op1_to;
                                replace_source(to->op1_to->sources, to, from_block);
                        }
-                       if(to->op2_to) {
+                       if (to->op2_to) {
                                from_block->op2_to = to->op2_to;
                                replace_source(to->op2_to->sources, to, from_block);
                        }
-                       if(to->ext_to) {
+                       if (to->ext_to) {
                                from_block->ext_to = to->ext_to;
                                replace_source(to->ext_to->sources, to, from_block);
                        }
-                       if(to->follow_to) {
+                       if (to->follow_to) {
                                replace_source(to->follow_to->sources, to, from_block);
                        }
                        /* remove "to" from list */
@@ -353,24 +352,24 @@ static inline void del_source(zend_code_block *from, zend_code_block *to)
 
 static void delete_code_block(zend_code_block *block)
 {
-       if(block->follow_to) {
+       if (block->follow_to) {
                zend_block_source *bs = block->sources;
-               while(bs) {
+               while (bs) {
                        zend_code_block *from_block = bs->from;
                        zend_code_block *to = block->follow_to;
-                       if(from_block->op1_to == block) {
+                       if (from_block->op1_to == block) {
                                from_block->op1_to = to;
                                ADD_SOURCE(from_block, to);
                        }
-                       if(from_block->op2_to == block) {
+                       if (from_block->op2_to == block) {
                                from_block->op2_to = to;
                                ADD_SOURCE(from_block, to);
                        }
-                       if(from_block->ext_to == block) {
+                       if (from_block->ext_to == block) {
                                from_block->ext_to = to;
                                ADD_SOURCE(from_block, to);
                        }
-                       if(from_block->follow_to == block) {
+                       if (from_block->follow_to == block) {
                                from_block->follow_to = to;
                                ADD_SOURCE(from_block, to);
                        }
@@ -382,24 +381,24 @@ static void delete_code_block(zend_code_block *block)
 
 static void zend_access_path(zend_code_block *block)
 {
-       if(block->access) {
+       if (block->access) {
                return;
        }
 
        block->access = 1;
-       if(block->op1_to) {
+       if (block->op1_to) {
                zend_access_path(block->op1_to);
                ADD_SOURCE(block, block->op1_to);
        }
-       if(block->op2_to) {
+       if (block->op2_to) {
                zend_access_path(block->op2_to);
                ADD_SOURCE(block, block->op2_to);
        }
-       if(block->ext_to) {
+       if (block->ext_to) {
                zend_access_path(block->ext_to);
                ADD_SOURCE(block, block->ext_to);
        }
-       if(block->follow_to) {
+       if (block->follow_to) {
                zend_access_path(block->follow_to);
                ADD_SOURCE(block, block->follow_to);
        }
@@ -408,7 +407,7 @@ static void zend_access_path(zend_code_block *block)
 /* Traverse CFG, mark reachable basic blocks and build back references */
 static void zend_rebuild_access_path(zend_code_block *blocks, zend_op_array *op_array, int find_start)
 {
-       zend_code_block *start = find_start?NULL:blocks;
+       zend_code_block *start = find_start? NULL : blocks;
        zend_code_block *b;
 
        /* Mark all blocks as unaccessable and destroy back references */
@@ -420,7 +419,7 @@ static void zend_rebuild_access_path(zend_code_block *blocks, zend_op_array *op_
                }
                b->access = 0;
                cs = b->sources;
-               while(cs) {
+               while (cs) {
                        zend_block_source *n = cs->next;
                        efree(cs);
                        cs = n;
@@ -435,8 +434,8 @@ static void zend_rebuild_access_path(zend_code_block *blocks, zend_op_array *op_
        /* Add exception pathes */
        if (op_array->last_try_catch) {
                int i;
-               for(i=0; i< op_array->last_try_catch; i++) {
-                       if(!blocks->catch[i]->access) {
+               for (i=0; i< op_array->last_try_catch; i++) {
+                       if (!blocks->catch[i]->access) {
                                zend_access_path(blocks->catch[i]);
                        }
                }
@@ -456,17 +455,17 @@ static void zend_rebuild_access_path(zend_code_block *blocks, zend_op_array *op_
 
 #else
 
-# define VAR_NUM_EX(op) ((op).op_type==IS_TMP_VAR||(op).op_type==IS_VAR?VAR_NUM((op).u.var):(op).u.var)
+# define VAR_NUM_EX(op) ((op).op_type == IS_TMP_VAR || (op).op_type == IS_VAR? VAR_NUM((op).u.var) : (op).u.var)
 
 # define VAR_SOURCE(op) Tsource[VAR_NUM(op.u.var)]
 # define SET_VAR_SOURCE(opline) Tsource[VAR_NUM(ZEND_RESULT(opline).var)] = opline
 
-# define VAR_UNSET(op) do { if ((op).op_type==IS_TMP_VAR||(op).op_type==IS_VAR) {VAR_SOURCE(op) = NULL;}} while (0)
+# define VAR_UNSET(op) do { if ((op).op_type == IS_TMP_VAR || (op).op_type == IS_VAR) {VAR_SOURCE(op) = NULL;}} while (0)
 
 #endif
 
 #define convert_to_string_safe(v) \
-       if(Z_TYPE_P((v)) == IS_NULL) { \
+       if (Z_TYPE_P((v)) == IS_NULL) { \
                ZVAL_STRINGL((v), "", 0, 1); \
        } else { \
                convert_to_string((v)); \
@@ -481,10 +480,10 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
        print_block(block, op_array->opcodes, "Opt ");
 
        /* remove leading NOPs */
-       while(block->start_opline->opcode == ZEND_NOP) {
-               if(block->len == 1) {
+       while (block->start_opline->opcode == ZEND_NOP) {
+               if (block->len == 1) {
                        /* this block is all NOPs, join with following block */
-                       if(block->follow_to) {
+                       if (block->follow_to) {
                                delete_code_block(block);
                        }
                        return;
@@ -495,22 +494,22 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
        }
 
        /* we track data dependencies only insight a single basic block */
-       if(op_array->T){
+       if (op_array->T) {
                Tsource = ecalloc(op_array->T, sizeof(zend_op *));
        }
        opline = block->start_opline;
-       end = opline+block->len;
-       while((op_array->T)&&(opline<end)) {
+       end = opline + block->len;
+       while ((op_array->T) && (opline < end)) {
                /* strip X = QM_ASSIGN(const) */
-               if(ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                  VAR_SOURCE(opline->op1) &&
-                  VAR_SOURCE(opline->op1)->opcode == ZEND_QM_ASSIGN &&
-                  ZEND_OP1_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST &&
-                  opline->opcode != ZEND_CASE &&         /* CASE _always_ expects variable */
-                  opline->opcode != ZEND_FETCH_DIM_TMP_VAR &&   /* in 5.1, FETCH_DIM_TMP_VAR expects T */
-                  opline->opcode != ZEND_FE_RESET &&
-                  opline->opcode != ZEND_FREE
-                  ) {
+               if (ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                       VAR_SOURCE(opline->op1) &&
+                       VAR_SOURCE(opline->op1)->opcode == ZEND_QM_ASSIGN &&
+                       ZEND_OP1_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST &&
+                       opline->opcode != ZEND_CASE &&         /* CASE _always_ expects variable */
+                       opline->opcode != ZEND_FETCH_DIM_TMP_VAR &&   /* in 5.1, FETCH_DIM_TMP_VAR expects T */
+                       opline->opcode != ZEND_FE_RESET &&
+                       opline->opcode != ZEND_FREE
+                       ) {
                        zend_op *src = VAR_SOURCE(opline->op1);
                        VAR_UNSET(opline->op1);
                        COPY_NODE(opline->op1, src->op1);
@@ -518,10 +517,10 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                }
 
                /* T = QM_ASSIGN(C), F(T) => NOP, F(C) */
-               if(ZEND_OP2_TYPE(opline) == IS_TMP_VAR &&
-                  VAR_SOURCE(opline->op2) &&
-                  VAR_SOURCE(opline->op2)->opcode == ZEND_QM_ASSIGN &&
-                  ZEND_OP1_TYPE(VAR_SOURCE(opline->op2)) == IS_CONST) {
+               if (ZEND_OP2_TYPE(opline) == IS_TMP_VAR &&
+                       VAR_SOURCE(opline->op2) &&
+                       VAR_SOURCE(opline->op2)->opcode == ZEND_QM_ASSIGN &&
+                       ZEND_OP1_TYPE(VAR_SOURCE(opline->op2)) == IS_CONST) {
                        zend_op *src = VAR_SOURCE(opline->op2);
                        VAR_UNSET(opline->op2);
                        COPY_NODE(opline->op2, src->op1);
@@ -529,38 +528,38 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                }
 
                /* T = PRINT(X), F(T) => ECHO(X), F(1) */
-               if(ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                  VAR_SOURCE(opline->op1) &&
-                  VAR_SOURCE(opline->op1)->opcode == ZEND_PRINT &&
-                  opline->opcode != ZEND_CASE && opline->opcode != ZEND_FREE) {
+               if (ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                       VAR_SOURCE(opline->op1) &&
+                       VAR_SOURCE(opline->op1)->opcode == ZEND_PRINT &&
+                       opline->opcode != ZEND_CASE && opline->opcode != ZEND_FREE) {
                        ZEND_OP1_TYPE(opline) = IS_CONST;
                        LITERAL_LONG(opline->op1, 1);
                }
 
-               if(ZEND_OP2_TYPE(opline) == IS_TMP_VAR &&
-                  VAR_SOURCE(opline->op2) &&
-                  VAR_SOURCE(opline->op2)->opcode == ZEND_PRINT) {
+               if (ZEND_OP2_TYPE(opline) == IS_TMP_VAR &&
+                       VAR_SOURCE(opline->op2) &&
+                       VAR_SOURCE(opline->op2)->opcode == ZEND_PRINT) {
                        ZEND_OP2_TYPE(opline) = IS_CONST;
                        LITERAL_LONG(opline->op2, 1);
                }
 
                /* T = CAST(X, String), ECHO(T) => NOP, ECHO(X) */
-               if((opline->opcode == ZEND_ECHO || opline->opcode == ZEND_PRINT) &&
-                  ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                  VAR_SOURCE(opline->op1) &&
-                  VAR_SOURCE(opline->op1)->opcode == ZEND_CAST &&
-                  VAR_SOURCE(opline->op1)->extended_value == IS_STRING) {
+               if ((opline->opcode == ZEND_ECHO || opline->opcode == ZEND_PRINT) &&
+                       ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                       VAR_SOURCE(opline->op1) &&
+                       VAR_SOURCE(opline->op1)->opcode == ZEND_CAST &&
+                       VAR_SOURCE(opline->op1)->extended_value == IS_STRING) {
                        zend_op *src = VAR_SOURCE(opline->op1);
                        COPY_NODE(opline->op1, src->op1);
                        MAKE_NOP(src);
                }
 
                /* T = PRINT(X), FREE(T) => ECHO(X) */
-               if(opline->opcode == ZEND_FREE &&
+               if (opline->opcode == ZEND_FREE &&
                        ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                  VAR_SOURCE(opline->op1)) {
+                       VAR_SOURCE(opline->op1)) {
                        zend_op *src = VAR_SOURCE(opline->op1);
-                       if(src->opcode == ZEND_PRINT) {
+                       if (src->opcode == ZEND_PRINT) {
                                src->opcode = ZEND_ECHO;
                                ZEND_RESULT_TYPE(src) = IS_UNUSED;
                                MAKE_NOP(opline);
@@ -568,9 +567,9 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                }
 
        /* T = BOOL(X), FREE(T) => NOP */
-               if(opline->opcode == ZEND_FREE &&
-           ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                  VAR_SOURCE(opline->op1)) {
+               if (opline->opcode == ZEND_FREE &&
+                       ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                       VAR_SOURCE(opline->op1)) {
                        zend_op *src = VAR_SOURCE(opline->op1);
                        if (src->opcode == ZEND_BOOL) {
                                if (ZEND_OP1_TYPE(src) == IS_CONST) {
@@ -649,40 +648,39 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
          * IS_NOT_EQ(TRUE, X)  => BOOL_NOT(X)
          * IS_NOT_EQ(FALSE, X) => BOOL(X)
          */
-               if(opline->opcode == ZEND_IS_EQUAL ||
-                  opline->opcode == ZEND_IS_NOT_EQUAL) {
+               if (opline->opcode == ZEND_IS_EQUAL ||
+                       opline->opcode == ZEND_IS_NOT_EQUAL) {
                        if (ZEND_OP1_TYPE(opline) == IS_CONST &&
                                Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_BOOL) {
                                opline->opcode =
                                        ((opline->opcode == ZEND_IS_EQUAL) == Z_LVAL(ZEND_OP1_LITERAL(opline)))?
-                                       ZEND_BOOL:ZEND_BOOL_NOT;
+                                       ZEND_BOOL : ZEND_BOOL_NOT;
                                COPY_NODE(opline->op1, opline->op2);
                                SET_UNUSED(opline->op2);
                        } else if (ZEND_OP2_TYPE(opline) == IS_CONST &&
                                           Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_BOOL) {
                                opline->opcode =
                                        ((opline->opcode == ZEND_IS_EQUAL) == Z_LVAL(ZEND_OP2_LITERAL(opline)))?
-                                       ZEND_BOOL:ZEND_BOOL_NOT;
+                                       ZEND_BOOL : ZEND_BOOL_NOT;
                                SET_UNUSED(opline->op2);
                        }
                }
 
-               if((opline->opcode == ZEND_BOOL ||
+               if ((opline->opcode == ZEND_BOOL ||
                        opline->opcode == ZEND_BOOL_NOT ||
                        opline->opcode == ZEND_JMPZ ||
                        opline->opcode == ZEND_JMPNZ ||
                        opline->opcode == ZEND_JMPZNZ) &&
-                  ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                  VAR_SOURCE(opline->op1) != NULL &&
-                  !used_ext[VAR_NUM(ZEND_OP1(opline).var)] &&
-                  VAR_SOURCE(opline->op1)->opcode == ZEND_BOOL_NOT
-                  ) {
+                       ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                       VAR_SOURCE(opline->op1) != NULL &&
+                       !used_ext[VAR_NUM(ZEND_OP1(opline).var)] &&
+                       VAR_SOURCE(opline->op1)->opcode == ZEND_BOOL_NOT) {
                        /* T = BOOL_NOT(X) + JMPZ(T) -> NOP, JMPNZ(X) */
                        zend_op *src = VAR_SOURCE(opline->op1);
 
                        COPY_NODE(opline->op1, src->op1);
 
-                       switch(opline->opcode) {
+                       switch (opline->opcode) {
                                case ZEND_BOOL:
                                        /* T = BOOL_NOT(X) + BOOL(T) -> NOP, BOOL_NOT(X) */
                                        opline->opcode = ZEND_BOOL_NOT;
@@ -741,28 +739,27 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                } else
 #endif
                /* T = BOOL(X) + JMPZ(T) -> NOP, JMPZ(X) */
-               if((opline->opcode == ZEND_BOOL ||
+               if ((opline->opcode == ZEND_BOOL ||
                        opline->opcode == ZEND_BOOL_NOT ||
                        opline->opcode == ZEND_JMPZ ||
                        opline->opcode == ZEND_JMPZ_EX ||
                        opline->opcode == ZEND_JMPNZ_EX ||
                        opline->opcode == ZEND_JMPNZ ||
                        opline->opcode == ZEND_JMPZNZ) &&
-                  ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                  VAR_SOURCE(opline->op1) != NULL &&
-                  (!used_ext[VAR_NUM(ZEND_OP1(opline).var)] ||
+                       ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                       VAR_SOURCE(opline->op1) != NULL &&
+                       (!used_ext[VAR_NUM(ZEND_OP1(opline).var)] ||
                        (ZEND_RESULT_TYPE(opline) == IS_TMP_VAR &&
                         ZEND_RESULT(opline).var == ZEND_OP1(opline).var)) &&
-                  (VAR_SOURCE(opline->op1)->opcode == ZEND_BOOL ||
-                       VAR_SOURCE(opline->op1)->opcode == ZEND_QM_ASSIGN)
-                  ) {
+                       (VAR_SOURCE(opline->op1)->opcode == ZEND_BOOL ||
+                       VAR_SOURCE(opline->op1)->opcode == ZEND_QM_ASSIGN)) {
                        zend_op *src = VAR_SOURCE(opline->op1);
                        COPY_NODE(opline->op1, src->op1);
 
                        VAR_UNSET(opline->op1);
                        MAKE_NOP(src);
                        continue;
-               } else if(last_op && opline->opcode == ZEND_ECHO &&
+               } else if (last_op && opline->opcode == ZEND_ECHO &&
                                  last_op->opcode == ZEND_ECHO &&
                                  ZEND_OP1_TYPE(opline) == IS_CONST &&
                                  Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_DOUBLE &&
@@ -774,10 +771,10 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                         */
                        int l;
 
-                       if(Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) {
+                       if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) {
                                convert_to_string_safe(&ZEND_OP1_LITERAL(opline));
                        }
-                       if(Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_STRING) {
+                       if (Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_STRING) {
                                convert_to_string_safe(&ZEND_OP1_LITERAL(last_op));
                        }
                        l = Z_STRLEN(ZEND_OP1_LITERAL(opline)) + Z_STRLEN(ZEND_OP1_LITERAL(last_op));
@@ -799,23 +796,22 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
 #endif
                        Z_STRLEN(ZEND_OP1_LITERAL(opline)) = l;
                        MAKE_NOP(last_op);
-               } else if(opline->opcode == ZEND_CONCAT &&
+               } else if (opline->opcode == ZEND_CONCAT &&
                                  ZEND_OP2_TYPE(opline) == IS_CONST &&
                                  ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
                                  VAR_SOURCE(opline->op1) &&
                                  (VAR_SOURCE(opline->op1)->opcode == ZEND_CONCAT ||
                                   VAR_SOURCE(opline->op1)->opcode == ZEND_ADD_STRING) &&
                                  ZEND_OP2_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST &&
-                                 ZEND_RESULT(VAR_SOURCE(opline->op1)).var == ZEND_OP1(opline).var
-                                 ) {
+                                 ZEND_RESULT(VAR_SOURCE(opline->op1)).var == ZEND_OP1(opline).var) {
                        /* compress consecutive CONCATs */
                        zend_op *src = VAR_SOURCE(opline->op1);
                        int l;
 
-                       if(Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
+                       if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
                                convert_to_string_safe(&ZEND_OP2_LITERAL(opline));
                        }
-                       if(Z_TYPE(ZEND_OP2_LITERAL(src)) != IS_STRING) {
+                       if (Z_TYPE(ZEND_OP2_LITERAL(src)) != IS_STRING) {
                                convert_to_string_safe(&ZEND_OP2_LITERAL(src));
                        }
 
@@ -831,7 +827,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                                memcpy(tmp, Z_STRVAL(ZEND_OP2_LITERAL(src)), l + 1);
                                Z_STRVAL(ZEND_OP2_LITERAL(src)) = tmp;
                        } else {
-                               Z_STRVAL(ZEND_OP2_LITERAL(src)) = erealloc(Z_STRVAL(ZEND_OP2_LITERAL(src)), l+1);
+                               Z_STRVAL(ZEND_OP2_LITERAL(src)) = erealloc(Z_STRVAL(ZEND_OP2_LITERAL(src)), l + 1);
                        }
                        memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src))+Z_STRLEN(ZEND_OP2_LITERAL(src)), Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)));
                        Z_STRVAL(ZEND_OP2_LITERAL(src))[l] = '\0';
@@ -846,51 +842,47 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
 #endif
                        Z_STRLEN(ZEND_OP2_LITERAL(opline)) = l;
                        MAKE_NOP(src);
-               } else if((opline->opcode == ZEND_ADD_STRING ||
-                                 opline->opcode == ZEND_ADD_VAR) &&
-                                 ZEND_OP1_TYPE(opline) == IS_CONST) {
+               } else if ((opline->opcode == ZEND_ADD_STRING || opline->opcode == ZEND_ADD_VAR) && ZEND_OP1_TYPE(opline) == IS_CONST) {
                        /* convert ADD_STRING(C1, C2) to CONCAT(C1, C2) */
                        opline->opcode = ZEND_CONCAT;
                        continue;
-               } else if(opline->opcode == ZEND_ADD_CHAR && ZEND_OP1_TYPE(opline) == IS_CONST && ZEND_OP2_TYPE(opline) == IS_CONST) {
+               } else if (opline->opcode == ZEND_ADD_CHAR && ZEND_OP1_TYPE(opline) == IS_CONST && ZEND_OP2_TYPE(opline) == IS_CONST) {
             /* convert ADD_CHAR(C1, C2) to CONCAT(C1, C2) */
                        char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline));
                        ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1, 1);
                        opline->opcode = ZEND_CONCAT;
                        continue;
-               } else if(
-                       (opline->opcode == ZEND_ADD ||
-                        opline->opcode == ZEND_SUB ||
-                        opline->opcode == ZEND_MUL ||
-                        opline->opcode == ZEND_DIV ||
-                        opline->opcode == ZEND_MOD ||
-                        opline->opcode == ZEND_SL ||
-                        opline->opcode == ZEND_SR ||
-                        opline->opcode == ZEND_CONCAT ||
-                        opline->opcode == ZEND_IS_EQUAL ||
-                        opline->opcode == ZEND_IS_NOT_EQUAL ||
-                        opline->opcode == ZEND_IS_SMALLER ||
-                        opline->opcode == ZEND_IS_SMALLER_OR_EQUAL ||
-                        opline->opcode == ZEND_IS_IDENTICAL ||
-                        opline->opcode == ZEND_IS_NOT_IDENTICAL ||
-                        opline->opcode == ZEND_BOOL_XOR ||
-                        opline->opcode == ZEND_BW_OR ||
-                        opline->opcode == ZEND_BW_AND ||
-                        opline->opcode == ZEND_BW_XOR) &&
-                       ZEND_OP1_TYPE(opline)==IS_CONST &&
-                       ZEND_OP2_TYPE(opline)==IS_CONST) {
+               } else if ((opline->opcode == ZEND_ADD ||
+                                       opline->opcode == ZEND_SUB ||
+                                       opline->opcode == ZEND_MUL ||
+                                       opline->opcode == ZEND_DIV ||
+                                       opline->opcode == ZEND_MOD ||
+                                       opline->opcode == ZEND_SL ||
+                                       opline->opcode == ZEND_SR ||
+                                       opline->opcode == ZEND_CONCAT ||
+                                       opline->opcode == ZEND_IS_EQUAL ||
+                                       opline->opcode == ZEND_IS_NOT_EQUAL ||
+                                       opline->opcode == ZEND_IS_SMALLER ||
+                                       opline->opcode == ZEND_IS_SMALLER_OR_EQUAL ||
+                                       opline->opcode == ZEND_IS_IDENTICAL ||
+                                       opline->opcode == ZEND_IS_NOT_IDENTICAL ||
+                                       opline->opcode == ZEND_BOOL_XOR ||
+                                       opline->opcode == ZEND_BW_OR ||
+                                       opline->opcode == ZEND_BW_AND ||
+                                       opline->opcode == ZEND_BW_XOR) &&
+                                       ZEND_OP1_TYPE(opline)==IS_CONST &&
+                                       ZEND_OP2_TYPE(opline)==IS_CONST) {
                        /* evaluate constant expressions */
                        int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) = get_binary_op(opline->opcode);
                        zval result;
                        int er;
 
-            if ((opline->opcode == ZEND_DIV ||
-                 opline->opcode == ZEND_MOD) &&
+            if ((opline->opcode == ZEND_DIV || opline->opcode == ZEND_MOD) &&
                 ((Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_LONG &&
                   Z_LVAL(ZEND_OP2_LITERAL(opline)) == 0) ||
                  (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_DOUBLE &&
                   Z_DVAL(ZEND_OP2_LITERAL(opline)) == 0.0))) {
-                               if(RESULT_USED(opline)) {
+                               if (RESULT_USED(opline)) {
                                        SET_VAR_SOURCE(opline);
                                }
                 opline++;
@@ -898,7 +890,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                        }
                        er = EG(error_reporting);
                        EG(error_reporting) = 0;
-                       if(binary_op(&result, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline) TSRMLS_CC) == SUCCESS) {
+                       if (binary_op(&result, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline) TSRMLS_CC) == SUCCESS) {
                                PZ_SET_REFCOUNT_P(&result, 1);
                                PZ_UNSET_ISREF_P(&result);
 
@@ -910,15 +902,14 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                                opline->opcode = ZEND_QM_ASSIGN;
                        }
                        EG(error_reporting) = er;
-               } else if((opline->opcode == ZEND_BOOL ||
-                                  opline->opcode == ZEND_BOOL_NOT ||
-                                  opline->opcode == ZEND_BW_NOT) && ZEND_OP1_TYPE(opline)==IS_CONST
-                                  ) {
+               } else if ((opline->opcode == ZEND_BOOL ||
+                                       opline->opcode == ZEND_BOOL_NOT ||
+                                       opline->opcode == ZEND_BW_NOT) && ZEND_OP1_TYPE(opline) == IS_CONST) {
                        /* evaluate constant unary ops */
                        unary_op_type unary_op = get_unary_op(opline->opcode);
                        zval result;
 
-                       if(unary_op) {
+                       if (unary_op) {
                                unary_op(&result, &ZEND_OP1_LITERAL(opline) TSRMLS_CC);
                                literal_dtor(&ZEND_OP1_LITERAL(opline));
                        } else {
@@ -930,21 +921,20 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                        PZ_UNSET_ISREF_P(&result);
                        ZEND_OP1_LITERAL(opline) = result;
                        opline->opcode = ZEND_QM_ASSIGN;
-               } else if((opline->opcode == ZEND_RETURN || opline->opcode == ZEND_EXIT) &&
-                                  ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                                  VAR_SOURCE(opline->op1) &&
-                                  VAR_SOURCE(opline->op1)->opcode == ZEND_QM_ASSIGN
-                                  ) {
+               } else if ((opline->opcode == ZEND_RETURN || opline->opcode == ZEND_EXIT) &&
+                                       ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                                       VAR_SOURCE(opline->op1) &&
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_QM_ASSIGN) {
                        /* T = QM_ASSIGN(X), RETURN(T) to RETURN(X) */
                        zend_op *src = VAR_SOURCE(opline->op1);
                        VAR_UNSET(opline->op1);
                        COPY_NODE(opline->op1, src->op1);
                        MAKE_NOP(src);
-               } else if((opline->opcode == ZEND_ADD_STRING ||
-                                  opline->opcode == ZEND_ADD_CHAR) &&
-                                 ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                                 VAR_SOURCE(opline->op1) &&
-                                 VAR_SOURCE(opline->op1)->opcode == ZEND_INIT_STRING) {
+               } else if ((opline->opcode == ZEND_ADD_STRING ||
+                                       opline->opcode == ZEND_ADD_CHAR) &&
+                                       ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                                       VAR_SOURCE(opline->op1) &&
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_INIT_STRING) {
                        /* convert T = INIT_STRING(), T = ADD_STRING(T, X) to T = QM_ASSIGN(X) */
                        /* CHECKME: Remove ZEND_ADD_VAR optimizsation, since some conversions -
                           namely, BOOL(false)->string - don't allocate memory but use empty_string
@@ -952,38 +942,38 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                        zend_op *src = VAR_SOURCE(opline->op1);
                        VAR_UNSET(opline->op1);
                        COPY_NODE(opline->op1, opline->op2);
-                       if(opline->opcode == ZEND_ADD_CHAR) {
+                       if (opline->opcode == ZEND_ADD_CHAR) {
                                char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline));
                                ZVAL_STRINGL(&ZEND_OP1_LITERAL(opline), &c, 1, 1);
                        }
                        SET_UNUSED(opline->op2);
                        MAKE_NOP(src);
                        opline->opcode = ZEND_QM_ASSIGN;
-               } else if((opline->opcode == ZEND_ADD_STRING ||
-                                  opline->opcode == ZEND_ADD_CHAR ||
-                                  opline->opcode == ZEND_ADD_VAR ||
-                                  opline->opcode == ZEND_CONCAT) &&
-                                 ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                                 VAR_SOURCE(opline->op1) &&
-                                 VAR_SOURCE(opline->op1)->opcode == ZEND_CONCAT &&
-                                 ZEND_OP2_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST &&
-                                 Z_TYPE(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == IS_STRING &&
-                                 Z_STRLEN(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == 0) {
+               } else if ((opline->opcode == ZEND_ADD_STRING ||
+                                       opline->opcode == ZEND_ADD_CHAR ||
+                                       opline->opcode == ZEND_ADD_VAR ||
+                                       opline->opcode == ZEND_CONCAT) &&
+                                       ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                                       VAR_SOURCE(opline->op1) &&
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_CONCAT &&
+                                       ZEND_OP2_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST &&
+                                       Z_TYPE(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == IS_STRING &&
+                                       Z_STRLEN(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == 0) {
                        /* convert T = CONCAT(X,''), T = ADD_STRING(T, Y) to T = CONCAT(X,Y) */
                        zend_op *src = VAR_SOURCE(opline->op1);
                        VAR_UNSET(opline->op1);
                        COPY_NODE(opline->op1, src->op1);
-                       if(opline->opcode == ZEND_ADD_CHAR) {
+                       if (opline->opcode == ZEND_ADD_CHAR) {
                                char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline));
                                ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1, 1);
                        }
                        opline->opcode = ZEND_CONCAT;
                        literal_dtor(&ZEND_OP2_LITERAL(src)); /* will take care of empty_string too */
                        MAKE_NOP(src);
-               } else if(opline->opcode == ZEND_ADD_VAR &&
-                                 ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                                 VAR_SOURCE(opline->op1) &&
-                                 VAR_SOURCE(opline->op1)->opcode == ZEND_INIT_STRING) {
+               } else if (opline->opcode == ZEND_ADD_VAR &&
+                                       ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                                       VAR_SOURCE(opline->op1) &&
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_INIT_STRING) {
                        /* convert T = INIT_STRING(), T = ADD_VAR(T, X) to T = CAST(STRING, X) */
                        zend_op *src = VAR_SOURCE(opline->op1);
                        VAR_UNSET(opline->op1);
@@ -992,44 +982,43 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                        MAKE_NOP(src);
                        opline->opcode = ZEND_CAST;
                        opline->extended_value = IS_STRING;
-               } else if((opline->opcode == ZEND_ADD_STRING ||
-                                  opline->opcode == ZEND_ADD_CHAR ||
-                                  opline->opcode == ZEND_ADD_VAR ||
-                                  opline->opcode == ZEND_CONCAT) &&
-                                 ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                                 VAR_SOURCE(opline->op1) &&
-                                 VAR_SOURCE(opline->op1)->opcode == ZEND_CAST &&
-                                 VAR_SOURCE(opline->op1)->extended_value == IS_STRING) {
+               } else if ((opline->opcode == ZEND_ADD_STRING ||
+                                       opline->opcode == ZEND_ADD_CHAR ||
+                                       opline->opcode == ZEND_ADD_VAR ||
+                                       opline->opcode == ZEND_CONCAT) &&
+                                       ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                                       VAR_SOURCE(opline->op1) &&
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_CAST &&
+                                       VAR_SOURCE(opline->op1)->extended_value == IS_STRING) {
                        /* convert T1 = CAST(STRING, X), T2 = CONCAT(T1, Y) to T2 = CONCAT(X,Y) */
                        zend_op *src = VAR_SOURCE(opline->op1);
                        VAR_UNSET(opline->op1);
                        COPY_NODE(opline->op1, src->op1);
-                       if(opline->opcode == ZEND_ADD_CHAR) {
+                       if (opline->opcode == ZEND_ADD_CHAR) {
                                char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline));
                                ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1, 1);
                        }
                        opline->opcode = ZEND_CONCAT;
                        MAKE_NOP(src);
-               } else if(opline->opcode == ZEND_QM_ASSIGN &&
-                                 ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                                 ZEND_RESULT_TYPE(opline) == IS_TMP_VAR &&
-                                 ZEND_OP1(opline).var == ZEND_RESULT(opline).var) {
+               } else if (opline->opcode == ZEND_QM_ASSIGN &&
+                                       ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                                       ZEND_RESULT_TYPE(opline) == IS_TMP_VAR &&
+                                       ZEND_OP1(opline).var == ZEND_RESULT(opline).var) {
                        /* strip T = QM_ASSIGN(T) */
                        MAKE_NOP(opline);
-               } else if(opline->opcode == ZEND_BOOL &&
-                                 ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
-                                 VAR_SOURCE(opline->op1) &&
-                                 (VAR_SOURCE(opline->op1)->opcode == ZEND_IS_EQUAL ||
-                                  VAR_SOURCE(opline->op1)->opcode == ZEND_IS_NOT_EQUAL ||
-                                  VAR_SOURCE(opline->op1)->opcode == ZEND_IS_SMALLER ||
-                                  VAR_SOURCE(opline->op1)->opcode == ZEND_IS_SMALLER_OR_EQUAL ||
-                                  VAR_SOURCE(opline->op1)->opcode == ZEND_BOOL ||
-                                  VAR_SOURCE(opline->op1)->opcode == ZEND_IS_IDENTICAL ||
-                                  VAR_SOURCE(opline->op1)->opcode == ZEND_IS_NOT_IDENTICAL ||
-                                  VAR_SOURCE(opline->op1)->opcode == ZEND_ISSET_ISEMPTY_VAR ||
-                                  VAR_SOURCE(opline->op1)->opcode == ZEND_ISSET_ISEMPTY_DIM_OBJ
-                                  ) && !used_ext[VAR_NUM(ZEND_OP1(opline).var)]
-                                 ) {
+               } else if (opline->opcode == ZEND_BOOL &&
+                                       ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+                                       VAR_SOURCE(opline->op1) &&
+                                       (VAR_SOURCE(opline->op1)->opcode == ZEND_IS_EQUAL ||
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_IS_NOT_EQUAL ||
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_IS_SMALLER ||
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_IS_SMALLER_OR_EQUAL ||
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_BOOL ||
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_IS_IDENTICAL ||
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_IS_NOT_IDENTICAL ||
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_ISSET_ISEMPTY_VAR ||
+                                       VAR_SOURCE(opline->op1)->opcode == ZEND_ISSET_ISEMPTY_DIM_OBJ) &&
+                                       !used_ext[VAR_NUM(ZEND_OP1(opline).var)]) {
                        /* T = IS_SMALLER(X, Y), T1 = BOOL(T) => T = IS_SMALLER(X, Y), T1 = QM_ASSIGN(T) */
                        zend_op *src = VAR_SOURCE(opline->op1);
                        COPY_NODE(src->result, opline->result);
@@ -1037,23 +1026,23 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                        MAKE_NOP(opline);
                }
                /* get variable source */
-               if(RESULT_USED(opline)) {
+               if (RESULT_USED(opline)) {
                        SET_VAR_SOURCE(opline);
                }
-               if(opline->opcode != ZEND_NOP) {
+               if (opline->opcode != ZEND_NOP) {
                        last_op = opline;
                }
                opline++;
        }
 
        /* remove leading NOPs */
-       while(block->start_opline->opcode == ZEND_NOP) {
-               if(block->len == 1) {
+       while (block->start_opline->opcode == ZEND_NOP) {
+               if (block->len == 1) {
                        /* this block is all NOPs, join with following block */
-                       if(block->follow_to) {
+                       if (block->follow_to) {
                                delete_code_block(block);
                        }
-                       if(op_array->T){
+                       if (op_array->T) {
                                efree(Tsource);
                        }
                        return;
@@ -1066,15 +1055,15 @@ 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;
-       while(opline<end) {
-               if(opline->opcode == ZEND_NOP) {
-                       zend_op *nop = opline+1;
+       while (opline < end) {
+               if (opline->opcode == ZEND_NOP) {
+                       zend_op *nop = opline + 1;
                        int noplen;
-                       while(nop<end && nop->opcode == ZEND_NOP) {
+                       while (nop < end && nop->opcode == ZEND_NOP) {
                                nop++;
                        }
                        noplen = nop-opline;
-                       if(nop<end) {
+                       if (nop < end) {
                                /* move up non-NOP opcodes */
                                memmove(opline, nop, (end-nop)*sizeof(zend_op));
                        } else {
@@ -1086,7 +1075,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
                opline++;
        }
 
-       if(op_array->T){
+       if (op_array->T) {
                efree(Tsource);
        }
 }
@@ -1099,18 +1088,18 @@ static void assemble_code_blocks(zend_code_block *blocks, zend_op_array *op_arra
        zend_code_block *cur_block = blocks;
 
        /* Copy code of reachable blocks into a single buffer */
-       while(cur_block) {
-               if(cur_block->access) {
+       while (cur_block) {
+               if (cur_block->access) {
                        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) {
+                               while (next && !next->access) {
                                        next = next->next;
                                }
-                               if(next && next == cur_block->op1_to) {
+                               if (next && next == cur_block->op1_to) {
                                        /* JMP to the next block - strip it */
                                        cur_block->follow_to = cur_block->op1_to;
                                        cur_block->op1_to = NULL;
@@ -1123,11 +1112,11 @@ static void assemble_code_blocks(zend_code_block *blocks, zend_op_array *op_arra
                        /* this block will not be used, delete all constants there */
                        zend_op *_opl;
                        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) {
+                       for (_opl = cur_block->start_opline; _opl && _opl < end; _opl++) {
+                               if (ZEND_OP1_TYPE(_opl) == IS_CONST) {
                                        literal_dtor(&ZEND_OP1_LITERAL(_opl));
                                }
-                               if(ZEND_OP2_TYPE(_opl) == IS_CONST) {
+                               if (ZEND_OP2_TYPE(_opl) == IS_CONST) {
                                        literal_dtor(&ZEND_OP2_LITERAL(_opl));
                                }
                        }
@@ -1135,7 +1124,7 @@ static void assemble_code_blocks(zend_code_block *blocks, zend_op_array *op_arra
                cur_block = cur_block->next;
        }
 #if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
-       if(opline[-1].opcode == ZEND_THROW) {
+       if (opline[-1].opcode == ZEND_THROW) {
                /* if we finished with THROW, we need to add space between THROW and HANDLE to not confuse
                   zend_throw_internal */
                MAKE_NOP(opline);
@@ -1151,9 +1140,9 @@ static void assemble_code_blocks(zend_code_block *blocks, zend_op_array *op_arra
        op_array->last = opline-new_opcodes;
 
        /* adjust exception jump targets */
-       if(op_array->last_try_catch) {
+       if (op_array->last_try_catch) {
                int i;
-               for(i=0; i< op_array->last_try_catch; i++) {
+               for (i=0; i< op_array->last_try_catch; i++) {
                        op_array->try_catch_array[i].try_op = blocks->try[i]->start_opline - new_opcodes;
                        op_array->try_catch_array[i].catch_op = blocks->catch[i]->start_opline - new_opcodes;
                }
@@ -1162,17 +1151,17 @@ static void assemble_code_blocks(zend_code_block *blocks, zend_op_array *op_arra
        }
 
     /* adjust jump targets */
-       for(cur_block = blocks; cur_block; cur_block = cur_block->next) {
-               if(!cur_block->access) {
+       for (cur_block = blocks; cur_block; cur_block = cur_block->next) {
+               if (!cur_block->access) {
                        continue;
                }
-               if(cur_block->op1_to) {
+               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;
                }
-               if(cur_block->op2_to) {
+               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;
                }
-               if(cur_block->ext_to) {
+               if (cur_block->ext_to) {
                        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 ");
@@ -1203,9 +1192,9 @@ static void assemble_code_blocks(zend_code_block *blocks, zend_op_array *op_arra
 static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_array, zend_code_block *blocks)
 {
        /* last_op is the last opcode of the current block */
-       zend_op *last_op = (block->start_opline+block->len-1);
+       zend_op *last_op = (block->start_opline + block->len - 1);
 
-       switch(last_op->opcode) {
+       switch (last_op->opcode) {
                case ZEND_JMP:
                        {
                                zend_op *target = block->op1_to->start_opline;
@@ -1217,26 +1206,26 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
                                }
 
                                /* JMP(next) -> NOP */
-                               if(block->op1_to == next) {
+                               if (block->op1_to == next) {
                                        block->follow_to = block->op1_to;
                                        block->op1_to = NULL;
                                        MAKE_NOP(last_op);
                                        block->len--;
-                                       if(block->len == 0) {
+                                       if (block->len == 0) {
                                                /* this block is nothing but NOP now */
                                                delete_code_block(block);
                                        }
                                        break;
                                }
 
-                               if(((target->opcode == ZEND_JMP &&
-                                    block->op1_to != block->op1_to->op1_to) ||
-                                   target->opcode == ZEND_JMPZNZ) &&
-                                  !block->op1_to->is_try) {
+                               if (((target->opcode == ZEND_JMP &&
+                                       block->op1_to != block->op1_to->op1_to) ||
+                                       target->opcode == ZEND_JMPZNZ) &&
+                                       !block->op1_to->is_try) {
                                        /* JMP L, L: JMP L1 -> JMP L1 */
                                        /* JMP L, L: JMPZNZ L1,L2 -> JMPZNZ L1,L2 */
                                        *last_op = *target;
-                                       if(ZEND_OP1_TYPE(last_op) == IS_CONST) {
+                                       if (ZEND_OP1_TYPE(last_op) == IS_CONST) {
                                                zval_copy_ctor(&ZEND_OP1_LITERAL(last_op));
                                        }
                                        del_source(block, block->op1_to);
@@ -1254,7 +1243,7 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
                                        } else {
                                                block->op1_to = NULL;
                                        }
-                               } else if(target->opcode == ZEND_RETURN ||
+                               } else if (target->opcode == ZEND_RETURN ||
 #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
                                          target->opcode == ZEND_RETURN_BY_REF ||
 #endif
@@ -1264,7 +1253,7 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
                                      target->opcode == ZEND_EXIT) {
                                        /* JMP L, L: RETURN to immediate RETURN */
                                        *last_op = *target;
-                                       if(ZEND_OP1_TYPE(last_op) == IS_CONST) {
+                                       if (ZEND_OP1_TYPE(last_op) == IS_CONST) {
                                                zval_copy_ctor(&ZEND_OP1_LITERAL(last_op));
                                        }
                                        del_source(block, block->op1_to);
@@ -1330,7 +1319,7 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
                case ZEND_JMPZ:
                case ZEND_JMPNZ:
                        /* constant conditional JMPs */
-                       if(ZEND_OP1_TYPE(last_op) == IS_CONST) {
+                       if (ZEND_OP1_TYPE(last_op) == IS_CONST) {
                                int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op));
                                if (last_op->opcode == ZEND_JMPZ) {
                                        should_jmp = !should_jmp;
@@ -1354,7 +1343,7 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
                                break;
                        }
 
-                       if(block->op2_to) {
+                       if (block->op2_to) {
                                zend_uchar same_type = ZEND_OP1_TYPE(last_op);
                                zend_uint same_var = VAR_NUM_EX(last_op->op1);
                                zend_op *target;
@@ -1364,17 +1353,16 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
 next_target:
                                target = target_block->start_opline;
                                target_end = target_block->start_opline + target_block->len;
-                               while(target < target_end && target->opcode == ZEND_NOP) {
+                               while (target < target_end && target->opcode == ZEND_NOP) {
                                        target++;
                                }
 
                                /* next block is only NOP's */
-                               if(target == target_end) {
+                               if (target == target_end) {
                                        target_block = target_block->follow_to;
                                        goto next_target;
-                               } else
-                               /* JMPZ(X, L), L: JMPNZ(X, L2) -> JMPZ(X, L+1) */
-                               if(target->opcode == INV_COND(last_op->opcode) &&
+                               } else if (target->opcode == INV_COND(last_op->opcode) &&
+                                       /* JMPZ(X, L), L: JMPNZ(X, L2) -> JMPZ(X, L+1) */
                                   (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
                                   same_type == ZEND_OP1_TYPE(target) &&
                                   same_var == VAR_NUM_EX(target->op1) &&
@@ -1384,51 +1372,43 @@ next_target:
                                        del_source(block, block->op2_to);
                                        block->op2_to = target_block->follow_to;
                                        ADD_SOURCE(block, block->op2_to);
-                               }
-                               /* JMPZ(X, L), L: X = JMPNZ_EX(X, L2) -> JMPZ(X, L+1) */
-                               else if(target->opcode == INV_COND_EX(last_op->opcode) &&
-                                       (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
-                                   same_type == ZEND_OP1_TYPE(target) &&
-                                   same_var == VAR_NUM_EX(target->op1) &&
-                                       target_block->follow_to &&
-                                       !target_block->is_try
-                                       ) {
+                               } else if (target->opcode == INV_COND_EX(last_op->opcode) &&
+                                                       (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
+                                               same_type == ZEND_OP1_TYPE(target) &&
+                                               same_var == VAR_NUM_EX(target->op1) &&
+                                                       target_block->follow_to &&
+                                                       !target_block->is_try) {
+                                       /* JMPZ(X, L), L: X = JMPNZ_EX(X, L2) -> JMPZ(X, L+1) */
                                        last_op->opcode += 3;
                                        last_op->result = target->result;
                                        del_source(block, block->op2_to);
                                        block->op2_to = target_block->follow_to;
                                        ADD_SOURCE(block, block->op2_to);
-                               }
-                               /* JMPZ(X, L), L: JMPZ(X, L2) -> JMPZ(X, L2) */
-                               else if(target_block->op2_to &&
-                                  target->opcode == last_op->opcode &&
-                                  (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
-                                  same_type == ZEND_OP1_TYPE(target) &&
-                                  same_var == VAR_NUM_EX(target->op1) &&
-                                  !target_block->is_try
-                                  ) {
+                               } else if (target_block->op2_to &&
+                                                  target->opcode == last_op->opcode &&
+                                                  (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
+                                                  same_type == ZEND_OP1_TYPE(target) &&
+                                                  same_var == VAR_NUM_EX(target->op1) &&
+                                                  !target_block->is_try) {
+                                       /* JMPZ(X, L), L: JMPZ(X, L2) -> JMPZ(X, L2) */
                                        del_source(block, block->op2_to);
                                        block->op2_to = target_block->op2_to;
                                        ADD_SOURCE(block, block->op2_to);
-                               }
-                               /* JMPZ(X, L), L: JMP(L2) -> JMPZ(X, L2) */
-                               else if(target_block->op1_to &&
-                                       target->opcode == ZEND_JMP &&
-                                       !target_block->is_try
-                                       ) {
+                               } else if (target_block->op1_to &&
+                                                       target->opcode == ZEND_JMP &&
+                                                       !target_block->is_try) {
+                                       /* JMPZ(X, L), L: JMP(L2) -> JMPZ(X, L2) */
                                        del_source(block, block->op2_to);
                                        block->op2_to = target_block->op1_to;
                                        ADD_SOURCE(block, block->op2_to);
-                               }
-                               /* JMPZ(X, L), L: JMPZNZ(X, L2, L3) -> JMPZ(X, L2) */
-                               else if(target_block->op2_to &&
-                                               target_block->ext_to &&
-                                               target->opcode == ZEND_JMPZNZ &&
-                                               (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
-                                       same_type == ZEND_OP1_TYPE(target) &&
-                                       same_var == VAR_NUM_EX(target->op1) &&
-                                               ! target_block->is_try
-                                               ) {
+                               } else if (target_block->op2_to &&
+                                                       target_block->ext_to &&
+                                                       target->opcode == ZEND_JMPZNZ &&
+                                                       (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
+                                               same_type == ZEND_OP1_TYPE(target) &&
+                                               same_var == VAR_NUM_EX(target->op1) &&
+                                                       !target_block->is_try) {
+                                       /* JMPZ(X, L), L: JMPZNZ(X, L2, L3) -> JMPZ(X, L2) */
                                        del_source(block, block->op2_to);
                                        if (last_op->opcode == ZEND_JMPZ) {
                                                block->op2_to = target_block->op2_to;
@@ -1452,7 +1432,7 @@ next_target:
                                        }
 
                                        /* next block is only NOP's */
-                                       if(target == target_end) {
+                                       if (target == target_end) {
                                                del_source(block, block->follow_to);
                                                block->follow_to = block->follow_to->follow_to;
                                                ADD_SOURCE(block, block->follow_to);
@@ -1482,7 +1462,7 @@ next_target:
                case ZEND_JMPNZ_EX:
                case ZEND_JMPZ_EX:
                        /* constant conditional JMPs */
-                       if(ZEND_OP1_TYPE(last_op) == IS_CONST) {
+                       if (ZEND_OP1_TYPE(last_op) == IS_CONST) {
                                int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op));
                                if (last_op->opcode == ZEND_JMPZ_EX) {
                                        should_jmp = !should_jmp;
@@ -1499,21 +1479,21 @@ next_target:
                                break;
                        }
 
-                       if(block->op2_to) {
+                       if (block->op2_to) {
                                zend_op *target, *target_end;
                                char *same_t=NULL;
                                zend_code_block *target_block;
                                int var_num = 0;
-                               if(op_array->T >= (zend_uint)op_array->last_var){
+                               if (op_array->T >= (zend_uint)op_array->last_var) {
                                        var_num = op_array->T;
                                } else {
                                        var_num = op_array->last_var;
                                }
-                               if( var_num <= 0 ) {
+                               if (var_num <= 0) {
                                        return;
                                }
                                same_t = ecalloc(var_num, sizeof(char));
-                               if(same_t == NULL){
+                               if (same_t == NULL) {
                                        return;
                                }
                                same_t[VAR_NUM_EX(last_op->op1)] |= ZEND_OP1_TYPE(last_op);
@@ -1522,69 +1502,65 @@ next_target:
 next_target_ex:
                                target = target_block->start_opline;
                                target_end = target_block->start_opline + target_block->len;
-                               while(target < target_end && target->opcode == ZEND_NOP) {
+                               while (target < target_end && target->opcode == ZEND_NOP) {
                                        target++;
                                }
                                /* next block is only NOP's */
-                               if(target == target_end) {
+                               if (target == target_end) {
                                        target_block = target_block->follow_to;
                                        goto next_target_ex;
-                               } else
-               /* T = JMPZ_EX(X, L1), L1: JMPZ({X|T}, L2) -> T = JMPZ_EX(X, L2) */
-                               if(target_block->op2_to &&
-                                  target->opcode == last_op->opcode-3 &&
-                                  (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
-                                  (same_t[VAR_NUM_EX(target->op1)] & ZEND_OP1_TYPE(target)) != 0 &&
-                                  !target_block->is_try
-                                  ) {
+                               } else if (target_block->op2_to &&
+                                                  target->opcode == last_op->opcode-3 &&
+                                                  (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
+                                                  (same_t[VAR_NUM_EX(target->op1)] & ZEND_OP1_TYPE(target)) != 0 &&
+                                                  !target_block->is_try) {
+                                       /* T = JMPZ_EX(X, L1), L1: JMPZ({X|T}, L2) -> T = JMPZ_EX(X, L2) */
                                        del_source(block, block->op2_to);
                                        block->op2_to = target_block->op2_to;
                                        ADD_SOURCE(block, block->op2_to);
+                               } else if (target_block->op2_to &&
+                                                  target->opcode == INV_EX_COND(last_op->opcode) &&
+                                                  (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
+                                                  (same_t[VAR_NUM_EX(target->op1)] & ZEND_OP1_TYPE(target)) != 0 &&
+                                                  !target_block->is_try) {
                                        /* T = JMPZ_EX(X, L1), L1: JMPNZ({X|T1}, L2) -> T = JMPZ_EX(X, L1+1) */
-                               } else if(target_block->op2_to &&
-                                                 target->opcode == INV_EX_COND(last_op->opcode) &&
-                                           (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
-                                                 (same_t[VAR_NUM_EX(target->op1)] & ZEND_OP1_TYPE(target)) != 0 &&
-                                                 !target_block->is_try
-                                                 ) {
                                        del_source(block, block->op2_to);
                                        block->op2_to = target_block->follow_to;
                                        ADD_SOURCE(block, block->op2_to);
+                               } else if (target_block->op2_to &&
+                                                  target->opcode == INV_EX_COND_EX(last_op->opcode) &&
+                                              (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
+                                                  (same_t[VAR_NUM_EX(target->op1)] & ZEND_OP1_TYPE(target)) != 0 &&
+                                                  (same_t[VAR_NUM_EX(target->result)] & ZEND_RESULT_TYPE(target)) != 0 &&
+                                                  !target_block->is_try) {
                                        /* T = JMPZ_EX(X, L1), L1: T = JMPNZ_EX(T, L2) -> T = JMPZ_EX(X, L1+1) */
-                               } else if(target_block->op2_to &&
-                                                 target->opcode == INV_EX_COND_EX(last_op->opcode) &&
-                                           (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
-                                                 (same_t[VAR_NUM_EX(target->op1)] & ZEND_OP1_TYPE(target)) != 0 &&
-                                                 (same_t[VAR_NUM_EX(target->result)] & ZEND_RESULT_TYPE(target)) != 0 &&
-                                                 !target_block->is_try) {
                                        del_source(block, block->op2_to);
                                        block->op2_to = target_block->follow_to;
                                        ADD_SOURCE(block, block->op2_to);
-                               /* T = JMPZ_EX(X, L1), L1: T = JMPZ({X|T}, L2) -> T = JMPZ_EX(X, L2) */
-                               } else if(target_block->op2_to &&
-                                                 target->opcode == last_op->opcode &&
-                                           (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
-                                                 (same_t[VAR_NUM_EX(target->op1)] & ZEND_OP1_TYPE(target)) != 0 &&
-                                                 (same_t[VAR_NUM_EX(target->result)] & ZEND_RESULT_TYPE(target)) != 0 &&
-                                                 !target_block->is_try) {
+                               } else if (target_block->op2_to &&
+                                                  target->opcode == last_op->opcode &&
+                                                  (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
+                                                  (same_t[VAR_NUM_EX(target->op1)] & ZEND_OP1_TYPE(target)) != 0 &&
+                                                  (same_t[VAR_NUM_EX(target->result)] & ZEND_RESULT_TYPE(target)) != 0 &&
+                                                  !target_block->is_try) {
+                                       /* T = JMPZ_EX(X, L1), L1: T = JMPZ({X|T}, L2) -> T = JMPZ_EX(X, L2) */
                                        del_source(block, block->op2_to);
                                        block->op2_to = target_block->op2_to;
                                        ADD_SOURCE(block, block->op2_to);
-                               /* T = JMPZ_EX(X, L), L: JMP(L2) -> T = JMPZ(X, L2) */
-                               } else if(target_block->op1_to &&
-                                       target->opcode == ZEND_JMP &&
-                                       !target_block->is_try) {
+                               } else if (target_block->op1_to &&
+                                                  target->opcode == ZEND_JMP &&
+                                                  !target_block->is_try) {
+                                       /* T = JMPZ_EX(X, L), L: JMP(L2) -> T = JMPZ(X, L2) */
                                        del_source(block, block->op2_to);
                                        block->op2_to = target_block->op1_to;
                                        ADD_SOURCE(block, block->op2_to);
-                               /* T = JMPZ_EX(X, L), L: JMPZNZ({X|T}, L2, L3) -> T = JMPZ_EX(X, L2) */
-                               } else if(target_block->op2_to &&
-                                                 target_block->ext_to &&
-                                                 target->opcode == ZEND_JMPZNZ &&
-                                                 (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
-                                                 (same_t[VAR_NUM_EX(target->op1)] & ZEND_OP1_TYPE(target)) != 0 &&
-                                                 !target_block->is_try
-                                                 ) {
+                               } else if (target_block->op2_to &&
+                                                  target_block->ext_to &&
+                                                  target->opcode == ZEND_JMPZNZ &&
+                                                  (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
+                                                  (same_t[VAR_NUM_EX(target->op1)] & ZEND_OP1_TYPE(target)) != 0 &&
+                                                  !target_block->is_try) {
+                                       /* T = JMPZ_EX(X, L), L: JMPZNZ({X|T}, L2, L3) -> T = JMPZ_EX(X, L2) */
                                        del_source(block, block->op2_to);
                                        if (last_op->opcode == ZEND_JMPZ_EX) {
                                                block->op2_to = target_block->op2_to;
@@ -1593,7 +1569,7 @@ next_target_ex:
                                        }
                                        ADD_SOURCE(block, block->op2_to);
                                }
-                               if(same_t != NULL){
+                               if (same_t != NULL) {
                                        efree(same_t);
                                }
                        }
@@ -1607,11 +1583,11 @@ next_target_ex:
                                next = next->next;
                        }
 
-                       if(ZEND_OP1_TYPE(last_op) == IS_CONST) {
+                       if (ZEND_OP1_TYPE(last_op) == IS_CONST) {
                                if (!zend_is_true(&ZEND_OP1_LITERAL(last_op))) {
                                        /* JMPZNZ(false,L1,L2) -> JMP(L1) */
                                        zend_code_block *todel;
-                                       
+
                                        literal_dtor(&ZEND_OP1_LITERAL(last_op));
                                        last_op->opcode = ZEND_JMP;
                                        SET_UNUSED(last_op->op1);
@@ -1624,7 +1600,7 @@ next_target_ex:
                                } else {
                                        /* JMPZNZ(true,L1,L2) -> JMP(L2) */
                                        zend_code_block *todel;
-                  
+
                                        literal_dtor(&ZEND_OP1_LITERAL(last_op));
                                        last_op->opcode = ZEND_JMP;
                                        SET_UNUSED(last_op->op1);
@@ -1661,7 +1637,7 @@ next_target_ex:
                                /* no need to add source - it's block->ext_to */
                        }
 
-                       if(last_op->opcode == ZEND_JMPZNZ && block->op2_to) {
+                       if (last_op->opcode == ZEND_JMPZNZ && block->op2_to) {
                                zend_uchar same_type = ZEND_OP1_TYPE(last_op);
                                zend_uchar same_var = VAR_NUM_EX(last_op->op1);
                                zend_op *target;
@@ -1671,39 +1647,37 @@ next_target_ex:
 next_target_znz:
                                target = target_block->start_opline;
                                target_end = target_block->start_opline + target_block->len;
-                               while(target < target_end && target->opcode == ZEND_NOP) {
+                               while (target < target_end && target->opcode == ZEND_NOP) {
                                        target++;
                                }
                                /* next block is only NOP's */
-                               if(target == target_end) {
+                               if (target == target_end) {
                                        target_block = target_block->follow_to;
                                        goto next_target_znz;
-                               /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
-                               } else if(target_block->op2_to &&
-                                                 (target->opcode == ZEND_JMPZ || target->opcode == ZEND_JMPZNZ) &&
-                                                 (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
-                                                 same_type == ZEND_OP1_TYPE(target) &&
-                                                 same_var == VAR_NUM_EX(target->op1) &&
-                                                 !target_block->is_try) {
+                               } else if (target_block->op2_to &&
+                                                  (target->opcode == ZEND_JMPZ || target->opcode == ZEND_JMPZNZ) &&
+                                                  (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
+                                                  same_type == ZEND_OP1_TYPE(target) &&
+                                                  same_var == VAR_NUM_EX(target->op1) &&
+                                                  !target_block->is_try) {
+                                   /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
                                        del_source(block, block->op2_to);
                                        block->op2_to = target_block->op2_to;
                                        ADD_SOURCE(block, block->op2_to);
-                               }
-                               /* JMPZNZ(X, L1, L2), L1: X = JMPNZ(X, L3) -> JMPZNZ(X, L1+1, L2) */
-                               else if(target->opcode == ZEND_JMPNZ &&
-                                               (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
-                                               same_type == ZEND_OP1_TYPE(target) &&
-                                               same_var == VAR_NUM_EX(target->op1) &&
-                                               target_block->follow_to &&
-                                               !target_block->is_try) {
+                               } else if (target->opcode == ZEND_JMPNZ &&
+                                                  (ZEND_OP1_TYPE(target) & (IS_TMP_VAR|IS_CV)) &&
+                                                  same_type == ZEND_OP1_TYPE(target) &&
+                                                  same_var == VAR_NUM_EX(target->op1) &&
+                                                  target_block->follow_to &&
+                                                  !target_block->is_try) {
+                    /* JMPZNZ(X, L1, L2), L1: X = JMPNZ(X, L3) -> JMPZNZ(X, L1+1, L2) */
                                        del_source(block, block->op2_to);
                                        block->op2_to = target_block->follow_to;
                                        ADD_SOURCE(block, block->op2_to);
-                               }
-                               /* JMPZNZ(X, L1, L2), L1: JMP(L3) -> JMPZNZ(X, L3, L2) */
-                               else if(target_block->op1_to &&
-                                       target->opcode == ZEND_JMP &&
-                                       !target_block->is_try) {
+                               } else if (target_block->op1_to &&
+                                              target->opcode == ZEND_JMP &&
+                                              !target_block->is_try) {
+                    /* JMPZNZ(X, L1, L2), L1: JMP(L3) -> JMPZNZ(X, L3, L2) */
                                        del_source(block, block->op2_to);
                                        block->op2_to = target_block->op1_to;
                                        ADD_SOURCE(block, block->op2_to);
@@ -1719,7 +1693,7 @@ next_target_znz:
 #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
 
 # define T_USAGE(op) do { \
-               if((op ## _type & (IS_VAR | IS_TMP_VAR)) && \
+               if ((op ## _type & (IS_VAR | IS_TMP_VAR)) && \
                   !defined_here[VAR_NUM(op.var)] && !used_ext[VAR_NUM(op.var)]) {      \
                        used_ext[VAR_NUM(op.var)] = 1;                                                                  \
                } \
@@ -1731,7 +1705,7 @@ next_target_znz:
 #else
 
 # define T_USAGE(op) do { \
-               if((op.op_type == IS_VAR || op.op_type == IS_TMP_VAR) && \
+               if ((op.op_type == IS_VAR || op.op_type == IS_TMP_VAR) && \
                   !defined_here[VAR_NUM(op.u.var)] && !used_ext[VAR_NUM(op.u.var)]) {  \
                        used_ext[VAR_NUM(op.u.var)] = 1;                                                                        \
                } \
@@ -1750,7 +1724,7 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char *
        char *usage;
        char *defined_here;
 
-       if(op_array->T == 0) {
+       if (op_array->T == 0) {
                /* shortcut - if no Ts, nothing to do */
                return;
        }
@@ -1758,23 +1732,23 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char *
        usage = ecalloc(op_array->T, 1);
        defined_here = emalloc(op_array->T);
 
-       while(next_block) {
+       while (next_block) {
                zend_op *opline = next_block->start_opline;
                zend_op *end = opline+next_block->len;
 
-               if(!next_block->access) {
+               if (!next_block->access) {
                        next_block = next_block->next;
                        continue;
                }
                memset(defined_here, 0, op_array->T);
 
-               while(opline<end) {
+               while (opline<end) {
                        T_USAGE(opline->op1);
                        T_USAGE(opline->op2);
 
-                       if(RESULT_USED(opline)) {
-                               if(!defined_here[VAR_NUM(ZEND_RESULT(opline).var)] && !used_ext[VAR_NUM(ZEND_RESULT(opline).var)] &&
-                                  (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT ||
+                       if (RESULT_USED(opline)) {
+                               if (!defined_here[VAR_NUM(ZEND_RESULT(opline).var)] && !used_ext[VAR_NUM(ZEND_RESULT(opline).var)] &&
+                                   (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT ||
                                        (opline->opcode == ZEND_OP_DATA && ZEND_RESULT_TYPE(opline) == IS_TMP_VAR) ||
                                        opline->opcode == ZEND_ADD_ARRAY_ELEMENT)) {
                                        /* these opcodes use the result as argument */
@@ -1790,26 +1764,26 @@ 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++) {
-                       fprintf(stderr, "T%d: %c\n", i, used_ext[i]+'0');
+               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;
+       while (block) {
+               zend_op *opline = block->start_opline+block->len - 1;
 
-               if(!block->access) {
+               if (!block->access) {
                        block = block->next;
                        continue;
                }
 
                memcpy(usage, used_ext, op_array->T);
 
-               while(opline>=block->start_opline) {
+               while (opline >= block->start_opline) {
                        /* usage checks */
-                       if(RES_NEVER_USED(opline)) {
-                               switch(opline->opcode) {
+                       if (RES_NEVER_USED(opline)) {
+                               switch (opline->opcode) {
                                        case ZEND_ASSIGN_ADD:
                                        case ZEND_ASSIGN_SUB:
                                        case ZEND_ASSIGN_MUL:
@@ -1829,7 +1803,7 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char *
                                        case ZEND_ASSIGN_REF:
                                        case ZEND_DO_FCALL:
                                        case ZEND_DO_FCALL_BY_NAME:
-                                               if(ZEND_RESULT_TYPE(opline) == IS_VAR) {
+                                               if (ZEND_RESULT_TYPE(opline) == IS_VAR) {
 #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
                                                        ZEND_RESULT_TYPE(opline) |= EXT_TYPE_UNUSED;
 #else
@@ -1840,7 +1814,7 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char *
                                        case ZEND_QM_ASSIGN:
                                        case ZEND_BOOL:
                                        case ZEND_BOOL_NOT:
-                                               if(ZEND_OP1_TYPE(opline) == IS_CONST) {
+                                               if (ZEND_OP1_TYPE(opline) == IS_CONST) {
                                                        literal_dtor(&ZEND_OP1_LITERAL(opline));
                                                }
                                                MAKE_NOP(opline);
@@ -1857,35 +1831,36 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char *
                                }
                        }
 
-                       if(opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT ||
-                          opline->opcode == ZEND_ADD_ARRAY_ELEMENT) {
-                               if(ZEND_OP1_TYPE(opline) == IS_VAR || ZEND_OP1_TYPE(opline) == IS_TMP_VAR) {
+                       if (opline->opcode == ZEND_RECV ||
+                opline->opcode == ZEND_RECV_INIT ||
+                opline->opcode == ZEND_ADD_ARRAY_ELEMENT) {
+                               if (ZEND_OP1_TYPE(opline) == IS_VAR || ZEND_OP1_TYPE(opline) == IS_TMP_VAR) {
                                        usage[VAR_NUM(ZEND_RESULT(opline).var)] = 1;
                                }
                        } else {
-                               if(RESULT_USED(opline)) {
+                               if (RESULT_USED(opline)) {
                                        usage[VAR_NUM(ZEND_RESULT(opline).var)] = 0;
                                }
                        }
 
-                       if(ZEND_OP1_TYPE(opline) == IS_VAR || ZEND_OP1_TYPE(opline) == IS_TMP_VAR) {
+                       if (ZEND_OP1_TYPE(opline) == IS_VAR || ZEND_OP1_TYPE(opline) == IS_TMP_VAR) {
                                usage[VAR_NUM(ZEND_OP1(opline).var)] = 1;
                        }
-                       if(ZEND_OP2_TYPE(opline) == IS_VAR || ZEND_OP2_TYPE(opline) == IS_TMP_VAR) {
+                       if (ZEND_OP2_TYPE(opline) == IS_VAR || ZEND_OP2_TYPE(opline) == IS_TMP_VAR) {
                                usage[VAR_NUM(ZEND_OP2(opline).var)] = 1;
                        }
 
 
 #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
-                       if((ZEND_RESULT_TYPE(opline) & IS_VAR) &&
-                          (ZEND_RESULT_TYPE(opline) & EXT_TYPE_UNUSED) &&
-                          usage[VAR_NUM(ZEND_RESULT(opline).var)]) {
+                       if ((ZEND_RESULT_TYPE(opline) & IS_VAR) &&
+                (ZEND_RESULT_TYPE(opline) & EXT_TYPE_UNUSED) &&
+                usage[VAR_NUM(ZEND_RESULT(opline).var)]) {
                                ZEND_RESULT_TYPE(opline) &= ~EXT_TYPE_UNUSED;
                        }
 #else
-                       if(ZEND_RESULT_TYPE(opline) == IS_VAR &&
-                          usage[VAR_NUM(ZEND_RESULT(opline).var)] &&
-                          (ZEND_RESULT(opline).EA.type & EXT_TYPE_UNUSED) != 0) {
+                       if (ZEND_RESULT_TYPE(opline) == IS_VAR &&
+                           usage[VAR_NUM(ZEND_RESULT(opline).var)] &&
+                           (ZEND_RESULT(opline).EA.type & EXT_TYPE_UNUSED) != 0) {
                                ZEND_RESULT(opline).EA.type &= ~EXT_TYPE_UNUSED;
                        }
 #endif
@@ -1894,6 +1869,7 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char *
                }
                block = block->next;
        } /* end blocks */
+
        efree(defined_here);
        efree(usage);
 }
@@ -1907,7 +1883,7 @@ static void zend_block_optimization(zend_op_array *op_array TSRMLS_DC)
        char *usage;
 
 #if DEBUG_BLOCKPASS
-       fprintf(stderr, "File %s func %s\n", op_array->filename, op_array->function_name?op_array->function_name:"main");
+       fprintf(stderr, "File %s func %s\n", op_array->filename, op_array->function_name? op_array->function_name : "main");
        fflush(stderr);
 #endif
 
@@ -1919,29 +1895,29 @@ static void zend_block_optimization(zend_op_array *op_array TSRMLS_DC)
 
     /* Build CFG */
        blocks = find_code_blocks(op_array);
-       if(!blocks) {
+       if (!blocks) {
                return;
        }
 
        zend_rebuild_access_path(blocks, op_array, 0);
        /* full rebuild here to produce correct sources! */
        usage = emalloc(op_array->T);
-       for(pass=0; pass< PASSES; pass++) {
+       for (pass = 0; pass < PASSES; pass++) {
                /* Compute data dependencies */
                memset(usage, 0, op_array->T);
                zend_t_usage(blocks, op_array, usage);
 
                /* optimize each basic block separately */
-               for(cur_block = blocks; cur_block; cur_block = cur_block->next) {
-                       if(!cur_block->access) {
+               for (cur_block = blocks; cur_block; cur_block = cur_block->next) {
+                       if (!cur_block->access) {
                                continue;
                        }
                        zend_optimize_block(cur_block, op_array, usage TSRMLS_CC);
                }
 
                /* Jump optimization for each block */
-               for(cur_block = blocks; cur_block; cur_block = cur_block->next) {
-                       if(!cur_block->access) {
+               for (cur_block = blocks; cur_block; cur_block = cur_block->next) {
+                       if (!cur_block->access) {
                                continue;
                        }
                        zend_jmp_optimization(cur_block, op_array, blocks);
@@ -1955,9 +1931,9 @@ static void zend_block_optimization(zend_op_array *op_array TSRMLS_DC)
        efree(usage);
 
        /* Destroy CFG */
-       for(cur_block = blocks; cur_block; cur_block = cur_block->next) {
+       for (cur_block = blocks; cur_block; cur_block = cur_block->next) {
                zend_block_source *cs = cur_block->sources;
-               while(cs) {
+               while (cs) {
                        zend_block_source *n = cs->next;
                        efree(cs);
                        cs = n;
index 6c22bcf6fd5a4c4207c12cf90b2530075acd4de6..ccac6f4540ae01a6cd45eb3cdc477f59a013579c 100644 (file)
@@ -92,14 +92,14 @@ static void nop_removal(zend_op_array *op_array)
                }
 
                /* update brk/cont array */
-               for (j=0; j<op_array->last_brk_cont; j++) {
+               for (j = 0; j < op_array->last_brk_cont; j++) {
                        op_array->brk_cont_array[j].brk -= shiftlist[op_array->brk_cont_array[j].brk];
                        op_array->brk_cont_array[j].cont -= shiftlist[op_array->brk_cont_array[j].cont];
                        op_array->brk_cont_array[j].start -= shiftlist[op_array->brk_cont_array[j].start];
                }
 
                /* update try/catch array */
-               for (j=0; j<op_array->last_try_catch; j++) {
+               for (j = 0; j < op_array->last_try_catch; j++) {
                        op_array->try_catch_array[j].try_op -= shiftlist[op_array->try_catch_array[j].try_op];
                        op_array->try_catch_array[j].catch_op -= shiftlist[op_array->try_catch_array[j].catch_op];
 #if ZEND_EXTENSION_API_NO > PHP_5_4_X_API_NO
index 4e2865ead441af2d6563dc54f092621f6d620d5d..7cf43bf11e8f55f1de0cc70d93e318099299602a 100644 (file)
@@ -60,7 +60,7 @@ static const char op_const_means_class[256]  = {
 #endif
 
 #define GET_AVAILABLE_T()              \
-       for (i=0; i<T; i++) {           \
+       for (i = 0; i < T; i++) {       \
                if (!taken_T[i]) {              \
                        break;                          \
                }                                               \
@@ -129,7 +129,7 @@ static void optimize_temporary_variables(zend_op_array *op_array)
                }
 
                /* Skip OP_DATA */
-               if (opline->opcode == ZEND_OP_DATA && 
+               if (opline->opcode == ZEND_OP_DATA &&
                    (opline-1)->opcode == ZEND_ASSIGN_DIM) {
                    opline--;
                    continue;
@@ -218,5 +218,5 @@ static void optimize_temporary_variables(zend_op_array *op_array)
        efree(start_of_T);
        efree(valid_T);
        efree(map_T);
-       op_array->T = max+1;
+       op_array->T = max + 1;
 }
index 247b1b8632ffd1f272c336ee86bac1c67dd0ffe7..65e934efcdfa6a67ce1ba7b2483354fc43911e2d 100644 (file)
@@ -7,11 +7,11 @@
  */
 
 if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
-       int i=0;
+       int i = 0;
        zend_op *opline = op_array->opcodes;
        zend_op *end = opline + op_array->last;
 
-       while (opline<end) {
+       while (opline < end) {
                switch (opline->opcode) {
                case ZEND_ADD:
                case ZEND_SUB:
@@ -31,18 +31,18 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                case ZEND_BW_AND:
                case ZEND_BW_XOR:
                case ZEND_BOOL_XOR:
-                       if (ZEND_OP1_TYPE(opline)==IS_CONST
-                               && ZEND_OP2_TYPE(opline)==IS_CONST) {
-                               /* binary operation wheit constant operands */
+                       if (ZEND_OP1_TYPE(opline) == IS_CONST &&
+                               ZEND_OP2_TYPE(opline) == IS_CONST) {
+                               /* binary operation with constant operands */
                                int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) = get_binary_op(opline->opcode);
                                zend_uint tv = ZEND_RESULT(opline).var;         /* temporary variable */
                                zval result;
                                zend_op *tmp_opline;
                                int er;
 
-                               if (opline->opcode == ZEND_DIV && 
-                                   Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_LONG &&
-                                   Z_LVAL(ZEND_OP2_LITERAL(opline)) == 0) {
+                               if (opline->opcode == ZEND_DIV &&
+                                       Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_LONG &&
+                                       Z_LVAL(ZEND_OP2_LITERAL(opline)) == 0) {
                                        /* div by 0 */
                                        break;
                                }
@@ -62,10 +62,10 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                                MAKE_NOP(opline);
 
                                /* substitute the following TMP_VAR usage with constant */
-                               for (tmp_opline=opline+1; tmp_opline<end; tmp_opline++) {
-                                       if (ZEND_OP1_TYPE(tmp_opline)== IS_TMP_VAR
-                                               && ZEND_OP1(tmp_opline).var == tv) {
-                                               if (tmp_opline->opcode==ZEND_FREE) {
+                               for (tmp_opline = opline + 1; tmp_opline < end; tmp_opline++) {
+                                       if (ZEND_OP1_TYPE(tmp_opline) == IS_TMP_VAR &&
+                                               ZEND_OP1(tmp_opline).var == tv) {
+                                               if (tmp_opline->opcode == ZEND_FREE) {
                                                        MAKE_NOP(tmp_opline);
                                                        zval_dtor(&result);
                                                } else {
@@ -73,11 +73,11 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
 #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
                                                        tmp_opline->op1.constant = zend_add_literal(op_array, &result TSRMLS_CC);
                                                        if (Z_TYPE(result) == IS_STRING) {
-                                                               Z_HASH_P(&ZEND_OP1_LITERAL(tmp_opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(tmp_opline)), Z_STRLEN(ZEND_OP1_LITERAL(tmp_opline))+1);
+                                                               Z_HASH_P(&ZEND_OP1_LITERAL(tmp_opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(tmp_opline)), Z_STRLEN(ZEND_OP1_LITERAL(tmp_opline)) + 1);
                                                                if (tmp_opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
-                                                                   tmp_opline->opcode == ZEND_DO_FCALL ||
-                                                                   tmp_opline->opcode == ZEND_CATCH ||
-                                                                   tmp_opline->opcode == ZEND_FETCH_CONSTANT) {
+                                                                       tmp_opline->opcode == ZEND_DO_FCALL ||
+                                                                       tmp_opline->opcode == ZEND_CATCH ||
+                                                                       tmp_opline->opcode == ZEND_FETCH_CONSTANT) {
                                                                        op_array->literals[tmp_opline->op1.constant].cache_slot = op_array->last_cache_slot++;
                                                                }
                                                        }
@@ -88,56 +88,56 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                                                /* TMP_VAR my be used only once */
                                                break;
                                        }
-                                       if (ZEND_OP2_TYPE(tmp_opline)== IS_TMP_VAR
-                                               && ZEND_OP2(tmp_opline).var == tv) {
+                                       if (ZEND_OP2_TYPE(tmp_opline) == IS_TMP_VAR &&
+                                               ZEND_OP2(tmp_opline).var == tv) {
                                                ZEND_OP2_TYPE(tmp_opline) = IS_CONST;
 #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
                                                tmp_opline->op2.constant = zend_add_literal(op_array, &result TSRMLS_CC);
                                                if (Z_TYPE(result) == IS_STRING) {
-                                                       Z_HASH_P(&ZEND_OP2_LITERAL(tmp_opline)) = zend_hash_func(Z_STRVAL(ZEND_OP2_LITERAL(tmp_opline)), Z_STRLEN(ZEND_OP2_LITERAL(tmp_opline))+1);
+                                                       Z_HASH_P(&ZEND_OP2_LITERAL(tmp_opline)) = zend_hash_func(Z_STRVAL(ZEND_OP2_LITERAL(tmp_opline)), Z_STRLEN(ZEND_OP2_LITERAL(tmp_opline)) + 1);
                                                        if (tmp_opline->opcode == ZEND_FETCH_R ||
-                                                           tmp_opline->opcode == ZEND_FETCH_W ||
-                                                           tmp_opline->opcode == ZEND_FETCH_RW ||
-                                                           tmp_opline->opcode == ZEND_FETCH_IS ||
-                                                           tmp_opline->opcode == ZEND_FETCH_UNSET ||
-                                                           tmp_opline->opcode == ZEND_FETCH_FUNC_ARG ||
-                                                           tmp_opline->opcode == ZEND_FETCH_CLASS ||
-                                                           tmp_opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
-                                                           tmp_opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
-                                                           tmp_opline->opcode == ZEND_UNSET_VAR ||
-                                                           tmp_opline->opcode == ZEND_ISSET_ISEMPTY_VAR ||
-                                                           tmp_opline->opcode == ZEND_ADD_INTERFACE ||
-                                                           tmp_opline->opcode == ZEND_ADD_TRAIT) {
+                                                               tmp_opline->opcode == ZEND_FETCH_W ||
+                                                               tmp_opline->opcode == ZEND_FETCH_RW ||
+                                                               tmp_opline->opcode == ZEND_FETCH_IS ||
+                                                               tmp_opline->opcode == ZEND_FETCH_UNSET ||
+                                                               tmp_opline->opcode == ZEND_FETCH_FUNC_ARG ||
+                                                               tmp_opline->opcode == ZEND_FETCH_CLASS ||
+                                                               tmp_opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+                                                               tmp_opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+                                                               tmp_opline->opcode == ZEND_UNSET_VAR ||
+                                                               tmp_opline->opcode == ZEND_ISSET_ISEMPTY_VAR ||
+                                                               tmp_opline->opcode == ZEND_ADD_INTERFACE ||
+                                                               tmp_opline->opcode == ZEND_ADD_TRAIT) {
                                                                op_array->literals[tmp_opline->op2.constant].cache_slot = op_array->last_cache_slot++;
                                                        } else if (tmp_opline->opcode == ZEND_INIT_METHOD_CALL ||
-                                                                  tmp_opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
-                                                                  tmp_opline->opcode == ZEND_FETCH_CONSTANT ||
-                                                                  tmp_opline->opcode == ZEND_ASSIGN_OBJ ||
-                                                                  tmp_opline->opcode == ZEND_FETCH_OBJ_R ||
-                                                                  tmp_opline->opcode == ZEND_FETCH_OBJ_W ||
-                                                                  tmp_opline->opcode == ZEND_FETCH_OBJ_RW ||
-                                                                  tmp_opline->opcode == ZEND_FETCH_OBJ_IS ||
-                                                                  tmp_opline->opcode == ZEND_FETCH_OBJ_UNSET ||
-                                                                  tmp_opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG ||
-                                                                  tmp_opline->opcode == ZEND_UNSET_OBJ ||
-                                                                  tmp_opline->opcode == ZEND_PRE_INC_OBJ ||
-                                                                  tmp_opline->opcode == ZEND_PRE_DEC_OBJ ||
-                                                                  tmp_opline->opcode == ZEND_POST_INC_OBJ ||
-                                                                  tmp_opline->opcode == ZEND_POST_DEC_OBJ ||
-                                                                  tmp_opline->opcode == ZEND_ISSET_ISEMPTY_PROP_OBJ) {
+                                                                       tmp_opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+                                                                       tmp_opline->opcode == ZEND_FETCH_CONSTANT ||
+                                                                       tmp_opline->opcode == ZEND_ASSIGN_OBJ ||
+                                                                       tmp_opline->opcode == ZEND_FETCH_OBJ_R ||
+                                                                       tmp_opline->opcode == ZEND_FETCH_OBJ_W ||
+                                                                       tmp_opline->opcode == ZEND_FETCH_OBJ_RW ||
+                                                                       tmp_opline->opcode == ZEND_FETCH_OBJ_IS ||
+                                                                       tmp_opline->opcode == ZEND_FETCH_OBJ_UNSET ||
+                                                                       tmp_opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG ||
+                                                                       tmp_opline->opcode == ZEND_UNSET_OBJ ||
+                                                                       tmp_opline->opcode == ZEND_PRE_INC_OBJ ||
+                                                                       tmp_opline->opcode == ZEND_PRE_DEC_OBJ ||
+                                                                       tmp_opline->opcode == ZEND_POST_INC_OBJ ||
+                                                                       tmp_opline->opcode == ZEND_POST_DEC_OBJ ||
+                                                                       tmp_opline->opcode == ZEND_ISSET_ISEMPTY_PROP_OBJ) {
                                                                op_array->literals[tmp_opline->op2.constant].cache_slot = op_array->last_cache_slot;
                                                                op_array->last_cache_slot += 2;
                                                        } else if (tmp_opline->opcode == ZEND_ASSIGN_ADD ||
-                                                                  tmp_opline->opcode == ZEND_ASSIGN_SUB ||
-                                                                  tmp_opline->opcode == ZEND_ASSIGN_MUL ||
-                                                                  tmp_opline->opcode == ZEND_ASSIGN_DIV ||
-                                                                  tmp_opline->opcode == ZEND_ASSIGN_MOD ||
-                                                                  tmp_opline->opcode == ZEND_ASSIGN_SL ||
-                                                                  tmp_opline->opcode == ZEND_ASSIGN_SR ||
-                                                                  tmp_opline->opcode == ZEND_ASSIGN_CONCAT ||
-                                                                  tmp_opline->opcode == ZEND_ASSIGN_BW_OR ||
-                                                                  tmp_opline->opcode == ZEND_ASSIGN_BW_AND ||
-                                                                  tmp_opline->opcode == ZEND_ASSIGN_BW_XOR) {
+                                                                       tmp_opline->opcode == ZEND_ASSIGN_SUB ||
+                                                                       tmp_opline->opcode == ZEND_ASSIGN_MUL ||
+                                                                       tmp_opline->opcode == ZEND_ASSIGN_DIV ||
+                                                                       tmp_opline->opcode == ZEND_ASSIGN_MOD ||
+                                                                       tmp_opline->opcode == ZEND_ASSIGN_SL ||
+                                                                       tmp_opline->opcode == ZEND_ASSIGN_SR ||
+                                                                       tmp_opline->opcode == ZEND_ASSIGN_CONCAT ||
+                                                                       tmp_opline->opcode == ZEND_ASSIGN_BW_OR ||
+                                                                       tmp_opline->opcode == ZEND_ASSIGN_BW_AND ||
+                                                                       tmp_opline->opcode == ZEND_ASSIGN_BW_XOR) {
                                                                if (tmp_opline->extended_value == ZEND_ASSIGN_OBJ) {
                                                                        op_array->literals[tmp_opline->op2.constant].cache_slot = op_array->last_cache_slot;
                                                                        op_array->last_cache_slot += 2;
@@ -154,7 +154,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                        break;
 
                case ZEND_CAST:
-                       if (ZEND_OP1_TYPE(opline)==IS_CONST &&
+                       if (ZEND_OP1_TYPE(opline) == IS_CONST &&
                                opline->extended_value != IS_ARRAY &&
                                opline->extended_value != IS_OBJECT &&
                                opline->extended_value != IS_RESOURCE) {
@@ -193,7 +193,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
 
                case ZEND_BW_NOT:
                case ZEND_BOOL_NOT:
-                       if (ZEND_OP1_TYPE(opline)==IS_CONST) {
+                       if (ZEND_OP1_TYPE(opline) == IS_CONST) {
                                /* unary operation on constant operand */
                                unary_op_type unary_op = get_unary_op(opline->opcode);
                                zval result;
@@ -215,10 +215,10 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                                MAKE_NOP(opline);
 
                                /* substitute the following TMP_VAR usage with constant */
-                               for (tmp_opline=opline+1; tmp_opline<end; tmp_opline++) {
-                                       if (ZEND_OP1_TYPE(tmp_opline)== IS_TMP_VAR
-                                       && ZEND_OP1(tmp_opline).var == tv) {
-                                               if (tmp_opline->opcode==ZEND_FREE) {
+                               for (tmp_opline = opline + 1; tmp_opline < end; tmp_opline++) {
+                                       if (ZEND_OP1_TYPE(tmp_opline) == IS_TMP_VAR &&
+                                               ZEND_OP1(tmp_opline).var == tv) {
+                                               if (tmp_opline->opcode == ZEND_FREE) {
                                                        MAKE_NOP(tmp_opline);
                                                        zval_dtor(&result);
                                                } else {
@@ -231,8 +231,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                                                }
                                                break;
                                        }
-                                       if (ZEND_OP2_TYPE(tmp_opline)== IS_TMP_VAR
-                                               && ZEND_OP2(tmp_opline).var == tv) {
+                                       if (ZEND_OP2_TYPE(tmp_opline) == IS_TMP_VAR &&
+                                               ZEND_OP2(tmp_opline).var == tv) {
                                                ZEND_OP2_TYPE(tmp_opline) = IS_CONST;
 #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
                                                tmp_opline->op2.constant = zend_add_literal(op_array, &result TSRMLS_CC);
@@ -248,15 +248,15 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                case ZEND_ADD_STRING:
                case ZEND_ADD_CHAR:
                        {
-                               zend_op *next_op = opline+1;
-                               int requires_conversion = (opline->opcode==ZEND_ADD_CHAR?1:0);
+                               zend_op *next_op = opline + 1;
+                               int requires_conversion = (opline->opcode == ZEND_ADD_CHAR? 1 : 0);
                                size_t final_length = 0;
                                char *ptr;
                                zend_op *last_op;
 
                                /* There is always a ZEND_RETURN at the end
                                if (next_op>=end) {
-                               break;
+                                       break;
                                }
                                */
                                while (next_op->opcode == ZEND_ADD_STRING || next_op->opcode == ZEND_ADD_CHAR) {
@@ -275,7 +275,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                                }
                                last_op = next_op;
                                final_length += (requires_conversion ? 1 : ZEND_OP2_LITERAL(opline).value.str.len);
-                               ptr = (char *) emalloc(final_length+1);
+                               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;
@@ -294,7 +294,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                                        ptr += Z_STRLEN(ZEND_OP2_LITERAL(opline));
                                }
                                ZEND_OP2_LITERAL(opline).value.str.len = final_length;
-                               next_op = opline+1;
+                               next_op = opline + 1;
                                while (next_op < last_op) {
                                        if (next_op->opcode == ZEND_ADD_STRING) {
                                                memcpy(ptr, ZEND_OP2_LITERAL(next_op).value.str.val, ZEND_OP2_LITERAL(next_op).value.str.len);
@@ -310,8 +310,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                                if (!((ZEND_OPTIMIZER_PASS_5|ZEND_OPTIMIZER_PASS_10) & OPTIMIZATION_LEVEL)) {
                                        /* NOP removel is disabled => insert JMP over NOPs */
                                        if (last_op-opline >= 3) { /* If we have more than 2 NOPS then JMP over them */
-                                               (opline+1)->opcode = ZEND_JMP;
-                                               ZEND_OP1(opline+1).opline_num = last_op - op_array->opcodes; /* that's OK even for ZE2, since opline_num's are resolved in pass 2 later */
+                                               (opline + 1)->opcode = ZEND_JMP;
+                                               ZEND_OP1(opline + 1).opline_num = last_op - op_array->opcodes; /* that's OK even for ZE2, since opline_num's are resolved in pass 2 later */
                                        }
                                }
                        }
@@ -319,11 +319,11 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
 
                case ZEND_FETCH_CONSTANT:
                        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) {
-                           /* substitute __COMPILER_HALT_OFFSET__ constant */
+                               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) {
+                               /* substitute __COMPILER_HALT_OFFSET__ constant */
                                zend_bool orig_in_execution = EG(in_execution);
                                zend_op_array *orig_op_array = EG(active_op_array);
                                zval offset;
@@ -347,12 +347,12 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                        }
 
                        if (ZEND_OP1_TYPE(opline) == IS_UNUSED &&
-                           ZEND_OP2_TYPE(opline) == IS_CONST &&
-                           ZEND_OP2_LITERAL(opline).type == IS_STRING) {
-                           /* substitute persistent constants */
+                               ZEND_OP2_TYPE(opline) == IS_CONST &&
+                               ZEND_OP2_LITERAL(opline).type == IS_STRING) {
+                               /* substitute persistent constants */
                                zval c;
 
-                               if(zend_get_persistent_constant(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), &c, 1 TSRMLS_CC) == 0) {
+                               if (!zend_get_persistent_constant(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), &c, 1 TSRMLS_CC)) {
                                        break;
                                }
                                literal_dtor(&ZEND_OP2_LITERAL(opline));
@@ -368,17 +368,17 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                        break;
 
                case ZEND_INIT_FCALL_BY_NAME:
-                       if(opline->extended_value == 0 /* not method */ &&
-                          ZEND_OP1_TYPE(opline) == IS_UNUSED &&
-                          ZEND_OP2_TYPE(opline) == IS_CONST) {
-                               if((opline+1)->opcode == ZEND_DO_FCALL_BY_NAME &&
-                                  (opline+1)->extended_value == 0) {
-                                       (opline+1)->opcode = ZEND_DO_FCALL;
-                                       COPY_NODE((opline+1)->op1, opline->op2);
-                                       zend_str_tolower(Z_STRVAL(ZEND_OP1_LITERAL(opline+1)), Z_STRLEN(ZEND_OP1_LITERAL(opline+1)));
+                       if (opline->extended_value == 0 /* not method */ &&
+                               ZEND_OP1_TYPE(opline) == IS_UNUSED &&
+                               ZEND_OP2_TYPE(opline) == IS_CONST) {
+                               if ((opline + 1)->opcode == ZEND_DO_FCALL_BY_NAME &&
+                                       (opline + 1)->extended_value == 0) {
+                                       (opline + 1)->opcode = ZEND_DO_FCALL;
+                                       COPY_NODE((opline + 1)->op1, opline->op2);
+                                       zend_str_tolower(Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)));
 #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
-                                       Z_HASH_P(&ZEND_OP1_LITERAL(opline+1)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline+1)), Z_STRLEN(ZEND_OP1_LITERAL(opline+1))+1);
-                                       op_array->literals[(opline+1)->op1.constant].cache_slot = op_array->last_cache_slot++;
+                                       Z_HASH_P(&ZEND_OP1_LITERAL(opline + 1)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)) + 1);
+                                       op_array->literals[(opline + 1)->op1.constant].cache_slot = op_array->last_cache_slot++;
 #endif
                                        MAKE_NOP(opline);
                                }
index b600e6b40b0ff6095dd07211ba3073bf3d510dbe..da56dcfa52d59e97e44a267ac7320f9d8a0b92a2 100644 (file)
@@ -6,10 +6,10 @@
 
 if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
        zend_op *opline;
-       zend_op *end = op_array->opcodes+op_array->last;
+       zend_op *end = op_array->opcodes + op_array->last;
 
        opline = op_array->opcodes;
-       while (opline<end) {
+       while (opline < end) {
                switch (opline->opcode) {
                        case ZEND_ADD:
                        case ZEND_SUB:
@@ -25,7 +25,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
                        case ZEND_ASSIGN_SUB:
                        case ZEND_ASSIGN_MUL:
                        case ZEND_ASSIGN_DIV:
-                               if(opline->extended_value != 0) {
+                               if (opline->extended_value != 0) {
                                        /* object tristate op - don't attempt to optimize it! */
                                        break;
                                }
@@ -48,7 +48,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
                        case ZEND_ASSIGN_MOD:
                        case ZEND_ASSIGN_SL:
                        case ZEND_ASSIGN_SR:
-                               if(opline->extended_value != 0) {
+                               if (opline->extended_value != 0) {
                                        /* object tristate op - don't attempt to optimize it! */
                                        break;
                                }
@@ -58,7 +58,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
                                        }
                                }
                                break;
-                       
+
                        case ZEND_CONCAT:
                                if (ZEND_OP1_TYPE(opline) == IS_CONST) {
                                        if (ZEND_OP1_LITERAL(opline).type != IS_STRING) {
@@ -67,7 +67,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
                                }
                                /* break missing *intentionally - the assign_op's may only optimize op2 */
                        case ZEND_ASSIGN_CONCAT:
-                               if(opline->extended_value != 0) {
+                               if (opline->extended_value != 0) {
                                        /* object tristate op - don't attempt to optimize it! */
                                        break;
                                }
@@ -77,7 +77,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
                                        }
                                }
                                break;
-                       
+
                        case ZEND_JMPZ_EX:
                        case ZEND_JMPNZ_EX:
                                /* convert Ti = JMPZ_EX(Ti, L) to JMPZ(Ti, L) */
@@ -118,18 +118,18 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
                                        }
                                        break;
                                }
-                               if ((opline+1)->opcode == ZEND_JMP) {
+                               if ((opline + 1)->opcode == ZEND_JMP) {
                                        /* JMPZ(X, L1), JMP(L2) => JMPZNZ(X, L1, L2) */
                                        /* JMPNZ(X, L1), JMP(L2) => JMPZNZ(X, L2, L1) */
-                                       if (ZEND_OP2(opline).opline_num == ZEND_OP1(opline+1).opline_num) {
+                                       if (ZEND_OP2(opline).opline_num == ZEND_OP1(opline + 1).opline_num) {
                                                /* JMPZ(X, L1), JMP(L1) => NOP, JMP(L1) */
                                                MAKE_NOP(opline);
                                        } else {
                                                if (opline->opcode == ZEND_JMPZ) {
-                                                       opline->extended_value = ZEND_OP1(opline+1).opline_num;
+                                                       opline->extended_value = ZEND_OP1(opline + 1).opline_num;
                                                } else {
                                                        opline->extended_value = ZEND_OP2(opline).opline_num;
-                                                       COPY_NODE(opline->op2, (opline+1)->op1);
+                                                       COPY_NODE(opline->op2, (opline + 1)->op1);
                                                }
                                                opline->opcode = ZEND_JMPZNZ;
                                        }
@@ -151,14 +151,14 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
                                        opline->opcode = ZEND_JMP;
                                }
                                break;
-               
+
                        case ZEND_BRK:
                        case ZEND_CONT:
                                {
                                    zend_brk_cont_element *jmp_to;
                                        int array_offset;
                                        int nest_levels;
-                                       int dont_optimize=0;
+                                       int dont_optimize = 0;
 
                                        if (ZEND_OP2_TYPE(opline) != IS_CONST) {
                                                break;
@@ -168,8 +168,8 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
 
                                        array_offset = ZEND_OP1(opline).opline_num;
                                        while (1) {
-                                               if (array_offset==-1) {
-                                                       dont_optimize=1; /* don't optimize this bogus break/continue, let the executor shout */
+                                               if (array_offset == -1) {
+                                                       dont_optimize = 1; /* don't optimize this bogus break/continue, let the executor shout */
                                                        break;
                                                }
                                                jmp_to = &op_array->brk_cont_array[array_offset];
@@ -178,7 +178,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
                                                        if (opline->opcode == ZEND_BRK &&
                                                            (op_array->opcodes[jmp_to->brk].opcode == ZEND_FREE ||
                                                             op_array->opcodes[jmp_to->brk].opcode == ZEND_SWITCH_FREE)) {
-                                                               dont_optimize=1;
+                                                               dont_optimize = 1;
                                                                break;
                                                        }
                                                } else {
@@ -189,7 +189,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
                                        if (dont_optimize) {
                                                break;
                                        }
-       
+
                                        /* optimize - convert to a JMP */
                                        switch (opline->opcode) {
                                                case ZEND_BRK:
index 95a6aad9bff3f69a71475d52e0bb638b0a944c30..269f523e981d498253b478265e0ba34b83d37f47 100644 (file)
@@ -24,7 +24,7 @@
        }                                                                               \
        jmp_hitlist[jmp_hitlist_count++] = ZEND_OP2(&op_array->opcodes[target]).opline_num;
 
-if(ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
+if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
        zend_op *opline;
        zend_op *end = op_array->opcodes+op_array->last;
        zend_uint *jmp_hitlist;
@@ -33,10 +33,10 @@ if(ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
        zend_uint opline_num = 0;
        ALLOCA_FLAG(use_heap);
 
-       jmp_hitlist = (zend_uint *) DO_ALLOCA(sizeof(zend_uint)*op_array->last);
+       jmp_hitlist = (zend_uint *)DO_ALLOCA(sizeof(zend_uint)*op_array->last);
        opline = op_array->opcodes;
 
-       while (opline<end) {
+       while (opline < end) {
                jmp_hitlist_count = 0;
 
                switch (opline->opcode) {
@@ -52,7 +52,7 @@ if(ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
                        case ZEND_BW_AND:
                        case ZEND_BW_XOR:
                                {
-                                       zend_op *next_opline = opline+1;
+                                       zend_op *next_opline = opline + 1;
 
                                        while (next_opline < end && next_opline->opcode == ZEND_NOP) {
                                                ++next_opline;
@@ -62,7 +62,7 @@ if(ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
                                                break;
                                        }
 
-                                       if ((ZEND_OP2_TYPE(opline)==IS_VAR || ZEND_OP2_TYPE(opline)==IS_CV)
+                                       if ((ZEND_OP2_TYPE(opline) == IS_VAR || ZEND_OP2_TYPE(opline) == IS_CV)
                                                && ZEND_OP2(opline).var == ZEND_OP1(next_opline).var &&
                                                (opline->opcode == ZEND_ADD ||
                                                 opline->opcode == ZEND_MUL ||
@@ -73,19 +73,19 @@ if(ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
                                                * optimization works on it
                                                */
 #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
-                                               zend_uchar tmp_type=opline->op1_type;
-                                               znode_op tmp=opline->op1;
+                                               zend_uchar tmp_type = opline->op1_type;
+                                               znode_op tmp = opline->op1;
 #else
-                                               znode tmp=opline->op1;
+                                               znode tmp = opline->op1;
 #endif
 
-                                               if(opline->opcode != ZEND_ADD || ZEND_OP1_TYPE(opline) == IS_CONST) {
+                                               if (opline->opcode != ZEND_ADD || ZEND_OP1_TYPE(opline) == IS_CONST) {
                                                        /* protection from array add: $a = array + $a is not commutative! */
                                                        COPY_NODE(opline->op1, opline->op2);
                                                        COPY_NODE(opline->op2, tmp);
                                                }
                                        }
-                                       if ((ZEND_OP1_TYPE(opline)==IS_VAR || ZEND_OP1_TYPE(opline)==IS_CV)
+                                       if ((ZEND_OP1_TYPE(opline) == IS_VAR || ZEND_OP1_TYPE(opline) == IS_CV)
                                                && ZEND_OP1(opline).var == ZEND_OP1(next_opline).var
                                                && ZEND_OP1_TYPE(opline) == ZEND_OP1_TYPE(next_opline)) {
                                                switch (opline->opcode) {
@@ -139,13 +139,13 @@ if(ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
 #endif
 
                                /* convert L: JMP L+1 to NOP */
-                               if(ZEND_OP1(opline).opline_num == opline_num + 1) {
+                               if (ZEND_OP1(opline).opline_num == opline_num + 1) {
                                        MAKE_NOP(opline);
                                        goto done_jmp_optimization;
                                }
 
                                /* convert JMP L1 ... L1: JMP L2 to JMP L2 .. L1: JMP L2 */
-                               while (ZEND_OP1(opline).opline_num<op_array->last
+                               while (ZEND_OP1(opline).opline_num < op_array->last
                                                && op_array->opcodes[ZEND_OP1(opline).opline_num].opcode == ZEND_JMP) {
                                        int target = ZEND_OP1(opline).opline_num;
                                        CHECK_JMP(target, done_jmp_optimization);
@@ -165,7 +165,7 @@ if(ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
                                }
 #endif
 
-                               while (ZEND_OP2(opline).opline_num<op_array->last) {
+                               while (ZEND_OP2(opline).opline_num < op_array->last) {
                                        int target = ZEND_OP2(opline).opline_num;
                                        if (op_array->opcodes[target].opcode == ZEND_JMP) {
                                                ZEND_OP2(opline).opline_num = ZEND_OP1(&op_array->opcodes[target]).opline_num;
@@ -185,24 +185,24 @@ if(ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
 #endif
 
                                /* convert L: JMPZ L+1 to NOP */
-                               if(ZEND_OP2(opline).opline_num == opline_num + 1) {
+                               if (ZEND_OP2(opline).opline_num == opline_num + 1) {
                                        MAKE_NOP(opline);
                                        goto done_jmp_optimization;
                                }
 
-                               while (ZEND_OP2(opline).opline_num<op_array->last) {
+                               while (ZEND_OP2(opline).opline_num < op_array->last) {
                                        int target = ZEND_OP2(opline).opline_num;
 
                                        if (op_array->opcodes[target].opcode == ZEND_JMP) {
                                                /* plain JMP */
                                                /* JMPZ(X,L1), L1: JMP(L2) => JMPZ(X,L2), L1: JMP(L2) */
-                                               CHECK_JMP(target,  done_jmp_optimization);
+                                               CHECK_JMP(target, done_jmp_optimization);
                                                ZEND_OP2(opline).opline_num = ZEND_OP1(&op_array->opcodes[target]).opline_num;
                                        } else if (op_array->opcodes[target].opcode == opline->opcode &&
                                                   SAME_VAR(opline->op1, op_array->opcodes[target].op1)) {
                                                /* same opcode and same var as this opcode */
                                                /* JMPZ(X,L1), L1: JMPZ(X,L2) => JMPZ(X,L2), L1: JMPZ(X,L2) */
-                                               CHECK_JMP2(target,  done_jmp_optimization);
+                                               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 &&
                                                   SAME_VAR(opline->op1, op_array->opcodes[target].op1)) {
@@ -246,8 +246,8 @@ if(ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
 #endif
                                        /* convert L: T = JMPZ_EX X,L+1 to T = BOOL(X) */
                                        /* convert L: T = JMPZ_EX T,L+1 to NOP */
-                                       if(ZEND_OP2(opline).opline_num == opline_num + 1) {
-                                               if(ZEND_OP1(opline).var == ZEND_RESULT(opline).var) {
+                                       if (ZEND_OP2(opline).opline_num == opline_num + 1) {
+                                               if (ZEND_OP1(opline).var == ZEND_RESULT(opline).var) {
                                                        MAKE_NOP(opline);
                                                } else {
                                                        opline->opcode = ZEND_BOOL;
@@ -256,33 +256,32 @@ if(ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
                                                goto done_jmp_optimization;
                                        }
 
-                                       while (ZEND_OP2(opline).opline_num<op_array->last) {
+                                       while (ZEND_OP2(opline).opline_num < op_array->last) {
                                                int target = ZEND_OP2(opline).opline_num;
-                                               if(SAME_OPCODE_EX(opline->opcode, op_array->opcodes[target].opcode) &&
-                                                  SAME_VAR(op_array->opcodes[target].op1, T)) {
+                                               if (SAME_OPCODE_EX(opline->opcode, op_array->opcodes[target].opcode) &&
+                                                       SAME_VAR(op_array->opcodes[target].op1, T)) {
                                                        /* Check for JMPZ_EX to JMPZ[_EX] with the same condition, either with _EX or not */
-                                                       if(op_array->opcodes[target].opcode == opline->opcode) {
+                                                       if (op_array->opcodes[target].opcode == opline->opcode) {
                                                                /* change T only if we have _EX opcode there */
                                                                COPY_NODE(T, op_array->opcodes[target].result);
                                                        }
                                                        CHECK_JMP2(target, continue_jmp_ex_optimization);
                                                        ZEND_OP2(opline).opline_num = ZEND_OP2(&op_array->opcodes[target]).opline_num;
-                                               } else if(op_array->opcodes[target].opcode == ZEND_JMPZNZ &&
+                                               } else if (op_array->opcodes[target].opcode == ZEND_JMPZNZ &&
                                                                  SAME_VAR(op_array->opcodes[target].op1, T)) {
                                                        /* Check for JMPZNZ with same cond variable */
                                                        int new_target;
                                                        CHECK_JMP2(target, continue_jmp_ex_optimization);
-                                                       if(opline->opcode == ZEND_JMPZ_EX) {
+                                                       if (opline->opcode == ZEND_JMPZ_EX) {
                                                                new_target = ZEND_OP2(&op_array->opcodes[target]).opline_num;
                                                        } else {
                                                                /* JMPNZ_EX */
                                                                new_target = op_array->opcodes[target].extended_value;
                                                        }
                                                        ZEND_OP2(opline).opline_num = new_target;
-                                               } else if((op_array->opcodes[target].opcode == INV_EX_COND_EX(opline->opcode) ||
-                                                                  op_array->opcodes[target].opcode == INV_EX_COND(opline->opcode)
-                                                                  ) &&
-                                                                SAME_VAR(opline->op1, op_array->opcodes[target].op1)) {
+                                               } else if ((op_array->opcodes[target].opcode == INV_EX_COND_EX(opline->opcode) ||
+                                                                       op_array->opcodes[target].opcode == INV_EX_COND(opline->opcode)) &&
+                                                                       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;
@@ -408,13 +407,13 @@ continue_jmpznz_optimization:
                        case ZEND_POST_INC:
                        case ZEND_POST_DEC: {
                                        /* POST_INC, FREE => PRE_INC */
-                                       zend_op *next_op = opline+1;
+                                       zend_op *next_op = opline + 1;
 
-                                       if (next_op>=end) {
+                                       if (next_op >= end) {
                                                break;
                                        }
-                                       if (next_op->opcode == ZEND_FREE
-                                               && ZEND_OP1(next_op).var == ZEND_RESULT(opline).var) {
+                                       if (next_op->opcode == ZEND_FREE &&
+                                               ZEND_OP1(next_op).var == ZEND_RESULT(opline).var) {
                                                MAKE_NOP(next_op);
                                                switch (opline->opcode) {
                                                        case ZEND_POST_INC:
index 2d84b37a30b4168b87e8b692c561da702f383c24..d3c3b14e9d8d2869f5be310a945af9a586444cab 100644 (file)
@@ -322,7 +322,7 @@ const char *accel_new_interned_string(const char *arKey, int nKeyLength, int fre
        p = (Bucket *) ZCSG(interned_strings_top);
        ZCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength);
 
-       p->arKey = (char*)(p+1);
+       p->arKey = (char*)(p + 1);
        memcpy((char*)p->arKey, arKey, nKeyLength);
        p->nKeyLength = nKeyLength;
        p->h = h;
@@ -383,7 +383,7 @@ static void accel_use_shm_interned_strings(TSRMLS_D)
                }
 
                if (ce->name) {
-                       ce->name = accel_new_interned_string(ce->name, ce->name_length+1, 0 TSRMLS_CC);
+                       ce->name = accel_new_interned_string(ce->name, ce->name_length + 1, 0 TSRMLS_CC);
                }
 
                q = ce->properties_info.pListHead;
@@ -395,7 +395,7 @@ static void accel_use_shm_interned_strings(TSRMLS_D)
                        }
 
                        if (info->name) {
-                               info->name = accel_new_interned_string(info->name, info->name_length+1, 0 TSRMLS_CC);
+                               info->name = accel_new_interned_string(info->name, info->name_length + 1, 0 TSRMLS_CC);
                        }
 
                        q = q->pListNext;
@@ -451,7 +451,7 @@ static inline void accel_restart_enter(TSRMLS_D)
 #else
        static const FLOCK_STRUCTURE(restart_in_progress, F_WRLCK, SEEK_SET, 2, 1);
 
-       if (fcntl(lock_file, F_SETLK, &restart_in_progress)==-1) {
+       if (fcntl(lock_file, F_SETLK, &restart_in_progress) == -1) {
                zend_accel_error(ACCEL_LOG_DEBUG, "RestartC(+1):  %s (%d)", strerror(errno), errno);
        }
 #endif
@@ -467,7 +467,7 @@ static inline void accel_restart_leave(TSRMLS_D)
        static const FLOCK_STRUCTURE(restart_finished, F_UNLCK, SEEK_SET, 2, 1);
 
        ZCSG(restart_in_progress) = 0;
-       if (fcntl(lock_file, F_SETLK, &restart_finished)==-1) {
+       if (fcntl(lock_file, F_SETLK, &restart_finished) == -1) {
                zend_accel_error(ACCEL_LOG_DEBUG, "RestartC(-1):  %s (%d)", strerror(errno), errno);
        }
 #endif
@@ -475,7 +475,7 @@ static inline void accel_restart_leave(TSRMLS_D)
 
 static inline int accel_restart_is_active(TSRMLS_D)
 {
-       if(ZCSG(restart_in_progress)) {
+       if (ZCSG(restart_in_progress)) {
 #ifndef ZEND_WIN32
                FLOCK_STRUCTURE(restart_check, F_WRLCK, SEEK_SET, 2, 1);
 
@@ -504,7 +504,7 @@ static inline void accel_activate_add(TSRMLS_D)
 #else
        static const FLOCK_STRUCTURE(mem_usage_lock, F_RDLCK, SEEK_SET, 1, 1);
 
-       if (fcntl(lock_file, F_SETLK, &mem_usage_lock)==-1) {
+       if (fcntl(lock_file, F_SETLK, &mem_usage_lock) == -1) {
                zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC(+1):  %s (%d)", strerror(errno), errno);
        }
 #endif
@@ -521,7 +521,7 @@ static inline void accel_deactivate_sub(TSRMLS_D)
 #else
        static const FLOCK_STRUCTURE(mem_usage_unlock, F_UNLCK, SEEK_SET, 1, 1);
 
-       if (fcntl(lock_file, F_SETLK, &mem_usage_unlock)==-1) {
+       if (fcntl(lock_file, F_SETLK, &mem_usage_unlock) == -1) {
                zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC(-1):  %s (%d)", strerror(errno), errno);
        }
 #endif
@@ -534,7 +534,7 @@ static inline void accel_unlock_all(TSRMLS_D)
 #else
        static const FLOCK_STRUCTURE(mem_usage_unlock_all, F_UNLCK, SEEK_SET, 0, 0);
 
-       if (fcntl(lock_file, F_SETLK, &mem_usage_unlock_all)==-1) {
+       if (fcntl(lock_file, F_SETLK, &mem_usage_unlock_all) == -1) {
                zend_accel_error(ACCEL_LOG_DEBUG, "UnlockAll:  %s (%d)", strerror(errno), errno);
        }
 #endif
@@ -603,7 +603,7 @@ static inline int accel_is_inactive(TSRMLS_D)
 
        if (ZCG(accel_directives).force_restart_timeout
                && ZCSG(force_restart_time)
-               && time(NULL)>=ZCSG(force_restart_time)) {
+               && time(NULL) >= ZCSG(force_restart_time)) {
                zend_accel_error(ACCEL_LOG_WARNING, "Forced restart at %d (after %d seconds), locked by %d", time(NULL), ZCG(accel_directives).force_restart_timeout, mem_usage_check.l_pid);
                kill_all_lockers(&mem_usage_check);
 
@@ -620,22 +620,19 @@ static int zend_get_stream_timestamp(const char *filename, struct stat *statbuf
        php_stream_statbuf stream_statbuf;
        int ret, er;
 
-       if(!filename) {
+       if (!filename) {
                return FAILURE;
        }
 
        wrapper = php_stream_locate_url_wrapper(filename, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC);
-       if(!wrapper) {
-
+       if (!wrapper) {
                return FAILURE;
        }
-       if(!wrapper->wops || !wrapper->wops->url_stat) {
-
+       if (!wrapper->wops || !wrapper->wops->url_stat) {
                statbuf->st_mtime = 1;
                return SUCCESS; /* anything other than 0 is considered to be a valid timestamp */
        }
 
-       
        er = EG(error_reporting);
        EG(error_reporting) = 0;
        zend_try {
@@ -660,7 +657,7 @@ static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_ha
        static FILETIME utc_base_ft;
        WIN32_FILE_ATTRIBUTE_DATA fdata;
 
-       if(!file_handle->opened_path) {
+       if (!file_handle->opened_path) {
                return 0;
        }
 
@@ -679,7 +676,7 @@ static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_ha
                utc_base = (((unsigned __int64)utc_base_ft.dwHighDateTime) << 32) + utc_base_ft.dwLowDateTime;
     }
 
-       if(GetFileAttributesEx(file_handle->opened_path, GetFileExInfoStandard, &fdata) != 0) {
+       if (GetFileAttributesEx(file_handle->opened_path, GetFileExInfoStandard, &fdata) != 0) {
                unsigned __int64 ftime;
 
                if (CompareFileTime (&fdata.ftLastWriteTime, &utc_base_ft) < 0)
@@ -702,14 +699,14 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle
        accel_time_t res;
 
        res = zend_get_file_handle_timestamp_win(file_handle);
-       if(res) {
+       if (res) {
                return res;
        }
 #endif
 
        switch (file_handle->type) {
                case ZEND_HANDLE_FD:
-                       if (fstat(file_handle->handle.fd, &statbuf)==-1) {
+                       if (fstat(file_handle->handle.fd, &statbuf) == -1) {
                                return 0;
                        }
                        break;
@@ -727,13 +724,13 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle
                        {
                                char *file_path = file_handle->opened_path;
 
-                               if(file_path) {
+                               if (file_path) {
                                        if (is_stream_path(file_path)) {
                                                if (zend_get_stream_timestamp(file_path, &statbuf TSRMLS_CC) == SUCCESS) {
                                                        break;
                                                }
                                        }
-                                       if (VCWD_STAT(file_path, &statbuf) !=-1) {
+                                       if (VCWD_STAT(file_path, &statbuf) != -1) {
                                                break;
                                        }
                                }
@@ -787,15 +784,15 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri
         * See bug #15140
         */
        if (file_handle->opened_path) {
-               if (strcmp(persistent_script->full_path,file_handle->opened_path)!=0) {
+               if (strcmp(persistent_script->full_path, file_handle->opened_path) != 0) {
                        return FAILURE;
                }
        } else {
-               char actualpath [MAXPATHLEN+1];
+               char actualpath [MAXPATHLEN + 1];
                char *full_path_ptr;
 
                full_path_ptr = VCWD_REALPATH(file_handle->filename, actualpath);
-               if (full_path_ptr && strcmp(persistent_script->full_path,full_path_ptr)!=0) {
+               if (full_path_ptr && strcmp(persistent_script->full_path, full_path_ptr) != 0) {
                        return FAILURE;
                }
        }
@@ -831,7 +828,7 @@ static inline int validate_timestamp_and_record(zend_persistent_script *persiste
        if (ZCG(accel_directives).revalidate_freq &&
            (persistent_script->dynamic_members.revalidate >= ZCSG(revalidate_at))) {
                return SUCCESS;
-       } else if (do_validate_timestamps(persistent_script, file_handle TSRMLS_CC)==FAILURE) {
+       } else if (do_validate_timestamps(persistent_script, file_handle TSRMLS_CC) == FAILURE) {
                return FAILURE;
        } else {
                persistent_script->dynamic_members.revalidate = ZCSG(revalidate_at);
@@ -873,18 +870,18 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt
     if (ZCG(accel_directives).use_cwd &&
         !IS_ABSOLUTE_PATH(file_handle->filename, path_length) &&
         !is_stream_path(file_handle->filename)) {
-        char *include_path=NULL;
-        int include_path_len=0;
+        char *include_path = NULL;
+        int include_path_len = 0;
         const char *parent_script = NULL;
-        int parent_script_len=0;
-        int cur_len=0;
+        int parent_script_len = 0;
+        int cur_len = 0;
         int cwd_len;
         char *cwd;
 
         if ((cwd = accel_getcwd(&cwd_len TSRMLS_CC)) == NULL) {
             /* we don't handle this well for now. */
             zend_accel_error(ACCEL_LOG_INFO, "getcwd() failed for '%s' (%d), please try to set zend_optimizerplus.use_cwd to 0 in ini file", file_handle->filename, errno);
-            if(file_handle->opened_path) {
+            if (file_handle->opened_path) {
                 cwd = file_handle->opened_path;
                        cwd_len = strlen(cwd);
             } else {
@@ -943,9 +940,9 @@ 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;
+            key_length += parent_script_len + 1;
         }
 
         /* Generate key
@@ -960,19 +957,19 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt
                memcpy(ZCG(key), cwd, cwd_len);
                ZCG(key)[cwd_len] = ':';
 
-               memcpy(ZCG(key)+cwd_len+1, file_handle->filename, path_length);
+               memcpy(ZCG(key) + cwd_len + 1, file_handle->filename, path_length);
 
-               ZCG(key)[cwd_len+1+path_length] = ':';
+               ZCG(key)[cwd_len + 1 + path_length] = ':';
 
-        cur_len = cwd_len+1+path_length+1;
+        cur_len = cwd_len + 1 + path_length + 1;
 
         if (parent_script_len) {
-                       memcpy(ZCG(key)+cur_len, parent_script, parent_script_len);
+                       memcpy(ZCG(key) + cur_len, parent_script, parent_script_len);
             cur_len += parent_script_len;
                        ZCG(key)[cur_len] = ':';
             cur_len++;
         }
-               memcpy(ZCG(key)+cur_len, include_path, include_path_len);
+               memcpy(ZCG(key) + cur_len, include_path, include_path_len);
                ZCG(key)[key_length] = '\0';
     } else {
         /* not use_cwd */
@@ -981,7 +978,7 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt
                        ZCG(key_len) = 0;
                        return NULL;
                }
-               memcpy(ZCG(key), file_handle->filename, key_length+1);
+               memcpy(ZCG(key), file_handle->filename, key_length + 1);
     }
 
        *key_len = ZCG(key_len) = key_length;
@@ -996,17 +993,17 @@ static inline char *accel_make_persistent_key(zend_file_handle *file_handle, int
 /* Adds another key for existing cached script */
 static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_hash_entry *bucket TSRMLS_DC)
 {
-       if (!zend_accel_hash_find(&ZCSG(hash), key, key_length+1)) {
+       if (!zend_accel_hash_find(&ZCSG(hash), key, key_length + 1)) {
                if (zend_accel_hash_is_full(&ZCSG(hash))) {
-                       zend_accel_error(ACCEL_LOG_DEBUG,"No more entries in hash table!");
+                       zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!");
                        ZSMMG(memory_exhausted) = 1;
                } else {
-                       char *new_key = zend_shared_alloc(key_length+1);
+                       char *new_key = zend_shared_alloc(key_length + 1);
                        if (new_key) {
-                               memcpy(new_key, key, key_length+1);
-                               zend_accel_hash_update(&ZCSG(hash), new_key, key_length+1, 1, bucket);
+                               memcpy(new_key, key, key_length + 1);
+                               zend_accel_hash_update(&ZCSG(hash), new_key, key_length + 1, 1, bucket);
                        } else {
-                               zend_accel_error(ACCEL_LOG_DEBUG,"No more memory!");
+                               zend_accel_error(ACCEL_LOG_DEBUG, "No more memory!");
                                ZSMMG(memory_exhausted) = 1;
                        }
                }
@@ -1019,7 +1016,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
        uint memory_used;
 
        /* Check if script may be stored in shared memory */
-       if(!zend_accel_script_persistable(new_persistent_script)) {
+       if (!zend_accel_script_persistable(new_persistent_script)) {
                return new_persistent_script;
        }
 
@@ -1027,7 +1024,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
        zend_shared_alloc_lock(TSRMLS_C);
 
        if (zend_accel_hash_is_full(&ZCSG(hash))) {
-               zend_accel_error(ACCEL_LOG_DEBUG,"No more entries in hash table!");
+               zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!");
                ZSMMG(memory_exhausted) = 1;
                zend_accel_schedule_restart_if_necessary(TSRMLS_C);
                zend_shared_alloc_unlock(TSRMLS_C);
@@ -1037,7 +1034,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
        /* Check if we still need to put the file into the cache (may be it was
         * already stored by another process. This final check is done under
         * exclusive lock) */
-       bucket = zend_accel_hash_find_entry(&ZCSG(hash), new_persistent_script->full_path, new_persistent_script->full_path_len+1);
+       bucket = zend_accel_hash_find_entry(&ZCSG(hash), new_persistent_script->full_path, new_persistent_script->full_path_len + 1);
        if (bucket) {
                zend_persistent_script *existing_persistent_script = (zend_persistent_script *)bucket->data;
 
@@ -1087,13 +1084,13 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
        new_persistent_script->dynamic_members.checksum = zend_accel_script_checksum(new_persistent_script);
 
        /* store script structure in the hash table */
-       bucket = zend_accel_hash_update(&ZCSG(hash), new_persistent_script->full_path, new_persistent_script->full_path_len+1, 0, new_persistent_script);
+       bucket = zend_accel_hash_update(&ZCSG(hash), new_persistent_script->full_path, new_persistent_script->full_path_len + 1, 0, new_persistent_script);
        if (bucket &&
            (new_persistent_script->full_path_len != key_length ||
             memcmp(new_persistent_script->full_path, key, key_length) != 0)) {
                /* link key to the same persistent script in hash table */
-               if (!zend_accel_hash_update(&ZCSG(hash), key, key_length+1, 1, bucket)) {
-                       zend_accel_error(ACCEL_LOG_DEBUG,"No more entries in hash table!");
+               if (!zend_accel_hash_update(&ZCSG(hash), key, key_length + 1, 1, bucket)) {
+                       zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!");
                        ZSMMG(memory_exhausted) = 1;
                }
        }
@@ -1169,7 +1166,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
                }
         } else {
                        *op_array_p = NULL;
-                       if (type==ZEND_REQUIRE) {
+                       if (type == ZEND_REQUIRE) {
                                zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC);
                                zend_bailout();
                        } else {
@@ -1229,7 +1226,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
                /* compilation failed */
                free_persistent_script(new_persistent_script, 1);
                zend_accel_free_user_functions(&ZCG(function_table) TSRMLS_CC);
-               if(do_bailout) {
+               if (do_bailout) {
                        zend_bailout();
                }
                return NULL;
@@ -1338,7 +1335,7 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
                if ((key = accel_make_persistent_key(file_handle, &key_length TSRMLS_CC)) == NULL) {
                        return accelerator_orig_compile_file(file_handle, type TSRMLS_CC);
                }
-               persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length+1);
+               persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length + 1);
                if (!persistent_script) {
                        /* try to find cached script by full real path */
                        zend_accel_hash_entry *bucket;
@@ -1350,7 +1347,7 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
 #else
                        zend_stream_open(file_handle->filename, file_handle TSRMLS_CC) == FAILURE) {
 #endif
-                               if (type==ZEND_REQUIRE) {
+                               if (type == ZEND_REQUIRE) {
                                        zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC);
                                        zend_bailout();
                                } else {
@@ -1360,7 +1357,7 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
                    }
 
                        if (file_handle->opened_path &&
-                           (bucket = zend_accel_hash_find_entry(&ZCSG(hash), file_handle->opened_path, strlen(file_handle->opened_path)+1)) != NULL) {
+                           (bucket = zend_accel_hash_find_entry(&ZCSG(hash), file_handle->opened_path, strlen(file_handle->opened_path) + 1)) != NULL) {
 
                                persistent_script = (zend_persistent_script *)bucket->data;
                                if (!ZCG(accel_directives).revalidate_path &&
@@ -1387,7 +1384,7 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
 
        /* If script is found then validate_timestamps if option is enabled */
        if (persistent_script && ZCG(accel_directives).validate_timestamps) {
-               if (validate_timestamp_and_record(persistent_script, file_handle TSRMLS_CC)==FAILURE) {
+               if (validate_timestamp_and_record(persistent_script, file_handle TSRMLS_CC) == FAILURE) {
                        zend_shared_alloc_lock(TSRMLS_C);
                        if (!persistent_script->corrupted) {
                                persistent_script->corrupted = 1;
@@ -1466,7 +1463,7 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
 #endif
                                void *dummy = (void *) 1;
 
-                               zend_hash_quick_add(&EG(included_files), persistent_script->full_path, persistent_script->full_path_len+1, persistent_script->hash_value, &dummy, sizeof(void *), NULL);
+                               zend_hash_quick_add(&EG(included_files), persistent_script->full_path, persistent_script->full_path_len + 1, persistent_script->hash_value, &dummy, sizeof(void *), NULL);
                        }
                }
                zend_file_handle_dtor(file_handle TSRMLS_CC);
@@ -1533,8 +1530,8 @@ static char *accel_tsrm_realpath(const char *path, int path_len TSRMLS_DC)
                return NULL;
        }
 
-       real_path = emalloc(new_state.cwd_length+1);
-       memcpy(real_path, new_state.cwd, new_state.cwd_length+1);
+       real_path = emalloc(new_state.cwd_length + 1);
+       memcpy(real_path, new_state.cwd, new_state.cwd_length + 1);
        free(new_state.cwd);
        return real_path;
 }
@@ -1560,7 +1557,7 @@ static char *accel_php_resolve_path(const char *filename, int filename_length, c
        ptr = path;
        while (*ptr) {
                for (end = ptr; *end && *end != DEFAULT_DIR_SEPARATOR; end++);
-               len = end-ptr;
+               len = end - ptr;
                if (*end) end++;
                if (len + 1 + filename_length + 1 >= MAXPATHLEN) {
                        ptr = end;
@@ -1568,9 +1565,9 @@ static char *accel_php_resolve_path(const char *filename, int filename_length, c
                }
                memcpy(trypath, ptr, len);
                trypath[len] = '/';
-               memcpy(trypath+len+1, filename, filename_length+1);
+               memcpy(trypath + len + 1, filename, filename_length + 1);
                ptr = end;
-               if ((resolved_path = accel_tsrm_realpath(trypath, len+1+filename_length TSRMLS_CC)) != NULL) {
+               if ((resolved_path = accel_tsrm_realpath(trypath, len + 1 + filename_length TSRMLS_CC)) != NULL) {
                        return resolved_path;
                }
        } /* end provided path */
@@ -1586,8 +1583,8 @@ static char *accel_php_resolve_path(const char *filename, int filename_length, c
                    exec_fname_length > 0 &&
                    exec_fname_length + 1 + filename_length + 1 < MAXPATHLEN) {
                        memcpy(trypath, exec_fname, exec_fname_length + 1);
-                       memcpy(trypath+exec_fname_length + 1, filename, filename_length+1);
-                       return accel_tsrm_realpath(trypath, exec_fname_length+1+filename_length TSRMLS_CC);
+                       memcpy(trypath + exec_fname_length + 1, filename, filename_length + 1);
+                       return accel_tsrm_realpath(trypath, exec_fname_length + 1 + filename_length TSRMLS_CC);
                }
        }
 
@@ -1627,12 +1624,12 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl
 
                            /* Check if requestd file already cached (by full name) */
                            if (IS_ABSOLUTE_PATH(filename, filename_len) &&
-                                   (persistent_script = zend_accel_hash_find(&ZCSG(hash), (char*)filename, filename_len+1)) != NULL &&
+                                   (persistent_script = zend_accel_hash_find(&ZCSG(hash), (char*)filename, filename_len + 1)) != NULL &&
                                    !persistent_script->corrupted) {
 
                                        handle->opened_path = estrndup(persistent_script->full_path, persistent_script->full_path_len);
                                        handle->type = ZEND_HANDLE_FILENAME;
-                                       memcpy(ZCG(key), persistent_script->full_path, persistent_script->full_path_len+1);
+                                       memcpy(ZCG(key), persistent_script->full_path, persistent_script->full_path_len + 1);
                                        ZCG(key_len) = persistent_script->full_path_len;
                                        ZCG(cache_opline) = opline;
                                        ZCG(cache_persistent_script) = persistent_script;
@@ -1643,7 +1640,7 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl
                                key = accel_make_persistent_key_ex(handle, filename_len, &key_length TSRMLS_CC);
                                if (!ZCG(accel_directives).revalidate_path &&
                                    key &&
-                                       (persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length+1)) != NULL &&
+                                       (persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length + 1)) != NULL &&
                                    !persistent_script->corrupted) {
 
                                        handle->opened_path = estrndup(persistent_script->full_path, persistent_script->full_path_len);
@@ -1658,7 +1655,7 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl
 
                            /* Check if requestd file already cached (by real name) */
                                if (resolved_path &&
-                                   (bucket = zend_accel_hash_find_entry(&ZCSG(hash), resolved_path, strlen(resolved_path)+1)) != NULL) {
+                                   (bucket = zend_accel_hash_find_entry(&ZCSG(hash), resolved_path, strlen(resolved_path) + 1)) != NULL) {
 
                                        persistent_script = (zend_persistent_script *)bucket->data;
                                        if (persistent_script && !persistent_script->corrupted) {
@@ -1735,12 +1732,12 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl
 
                            if ((IS_ABSOLUTE_PATH(filename, filename_len) ||
                                 is_stream_path(filename)) &&
-                                   (persistent_script = zend_accel_hash_find(&ZCSG(hash), (char*)filename, filename_len+1)) != NULL &&
+                                   (persistent_script = zend_accel_hash_find(&ZCSG(hash), (char*)filename, filename_len + 1)) != NULL &&
                                    !persistent_script->corrupted) {
 
                                        handle->opened_path = estrndup(persistent_script->full_path, persistent_script->full_path_len);
                                        handle->type = ZEND_HANDLE_FILENAME;
-                                       memcpy(ZCG(key), persistent_script->full_path, persistent_script->full_path_len+1);
+                                       memcpy(ZCG(key), persistent_script->full_path, persistent_script->full_path_len + 1);
                                        ZCG(key_len) = persistent_script->full_path_len;
                                        ZCG(cache_opline) = EG(opline_ptr) ? *EG(opline_ptr) : NULL;
                                        ZCG(cache_persistent_script) = EG(opline_ptr) ? persistent_script : NULL;
@@ -1784,14 +1781,14 @@ static char* persistent_zend_resolve_path(const char *filename, int filename_len
                        char *resolved_path;
                        zend_accel_hash_entry *bucket;
                        zend_persistent_script *persistent_script;
-                   
+
                    /* Check if requestd file already cached (by full name) */
                    if ((IS_ABSOLUTE_PATH(filename, filename_len) ||
                         is_stream_path(filename)) &&
-                           (bucket = zend_accel_hash_find_entry(&ZCSG(hash), (char*)filename, filename_len+1)) != NULL) {
+                           (bucket = zend_accel_hash_find_entry(&ZCSG(hash), (char*)filename, filename_len + 1)) != NULL) {
                                persistent_script = (zend_persistent_script *)bucket->data;
                                if (persistent_script && !persistent_script->corrupted) {
-                                       memcpy(ZCG(key), persistent_script->full_path, persistent_script->full_path_len+1);
+                                       memcpy(ZCG(key), persistent_script->full_path, persistent_script->full_path_len + 1);
                                        ZCG(key_len) = persistent_script->full_path_len;
                                        ZCG(cache_opline) = EG(opline_ptr) ? *EG(opline_ptr) : NULL;
                                        ZCG(cache_persistent_script) = persistent_script;
@@ -1806,7 +1803,7 @@ static char* persistent_zend_resolve_path(const char *filename, int filename_len
                        key = accel_make_persistent_key_ex(&handle, filename_len, &key_length TSRMLS_CC);
                        if (!ZCG(accel_directives).revalidate_path &&
                            key &&
-                               (persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length+1)) != NULL &&
+                               (persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length + 1)) != NULL &&
                            !persistent_script->corrupted) {
 
                                /* we have persistent script */
@@ -1820,7 +1817,7 @@ static char* persistent_zend_resolve_path(const char *filename, int filename_len
 
                    /* Check if requestd file already cached (by real path) */
                        if (resolved_path &&
-                           (bucket = zend_accel_hash_find_entry(&ZCSG(hash), resolved_path, strlen(resolved_path)+1)) != NULL) {
+                           (bucket = zend_accel_hash_find_entry(&ZCSG(hash), resolved_path, strlen(resolved_path) + 1)) != NULL) {
                                persistent_script = (zend_persistent_script *)bucket->data;
 
                                if (persistent_script && !persistent_script->corrupted) {
@@ -1918,7 +1915,7 @@ static void accel_activate(void)
        }
 
        /* check if ZCG(function_table) wasn't somehow polluted on the way */
-       if(ZCG(internal_functions_count) != zend_hash_num_elements(&ZCG(function_table))) {
+       if (ZCG(internal_functions_count) != zend_hash_num_elements(&ZCG(function_table))) {
                zend_accel_error(ACCEL_LOG_WARNING, "Internal functions count changed - was %d, now %d", ZCG(internal_functions_count), zend_hash_num_elements(&ZCG(function_table)));
        }
 
@@ -1957,7 +1954,7 @@ static void accel_fast_zval_ptr_dtor(zval **zval_ptr)
 {
        zval *zvalue = *zval_ptr;
 
-       if (Z_DELREF_P(zvalue)==0) {
+       if (Z_DELREF_P(zvalue) == 0) {
 #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO
                switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {
 #else
@@ -2184,13 +2181,13 @@ static inline int accel_find_sapi(TSRMLS_D)
        const char **sapi_name;
 
        if (sapi_module.name) {
-               for (sapi_name=supported_sapis; *sapi_name; sapi_name++) {
-                       if (strcmp(sapi_module.name, *sapi_name)==0) {
+               for (sapi_name = supported_sapis; *sapi_name; sapi_name++) {
+                       if (strcmp(sapi_module.name, *sapi_name) == 0) {
                                return SUCCESS;
                        }
                }
                if (ZCG(accel_directives).enable_cli &&
-                   strcmp(sapi_module.name, "cli")==0) {
+                   strcmp(sapi_module.name, "cli") == 0) {
                        return SUCCESS;
                }
        }
@@ -2292,10 +2289,10 @@ static int accel_startup(zend_extension *extension)
        }
 
        /* no supported SAPI found - disable acceleration and stop initalization */
-       if( accel_find_sapi(TSRMLS_C) == FAILURE ){
+       if (accel_find_sapi(TSRMLS_C) == FAILURE) {
                accel_startup_ok = 0;
                if (!ZCG(accel_directives).enable_cli &&
-                   strcmp(sapi_module.name, "cli")==0) {
+                   strcmp(sapi_module.name, "cli") == 0) {
                        zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb TSRMLS_CC);
                } else {
                        zps_startup_failure("Opcode Caching is only supported in Apache, ISAPI, FPM and FastCGI SAPIs", NULL, accelerator_remove_cb TSRMLS_CC);
@@ -2315,7 +2312,7 @@ static int accel_startup(zend_extension *extension)
                        break;
                case ALLOC_FAILURE:
                        accel_startup_ok = 0;
-                       zend_accel_error(ACCEL_LOG_FATAL,"Failure to initialize shared memory structures - probably not enough shared memory.");
+                       zend_accel_error(ACCEL_LOG_FATAL, "Failure to initialize shared memory structures - probably not enough shared memory.");
                        return SUCCESS;
                case SUCCESSFULLY_REATTACHED:
                        accel_shared_globals = (zend_accel_shared_globals *) ZSMMG(app_shared_globals);
@@ -2343,7 +2340,7 @@ static int accel_startup(zend_extension *extension)
                        break;
                case FAILED_REATTACHED:
                        accel_startup_ok = 0;
-                       zend_accel_error(ACCEL_LOG_FATAL,"Failure to initialize shared memory structures - can not reattach to exiting shared memory.");
+                       zend_accel_error(ACCEL_LOG_FATAL, "Failure to initialize shared memory structures - can not reattach to exiting shared memory.");
                        return SUCCESS;
                        break;
        }
@@ -2366,7 +2363,7 @@ static int accel_startup(zend_extension *extension)
        zend_resolve_path = persistent_zend_resolve_path;
 #endif
 
-       if(ZCG(accel_directives).validate_timestamps) {
+       if (ZCG(accel_directives).validate_timestamps) {
                ZCSG(revalidate_at) = zend_accel_get_time() + ZCG(accel_directives).revalidate_freq;
        }
 
@@ -2379,7 +2376,7 @@ static int accel_startup(zend_extension *extension)
        ZCG(cwd) = NULL;
 
        /* Override "include_path" modifier callback */
-       if (zend_hash_find(EG(ini_directives), "include_path", sizeof("include_path"), (void **) &ini_entry)==SUCCESS) {
+       if (zend_hash_find(EG(ini_directives), "include_path", sizeof("include_path"), (void **) &ini_entry) == SUCCESS) {
                ZCG(include_path) = INI_STR("include_path");
                ZCG(include_path_key) = NULL;
                if (ZCG(include_path) && *ZCG(include_path)) {
@@ -2451,7 +2448,7 @@ static void accel_shutdown(zend_extension *extension)
        zend_shared_alloc_shutdown();
        zend_compile_file = accelerator_orig_compile_file;
 
-       if (zend_hash_find(EG(ini_directives), "include_path", sizeof("include_path"), (void **) &ini_entry)==SUCCESS) {
+       if (zend_hash_find(EG(ini_directives), "include_path", sizeof("include_path"), (void **) &ini_entry) == SUCCESS) {
                ini_entry->on_modify = orig_include_path_on_modify;
        }
 
@@ -2498,7 +2495,7 @@ void zend_accel_schedule_restart(TSRMLS_D)
 */
 int accelerator_shm_read_lock(TSRMLS_D)
 {
-       if(ZCG(counted)) {
+       if (ZCG(counted)) {
                /* counted means we are holding read lock for SHM, so that nothing bad can happen */
                return SUCCESS;
        } else {
@@ -2506,7 +2503,7 @@ int accelerator_shm_read_lock(TSRMLS_D)
                        or is in progress now */
                accel_activate_add(TSRMLS_C); /* acquire usage lock */
                /* Now if we weren't inside restart, restart would not begin until we remove usage lock */
-               if(ZCSG(restart_in_progress)) {
+               if (ZCSG(restart_in_progress)) {
                        /* we already were inside restart this means it's not safe to touch shm */
                        accel_deactivate_now(); /* drop usage lock */
                        return FAILURE;
@@ -2518,7 +2515,7 @@ int accelerator_shm_read_lock(TSRMLS_D)
 /* must be called ONLY after SUCCESSFUL accelerator_shm_read_lock */
 void accelerator_shm_read_unlock(TSRMLS_D)
 {
-       if(!ZCG(counted)) {
+       if (!ZCG(counted)) {
                /* counted is 0 - meaning we had to readlock manually, release readlock now */
                accel_deactivate_now();
        }
index 2a389c072cbe9043e27e035b31deede38b7c3aa0..a13d3730f0a1a1a3e96cc5bd7d21debb61725f4c 100644 (file)
@@ -38,12 +38,12 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
        zend_shared_segment *shared_segment;
 
        *shared_segments_count = 1;
-       *shared_segments_p = (zend_shared_segment **) calloc(1, sizeof(zend_shared_segment)+sizeof(void *));
+       *shared_segments_p = (zend_shared_segment **) calloc(1, sizeof(zend_shared_segment) + sizeof(void *));
        shared_segment = (zend_shared_segment *)((char *)(*shared_segments_p) + sizeof(void *));
        (*shared_segments_p)[0] = shared_segment;
 
        shared_segment->p = mmap(0, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
-       if(shared_segment->p == MAP_FAILED) {
+       if (shared_segment->p == MAP_FAILED) {
                *error_in = "mmap";
                return ALLOC_FAILURE;
        }
index 75ea176f41d49fec8b2793c415cc55751d02b8a5..06441e4e0fbee64ae03ea3ad4f98a37430149a66 100644 (file)
@@ -39,28 +39,28 @@ typedef struct  {
 static int create_segments(size_t requested_size, zend_shared_segment_posix ***shared_segments_p, int *shared_segments_count, char **error_in)
 {
        zend_shared_segment_posix *shared_segment;
-       char shared_segment_name[sizeof("/ZendAccelerator.")+20];
+       char shared_segment_name[sizeof("/ZendAccelerator.") + 20];
 
        *shared_segments_count = 1;
-       *shared_segments_p = (zend_shared_segment_posix **) calloc(1, sizeof(zend_shared_segment_posix)+sizeof(void *));
+       *shared_segments_p = (zend_shared_segment_posix **) calloc(1, sizeof(zend_shared_segment_posix) + sizeof(void *));
        shared_segment = (zend_shared_segment_posix *)((char *)(*shared_segments_p) + sizeof(void *));
        (*shared_segments_p)[0] = shared_segment;
 
        sprintf(shared_segment_name, "/ZendAccelerator.%d", getpid());
        shared_segment->shm_fd = shm_open(shared_segment_name, O_RDWR|O_CREAT|O_TRUNC, 0600);
-       if(shared_segment->shm_fd == -1) {
+       if (shared_segment->shm_fd == -1) {
                *error_in = "shm_open";
                return ALLOC_FAILURE;
        }
 
-       if(ftruncate(shared_segment->shm_fd, requested_size) != 0) {
+       if (ftruncate(shared_segment->shm_fd, requested_size) != 0) {
                *error_in = "ftruncate";
                shm_unlink(shared_segment_name);
                return ALLOC_FAILURE;
        }
 
        shared_segment->common.p = mmap(0, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED, shared_segment->shm_fd, 0);
-       if(shared_segment->common.p == MAP_FAILED) {
+       if (shared_segment->common.p == MAP_FAILED) {
                *error_in = "mmap";
                shm_unlink(shared_segment_name);
                return ALLOC_FAILURE;
index 9d0256e4de64af5cced6aaca1691acbf9dac44ab..c9a31b07b402232e907ed2fdbe01e957bfde0f86 100644 (file)
@@ -54,8 +54,8 @@ typedef struct  {
 static int create_segments(size_t requested_size, zend_shared_segment_shm ***shared_segments_p, int *shared_segments_count, char **error_in)
 {
        int i;
-       unsigned int allocate_size=0, remaining_bytes=requested_size, seg_allocate_size;
-       int first_segment_id=-1;
+       unsigned int allocate_size = 0, remaining_bytes = requested_size, seg_allocate_size;
+       int first_segment_id = -1;
        key_t first_segment_key = -1;
        struct shmid_ds sds;
        int shmget_flags;
@@ -65,7 +65,7 @@ static int create_segments(size_t requested_size, zend_shared_segment_shm ***sha
     /* determine segment size we _really_ need:
      * no more than to include requested_size
      */
-    while (requested_size*2 <= seg_allocate_size && seg_allocate_size > SEG_ALLOC_SIZE_MIN) {
+    while (requested_size * 2 <= seg_allocate_size && seg_allocate_size > SEG_ALLOC_SIZE_MIN) {
         seg_allocate_size >>= 1;
     }
 
@@ -86,15 +86,15 @@ static int create_segments(size_t requested_size, zend_shared_segment_shm ***sha
                return ALLOC_FAILURE;
        }
 
-       *shared_segments_count = ((requested_size-1)/seg_allocate_size) + 1;
-       *shared_segments_p = (zend_shared_segment_shm **) calloc(1, (*shared_segments_count)*sizeof(zend_shared_segment_shm)+sizeof(void *)*(*shared_segments_count));
-       shared_segments = (zend_shared_segment_shm *)((char *)(*shared_segments_p) + sizeof(void *)*(*shared_segments_count));
-       for(i=0; i<*shared_segments_count; i++) {
-               (*shared_segments_p)[i] = shared_segments+i;
+       *shared_segments_count = ((requested_size - 1) / seg_allocate_size) + 1;
+       *shared_segments_p = (zend_shared_segment_shm **) calloc(1, (*shared_segments_count) * sizeof(zend_shared_segment_shm) + sizeof(void *) * (*shared_segments_count));
+       shared_segments = (zend_shared_segment_shm *)((char *)(*shared_segments_p) + sizeof(void *) * (*shared_segments_count));
+       for (i = 0; i < *shared_segments_count; i++) {
+               (*shared_segments_p)[i] = shared_segments + i;
        }
 
        remaining_bytes = requested_size;
-       for (i=0; i<*shared_segments_count; i++) {
+       for (i = 0; i < *shared_segments_count; i++) {
                allocate_size = MIN(remaining_bytes, seg_allocate_size);
                if (i != 0) {
                        shared_segments[i].shm_id = shmget(IPC_PRIVATE, allocate_size, shmget_flags);
@@ -102,7 +102,7 @@ static int create_segments(size_t requested_size, zend_shared_segment_shm ***sha
                        shared_segments[i].shm_id = first_segment_id;
                }
 
-               if (shared_segments[i].shm_id==-1) {
+               if (shared_segments[i].shm_id == -1) {
                        return ALLOC_FAILURE;
                }
 
index f275c64336cf17c22a143d2bba7d73478ee98e14..40f941d1c01b6b161b84fc5febcfb57121cfcc24 100644 (file)
@@ -113,7 +113,7 @@ void zend_shared_alloc_lock_win32()
 {
        DWORD waitRes = WaitForSingleObject(memory_mutex, INFINITE);
 
-       if(waitRes == WAIT_FAILED) {
+       if (waitRes == WAIT_FAILED) {
                zend_accel_error(ACCEL_LOG_ERROR, "Cannot lock mutex");
        }
 }
@@ -132,13 +132,13 @@ static int zend_shared_alloc_reattach(size_t requested_size, char **error_in)
        MEMORY_BASIC_INFORMATION info;
 
        err = GetLastError();
-       if(!fp) {
+       if (!fp) {
                zend_win_error_message(ACCEL_LOG_WARNING, mmap_base_file, err);
                zend_win_error_message(ACCEL_LOG_FATAL, "Unable to open base address file", err);
                *error_in="fopen";
                return ALLOC_FAILURE;
        }
-       if(!fscanf(fp, "%p", &wanted_mapping_base)) {
+       if (!fscanf(fp, "%p", &wanted_mapping_base)) {
                err = GetLastError();
                zend_win_error_message(ACCEL_LOG_FATAL, "Unable to read base address", err);
                *error_in="read mapping base";
@@ -159,7 +159,7 @@ static int zend_shared_alloc_reattach(size_t requested_size, char **error_in)
        mapping_base = MapViewOfFileEx(memfile, FILE_MAP_ALL_ACCESS, 0, 0, 0, wanted_mapping_base);
        err = GetLastError();
 
-       if(mapping_base == NULL) {
+       if (mapping_base == NULL) {
                if (err == ERROR_INVALID_ADDRESS) {
                        zend_win_error_message(ACCEL_LOG_FATAL, "Unable to reattach to base address", err);
                        return ALLOC_FAILURE;
@@ -200,9 +200,9 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
                } else {
                        return ret;
                }
-       } while(++map_retries < MAX_MAP_RETRIES);
+       } while (++map_retries < MAX_MAP_RETRIES);
 
-       if(map_retries == MAX_MAP_RETRIES) {
+       if (map_retries == MAX_MAP_RETRIES) {
                zend_win_error_message(ACCEL_LOG_FATAL, "Unable to open file mapping", err);
                *error_in = "OpenFileMapping";
                return ALLOC_FAILURE;
@@ -222,7 +222,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
        memfile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, requested_size,
                                                                create_name_with_username(ACCEL_FILEMAP_NAME));
        err = GetLastError();
-       if(memfile == NULL) {
+       if (memfile == NULL) {
                zend_win_error_message(ACCEL_LOG_FATAL, "Unable to create file mapping", err);
                *error_in = "CreateFileMapping";
                return ALLOC_FAILURE;
@@ -250,9 +250,9 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
                        GetSystemInfo(&si);
 
                        /* Are we running Vista ? */
-                       if(osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion == 6 ) {
+                       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;
@@ -273,13 +273,13 @@ 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);
 
        err = GetLastError();
-       if(mapping_base == NULL) {
+       if (mapping_base == NULL) {
                zend_win_error_message(ACCEL_LOG_FATAL, "Unable to create view for file mapping", err);
                *error_in = "MapViewOfFile";
                return ALLOC_FAILURE;
@@ -287,7 +287,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
                char *mmap_base_file = get_mmap_base_file();
                FILE *fp = fopen(mmap_base_file, "w");
                err = GetLastError();
-               if(!fp) {
+               if (!fp) {
                        zend_win_error_message(ACCEL_LOG_WARNING, mmap_base_file, err);
                        zend_win_error_message(ACCEL_LOG_FATAL, "Unable to write base address", err);
                        return ALLOC_FAILURE;
@@ -304,7 +304,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
 
 static int detach_segment(zend_shared_segment *shared_segment)
 {
-       if(mapping_base) {
+       if (mapping_base) {
                UnmapViewOfFile(mapping_base);
        }
        CloseHandle(memfile);
index 666304becf07973bbac9b870292f31057931fb97..f3fd91236ebfcc4463ab6e3782ffa74d174849f0 100644 (file)
@@ -50,7 +50,7 @@ void zend_accel_blacklist_init(zend_blacklist *blacklist)
        blacklist->pos = 0;
        blacklist->size = ZEND_BLACKLIST_BLOCK_SIZE;
 
-       if( blacklist->entries != NULL ){
+       if (blacklist->entries != NULL) {
                zend_accel_blacklist_shutdown(blacklist);
        }
 
@@ -74,8 +74,8 @@ static void blacklist_report_regexp_error(regex_t *comp_regex, int reg_err)
 
 static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
 {
-       int i, end=0, j, rlen=6, clen, reg_err;
        char *regexp;
+       int i, j, clen, reg_err, end = 0, rlen = 6;
        zend_regexp_list **regexp_list_it, *it;
 
        if (blacklist->pos == 0) {
@@ -84,11 +84,11 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
        }
 
        regexp_list_it = &(blacklist->regexp_list);
-       for (i=0; i<blacklist->pos; i++) {
-               rlen += blacklist->entries[i].path_length*2+2;
+       for (i = 0; i < blacklist->pos; i++) {
+               rlen += blacklist->entries[i].path_length * 2 + 2;
 
                /* don't create a regexp buffer bigger than 12K)*/
-               if((i+1 == blacklist->pos) || ((rlen+blacklist->entries[i+1].path_length*2+2)>(12*1024) ) ) {
+               if ((i + 1 == blacklist->pos) || ((rlen + blacklist->entries[i + 1].path_length * 2 + 2) > (12 * 1024))) {
                        regexp = (char *)malloc(rlen);
                        if (!regexp) {
                                zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n");
@@ -97,16 +97,16 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
                        regexp[0] = '^';
                        regexp[1] = '(';
 
-                       clen=2;
-                       for (j=end; j<=i ;j++) {
+                       clen = 2;
+                       for (j = end; j <= i ;j++) {
 
                                int c;
-                               if (j!=end) {
+                               if (j != end) {
                                        regexp[clen++] = '|';
                                }
                                /* copy mangled filename */
-                               for(c=0; c<blacklist->entries[j].path_length; c++) {
-                                       if(strchr("^.[]$()|*+?{}\\", blacklist->entries[j].path[c])) {
+                               for (c = 0; c < blacklist->entries[j].path_length; c++) {
+                                       if (strchr("^.[]$()|*+?{}\\", blacklist->entries[j].path[c])) {
                                                regexp[clen++] = '\\';
                                        }
                                        regexp[clen++] = blacklist->entries[j].path[c];
@@ -127,7 +127,7 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
                        }
                        /* prepare for the next iteration */
                        free(regexp);
-                       end = i+1;
+                       end = i + 1;
                        rlen = 6;
                        *regexp_list_it = it;
                        regexp_list_it = &it->next;
@@ -147,7 +147,7 @@ void zend_accel_blacklist_shutdown(zend_blacklist *blacklist)
        blacklist->entries = NULL;
        if (blacklist->regexp_list) {
                zend_regexp_list *temp, *it = blacklist->regexp_list;
-               while( it ){
+               while (it) {
                        regfree(&it->comp_regex);
                        temp = it;
                        it = it->next;
@@ -158,7 +158,7 @@ void zend_accel_blacklist_shutdown(zend_blacklist *blacklist)
 
 static inline void zend_accel_blacklist_allocate(zend_blacklist *blacklist)
 {
-       if (blacklist->pos==blacklist->size) {
+       if (blacklist->pos == blacklist->size) {
                blacklist->size += ZEND_BLACKLIST_BLOCK_SIZE;
                blacklist->entries = (zend_blacklist_entry *) realloc(blacklist->entries, sizeof(zend_blacklist_entry)*blacklist->size);
        }
@@ -166,12 +166,12 @@ static inline void zend_accel_blacklist_allocate(zend_blacklist *blacklist)
 
 void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename)
 {
-       char buf[MAXPATHLEN+1], real_path[MAXPATHLEN+1];
+       char buf[MAXPATHLEN + 1], real_path[MAXPATHLEN + 1];
        FILE *fp;
        int path_length;
        TSRMLS_FETCH();
 
-       if ((fp=fopen(filename, "r"))==NULL) {
+       if ((fp = fopen(filename, "r")) == NULL) {
                zend_accel_error(ACCEL_LOG_WARNING, "Cannot load blacklist file: %s\n", filename);
                return;
        }
@@ -181,30 +181,30 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename)
        memset(buf, 0, sizeof(buf));
        memset(real_path, 0, sizeof(real_path));
 
-       while (fgets(buf, MAXPATHLEN, fp)!=NULL) {
+       while (fgets(buf, MAXPATHLEN, fp) != NULL) {
                char *path_dup, *pbuf;
                path_length = strlen(buf);
-               if (path_length > 0 && buf[path_length-1]=='\n') {
+               if (path_length > 0 && buf[path_length - 1] == '\n') {
                        buf[--path_length] = 0;
-                       if (path_length > 0 && buf[path_length-1]=='\r') {
+                       if (path_length > 0 && buf[path_length - 1] == '\r') {
                                buf[--path_length] = 0;
                        }
                }
 
                /* Strip ctrl-m prefix */
                pbuf = &buf[0];
-               while(*pbuf == '\r') {
+               while (*pbuf == '\r') {
                        *pbuf++ = 0;
                        path_length--;
                }
 
                /* strip \" */
-               if( pbuf[0] == '\"' && pbuf[path_length-1]== '\"' ){
+               if (pbuf[0] == '\"' && pbuf[path_length - 1]== '\"') {
                        *pbuf++ = 0;
-                       path_length-=2;
+                       path_length -= 2;
                }
 
-               if (path_length==0) {
+               if (path_length == 0) {
                        continue;
                }
 
@@ -216,13 +216,13 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename)
 
                zend_accel_blacklist_allocate(blacklist);
                blacklist->entries[blacklist->pos].path_length = path_length;
-               blacklist->entries[blacklist->pos].path = (char *) malloc(path_length+1);
+               blacklist->entries[blacklist->pos].path = (char *)malloc(path_length + 1);
                if (!blacklist->entries[blacklist->pos].path) {
                        zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n");
                        return;
                }
                blacklist->entries[blacklist->pos].id = blacklist->pos;
-               memcpy(blacklist->entries[blacklist->pos].path, real_path, path_length+1);
+               memcpy(blacklist->entries[blacklist->pos].path, real_path, path_length + 1);
                blacklist->pos++;
        }
        fclose(fp);
@@ -251,7 +251,7 @@ void zend_accel_blacklist_apply(zend_blacklist *blacklist, apply_func_arg_t func
 {
        int i;
 
-       for(i=0; i<blacklist->pos; i++) {
+       for (i = 0; i < blacklist->pos; i++) {
                func(&blacklist->entries[i], argument TSRMLS_CC);
        }
 }
index b39c52d84267098a2c949e47ab94a8dc448174f5..45ed12a9af68d9f7b5e2f62274aafb73bf7dab9a 100644 (file)
@@ -74,13 +74,13 @@ 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, "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",
                                        sizeof("zend_optimizerplus.memory_consumption"),
-                                       (void *) &ini_entry)==FAILURE) {
+                                       (void *) &ini_entry) == FAILURE) {
                        return FAILURE;
                }
 
@@ -112,22 +112,22 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles)
                const char *new_new_value;
                zend_ini_entry *ini_entry;
 
-               if(size < MIN_ACCEL_FILES){
+               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, "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){
+               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, "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",
                                        sizeof("zend_optimizerplus.max_accelerated_files"),
-                                       (void *) &ini_entry)==FAILURE) {
+                                       (void *) &ini_entry) == FAILURE) {
                        return FAILURE;
                }
                ini_entry->value = strdup(new_new_value);
@@ -158,12 +158,12 @@ static ZEND_INI_MH(OnUpdateMaxWastedPercentage)
                zend_ini_entry *ini_entry;
 
                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, "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" );
                if (zend_hash_find(EG(ini_directives),
                                        "zend_optimizerplus.max_wasted_percentage",
                                        sizeof("zend_optimizerplus.max_wasted_percentage"),
-                                       (void *) &ini_entry)==FAILURE) {
+                                       (void *) &ini_entry) == FAILURE) {
                        return FAILURE;
                }
                ini_entry->value = strdup(new_new_value);
@@ -199,12 +199,12 @@ static ZEND_INI_MH(OnUpdateAccelBlacklist)
 }
 
 ZEND_INI_BEGIN()
-    STD_PHP_INI_BOOLEAN("zend_optimizerplus.enable"             ,"1", PHP_INI_SYSTEM, OnUpdateBool, enabled                             , zend_accel_globals, accel_globals)
-       STD_PHP_INI_BOOLEAN("zend_optimizerplus.use_cwd"            ,"1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.use_cwd            , zend_accel_globals, accel_globals)
-       STD_PHP_INI_BOOLEAN("zend_optimizerplus.validate_timestamps","1", PHP_INI_ALL   , OnUpdateBool, accel_directives.validate_timestamps, zend_accel_globals, accel_globals)
-       STD_PHP_INI_BOOLEAN("zend_optimizerplus.inherited_hack"     ,"1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.inherited_hack     , zend_accel_globals, accel_globals)
-       STD_PHP_INI_BOOLEAN("zend_optimizerplus.dups_fix"           ,"0", PHP_INI_ALL   , OnUpdateBool, accel_directives.ignore_dups        , zend_accel_globals, accel_globals)
-       STD_PHP_INI_BOOLEAN("zend_optimizerplus.revalidate_path"    ,"0", PHP_INI_ALL   , OnUpdateBool, accel_directives.revalidate_path    , zend_accel_globals, accel_globals)
+    STD_PHP_INI_BOOLEAN("zend_optimizerplus.enable"             , "1", PHP_INI_SYSTEM, OnUpdateBool, enabled                             , zend_accel_globals, accel_globals)
+       STD_PHP_INI_BOOLEAN("zend_optimizerplus.use_cwd"            , "1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.use_cwd            , zend_accel_globals, accel_globals)
+       STD_PHP_INI_BOOLEAN("zend_optimizerplus.validate_timestamps", "1", PHP_INI_ALL   , OnUpdateBool, accel_directives.validate_timestamps, zend_accel_globals, accel_globals)
+       STD_PHP_INI_BOOLEAN("zend_optimizerplus.inherited_hack"     , "1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.inherited_hack     , zend_accel_globals, accel_globals)
+       STD_PHP_INI_BOOLEAN("zend_optimizerplus.dups_fix"           , "0", PHP_INI_ALL   , OnUpdateBool, accel_directives.ignore_dups        , zend_accel_globals, accel_globals)
+       STD_PHP_INI_BOOLEAN("zend_optimizerplus.revalidate_path"    , "0", PHP_INI_ALL   , OnUpdateBool, accel_directives.revalidate_path    , zend_accel_globals, accel_globals)
 
        STD_PHP_INI_ENTRY("zend_optimizerplus.log_verbosity_level"   , "1"   , PHP_INI_SYSTEM, OnUpdateLong, accel_directives.log_verbosity_level,       zend_accel_globals, accel_globals)
        STD_PHP_INI_ENTRY("zend_optimizerplus.memory_consumption"    , "64"  , PHP_INI_SYSTEM, OnUpdateMemoryConsumption,    accel_directives.memory_consumption,        zend_accel_globals, accel_globals)
@@ -271,7 +271,7 @@ static int filename_is_in_cache(char *filename, int filename_len TSRMLS_DC)
                }
        }
 
-       if((key = accel_make_persistent_key_ex(&handle, filename_len, &key_length TSRMLS_CC)) != NULL) {
+       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);
                return persistent_script && !persistent_script->corrupted;
        }
@@ -301,8 +301,8 @@ static void accel_file_in_cache(int type, INTERNAL_FUNCTION_PARAMETERS)
                return;
        }
 #endif
-       if(filename_len > 0) {
-               if(filename_is_in_cache(filename, filename_len TSRMLS_CC)) {
+       if (filename_len > 0) {
+               if (filename_is_in_cache(filename, filename_len TSRMLS_CC)) {
                        RETURN_TRUE;
                }
        }
@@ -342,15 +342,15 @@ static ZEND_MINIT_FUNCTION(zend_accelerator)
 void zend_accel_override_file_functions(TSRMLS_D)
 {
        zend_function *old_function;
-       if(accel_startup_ok && ZCG(accel_directives).file_override_enabled) {
+       if (accel_startup_ok && ZCG(accel_directives).file_override_enabled) {
                /* override file_exists */
-               if(zend_hash_find(CG(function_table), "file_exists", sizeof("file_exists"), (void **)&old_function) == SUCCESS) {
+               if (zend_hash_find(CG(function_table), "file_exists", sizeof("file_exists"), (void **)&old_function) == SUCCESS) {
                        old_function->internal_function.handler = accel_file_exists;
                }
-               if(zend_hash_find(CG(function_table), "is_file", sizeof("is_file"), (void **)&old_function) == SUCCESS) {
+               if (zend_hash_find(CG(function_table), "is_file", sizeof("is_file"), (void **)&old_function) == SUCCESS) {
                        old_function->internal_function.handler = accel_is_file;
                }
-               if(zend_hash_find(CG(function_table), "is_readable", sizeof("is_readable"), (void **)&old_function) == SUCCESS) {
+               if (zend_hash_find(CG(function_table), "is_readable", sizeof("is_readable"), (void **)&old_function) == SUCCESS) {
                        old_function->internal_function.handler = accel_is_readable;
                }
        }
@@ -424,8 +424,8 @@ static zval* accelerator_get_scripts(TSRMLS_D)
 
        MAKE_STD_ZVAL(return_value);
        array_init(return_value);
-       for (i=0; i<ZCSG(hash).max_num_entries; i++) {
-               for (cache_entry=ZCSG(hash).hash_table[i]; cache_entry; cache_entry = cache_entry->next) {
+       for (i = 0; i<ZCSG(hash).max_num_entries; i++) {
+               for (cache_entry = ZCSG(hash).hash_table[i]; cache_entry; cache_entry = cache_entry->next) {
                        zend_persistent_script *script;
 
                        if (cache_entry->indirect) continue;
@@ -498,8 +498,8 @@ static ZEND_FUNCTION(accelerator_get_status)
        add_assoc_zval(return_value, "accelerator_statistics",statistics);
 
        /* acceleratred scripts */
-       scripts=accelerator_get_scripts(TSRMLS_C);
-       if( scripts ){
+       scripts = accelerator_get_scripts(TSRMLS_C);
+       if (scripts) {
                add_assoc_zval(return_value, "scripts",scripts);
        }
 }
@@ -553,20 +553,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()
index a234461405adec781c8f226cfbcecfc270244c63..e8ed57c24442c58497b2159d36e05a3c61f8670b 100644 (file)
@@ -125,7 +125,7 @@ static int move_user_function(zend_function *function TSRMLS_DC, int num_args, v
        HashTable *function_table = va_arg(args, HashTable *);
        (void)num_args; /* keep the compiler happy */
 
-       if (function->type==ZEND_USER_FUNCTION) {
+       if (function->type == ZEND_USER_FUNCTION) {
                zend_hash_quick_update(function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, function, sizeof(zend_function), NULL);
                return 1;
        } else {
@@ -144,8 +144,8 @@ void zend_accel_move_user_functions(HashTable *src, HashTable *dst TSRMLS_DC)
 
 static int copy_internal_function(zend_function *function, HashTable *function_table TSRMLS_DC)
 {
-       if (function->type==ZEND_INTERNAL_FUNCTION) {
-               zend_hash_update(function_table, function->common.function_name, strlen(function->common.function_name)+1, function, sizeof(zend_function), NULL);
+       if (function->type == ZEND_INTERNAL_FUNCTION) {
+               zend_hash_update(function_table, function->common.function_name, strlen(function->common.function_name) + 1, function, sizeof(zend_function), NULL);
        }
        return 0;
 }
@@ -159,7 +159,7 @@ void zend_accel_copy_internal_functions(TSRMLS_D)
 static void zend_destroy_property_info(zend_property_info *property_info)
 {
        interned_efree((char*)property_info->name);
-       if(property_info->doc_comment){
+       if (property_info->doc_comment) {
                efree((char*)property_info->doc_comment);
        }
 }
@@ -404,7 +404,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
                q->pData = (void *) emalloc(sizeof(zend_function));
                new_entry = (zend_op_array*)q->pData;
                *new_entry = *(zend_op_array*)p->pData;
-               q->pDataPtr=NULL;
+               q->pDataPtr = NULL;
 
                /* Copy constructor */
                /* we use refcount to show that op_array is referenced from several places */
@@ -414,10 +414,10 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
 
                zend_prepare_function_for_execution(new_entry);
 
-               if(old_ce == new_entry->scope) {
+               if (old_ce == new_entry->scope) {
                        new_entry->scope = ce;
                } else {
-                       if(accel_xlat_get(new_entry->scope, new_ce) == SUCCESS) {
+                       if (accel_xlat_get(new_entry->scope, new_ce) == SUCCESS) {
                                new_entry->scope = *new_ce;
                        } else {
                                zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s, function %s. Please call Zend Support", ce->name, new_entry->function_name);
@@ -425,8 +425,8 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
                }
 
                /* update prototype */
-               if (new_entry->prototype ){
-                       if(accel_xlat_get(new_entry->prototype, new_prototype)==SUCCESS) {
+               if (new_entry->prototype{
+                       if (accel_xlat_get(new_entry->prototype, new_prototype) == SUCCESS) {
                                new_entry->prototype = *new_prototype;
                        } else {
                                zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s, function %s. Please call Zend Support", ce->name, new_entry->function_name);
@@ -515,20 +515,20 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla
                q->pData = (void *) emalloc(sizeof(zend_property_info));
                prop_info = q->pData;
                *prop_info = *(zend_property_info*)p->pData;
-               q->pDataPtr=NULL;
+               q->pDataPtr = NULL;
 
                /* Copy constructor */
                prop_info->name = interned_estrndup(prop_info->name, prop_info->name_length);
-               if(prop_info->doc_comment) {
+               if (prop_info->doc_comment) {
                        if (ZCG(accel_directives).load_comments) {
                                prop_info->doc_comment = estrndup(prop_info->doc_comment, prop_info->doc_comment_len);
                        } else {
                                prop_info->doc_comment = NULL;
                        }
                }
-               if(prop_info->ce == old_ce) {
+               if (prop_info->ce == old_ce) {
                        prop_info->ce = ce;
-               } else if(accel_xlat_get(prop_info->ce, new_ce) == SUCCESS) {
+               } else if (accel_xlat_get(prop_info->ce, new_ce) == SUCCESS) {
                        prop_info->ce = *new_ce;
                } else {
                        zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME" class loading error, class %s, property %s. Please call Zend Support", ce->name, prop_info->name);
@@ -559,8 +559,8 @@ static int zend_prepare_function_for_execution(zend_op_array *op_array)
 
 #define zend_update_inherited_handler(handler) \
 { \
-       if(ce->handler != NULL) { \
-               if(accel_xlat_get(ce->handler, new_func)==SUCCESS) { \
+       if (ce->handler != NULL) { \
+               if (accel_xlat_get(ce->handler, new_func) == SUCCESS) { \
                        ce->handler = *new_func; \
                } else { \
                        zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s. Please call Zend Support", ce->name); \
@@ -634,7 +634,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
        ce->name = interned_estrndup(ce->name, ce->name_length);
 
        /* interfaces aren't really implemented, so we create a new table */
-       if(ce->num_interfaces) {
+       if (ce->num_interfaces) {
                ce->interfaces = emalloc(sizeof(zend_class_entry *) * ce->num_interfaces);
                memset(ce->interfaces, 0, sizeof(zend_class_entry *) * ce->num_interfaces);
        } else {
@@ -648,8 +648,8 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
                }
        }
 
-       if(ce->parent) {
-               if(accel_xlat_get(ce->parent, new_ce)==SUCCESS) {
+       if (ce->parent) {
+               if (accel_xlat_get(ce->parent, new_ce) == SUCCESS) {
                        ce->parent = *new_ce;
                } else {
                        zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME" class loading error, class %s. Please call Zend Support", ce->name);
@@ -684,7 +684,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
                while (ce->trait_aliases[i]) {
                        i++;
                }
-               trait_aliases = emalloc(sizeof(zend_trait_alias*) * (i+1));
+               trait_aliases = emalloc(sizeof(zend_trait_alias*) * (i + 1));
                i = 0;
                while (ce->trait_aliases[i]) {
                        trait_aliases[i] = emalloc(sizeof(zend_trait_alias));
@@ -722,7 +722,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
                while (ce->trait_precedences[i]) {
                        i++;
                }
-               trait_precedences = emalloc(sizeof(zend_trait_precedence*) * (i+1));
+               trait_precedences = emalloc(sizeof(zend_trait_precedence*) * (i + 1));
                i = 0;
                while (ce->trait_precedences[i]) {
                        trait_precedences[i] = emalloc(sizeof(zend_trait_precedence));
@@ -744,7 +744,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
                                while (trait_precedences[i]->exclude_from_classes[j]) {
                                        j++;
                                }
-                               exclude_from_classes = emalloc(sizeof(zend_class_entry*) * (j+1));
+                               exclude_from_classes = emalloc(sizeof(zend_class_entry*) * (j + 1));
                                j = 0;
                                while (trait_precedences[i]->exclude_from_classes[j]) {
                                        exclude_from_classes[j] = (zend_class_entry*)estrndup(
@@ -769,25 +769,25 @@ static int zend_accel_same_function(void *f1, void *f2)
        zend_op_array *op1 =  (zend_op_array *)func1;
        zend_op_array *op2 =  (zend_op_array *)func2;
 
-       if(func1->type != ZEND_USER_FUNCTION || func2->type != ZEND_USER_FUNCTION) {
+       if (func1->type != ZEND_USER_FUNCTION || func2->type != ZEND_USER_FUNCTION) {
                return 0;
        }
 
-       if(func1 == func2) {
+       if (func1 == func2) {
                return 1;
        }
 
-       if(op1->function_name != op2->function_name && (!op1->function_name || !op2->function_name || strcmp(op1->function_name, op2->function_name))) {
+       if (op1->function_name != op2->function_name && (!op1->function_name || !op2->function_name || strcmp(op1->function_name, op2->function_name))) {
                /* compare filenames */
                return 0;
        }
 
-       if(op1->filename != op2->filename && (!op1->filename || !op2->filename || strcmp(op1->filename, op2->filename))) {
+       if (op1->filename != op2->filename && (!op1->filename || !op2->filename || strcmp(op1->filename, op2->filename))) {
                /* compare filenames */
                return 0;
        }
 
-       if(!op1->opcodes || !op2->opcodes || op1->opcodes[0].lineno != op2->opcodes[0].lineno) {
+       if (!op1->opcodes || !op2->opcodes || op1->opcodes[0].lineno != op2->opcodes[0].lineno) {
                /* compare first lines */
                return 0;
        }
@@ -801,15 +801,15 @@ static int zend_accel_same_class(void *f1, void *f2)
        zend_class_entry *ce1 = *(zend_class_entry **)f1;
        zend_class_entry *ce2 = *(zend_class_entry **)f2;
 
-       if(ce1->type != ZEND_USER_CLASS || ce2->type != ZEND_USER_CLASS) {
+       if (ce1->type != ZEND_USER_CLASS || ce2->type != ZEND_USER_CLASS) {
                return 0;
        }
 
-       if(ce1 == ce2) {
+       if (ce1 == ce2) {
                return 1;
        }
 
-       if(!ce1->name || !ce2->name || zend_binary_strcmp(ce1->name, ce1->name_length, ce2->name, ce2->name_length)) {
+       if (!ce1->name || !ce2->name || zend_binary_strcmp(ce1->name, ce1->name_length, ce2->name, ce2->name_length)) {
                return 0;
        }
 
@@ -822,7 +822,7 @@ static int zend_accel_same_class(void *f1, void *f2)
                return 0;
        }
 
-       if(zend_hash_num_elements(&ce1->function_table)) {
+       if (zend_hash_num_elements(&ce1->function_table)) {
                HashPosition pos;
                zend_function *func1, *func2;
 
@@ -830,7 +830,7 @@ static int zend_accel_same_class(void *f1, void *f2)
                zend_hash_get_current_data_ex(&ce1->function_table, (void **)&func1, &pos);
                zend_hash_internal_pointer_reset_ex(&ce2->function_table, &pos);
                zend_hash_get_current_data_ex(&ce2->function_table, (void **)&func2, &pos);
-               if(!zend_accel_same_function(func1, func2)) {
+               if (!zend_accel_same_function(func1, func2)) {
                        return 0;
                }
        }
@@ -843,24 +843,24 @@ static int zend_hash_unique_copy(HashTable *target, HashTable *source, unique_co
        Bucket *p;
        void *t;
 
-    p = source->pListHead;
+       p = source->pListHead;
        while (p) {
-               if (p->nKeyLength>0) {
-                       if (zend_hash_quick_add(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t) ==SUCCESS) {
-                               if(pCopyConstructor) {
+               if (p->nKeyLength > 0) {
+                       if (zend_hash_quick_add(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t) == SUCCESS) {
+                               if (pCopyConstructor) {
                                        pCopyConstructor(t);
                                }
                        } else {
-                               if(p->nKeyLength>0 && p->arKey[0]==0) {
+                               if (p->nKeyLength > 0 && p->arKey[0] == 0) {
                                        /* Mangled key, ignore and wait for runtime */
-                               } else if(zend_hash_quick_find(target, p->arKey, p->nKeyLength, p->h, &t) == SUCCESS &&
+                               } else if (zend_hash_quick_find(target, p->arKey, p->nKeyLength, p->h, &t) == SUCCESS &&
                                                  (!pIdFunc || pIdFunc(p->pData, t))) {
                                        /* same one, ignore it */
                                } else {
-                                       if(key_fail) {
+                                       if (key_fail) {
                                                *key_fail = p->arKey;
                                        }
-                                       if(key_fail_l) {
+                                       if (key_fail_l) {
                                                *key_fail_l = p->nKeyLength;
                                        }
                                        return FAILURE;
@@ -868,14 +868,14 @@ static int zend_hash_unique_copy(HashTable *target, HashTable *source, unique_co
                        }
                } else {
                        if (!zend_hash_index_exists(target, p->h) && zend_hash_index_update(target, p->h, p->pData, size, &t) == SUCCESS) {
-                                       if(pCopyConstructor) {
+                                       if (pCopyConstructor) {
                                                pCopyConstructor(t);
                                        }
                        } else {
-                               if(key_fail) {
+                               if (key_fail) {
                                        *key_fail = NULL;
                                }
-                               if(key_fail_l) {
+                               if (key_fail_l) {
                                        *key_fail_l = p->h;
                                }
                                return FAILURE;
@@ -894,10 +894,10 @@ static void zend_accel_function_hash_copy(HashTable *target, HashTable *source,
        zend_function *function;
        TSRMLS_FETCH();
 
-       if(zend_hash_unique_copy(target, source, pCopyConstructor, sizeof(zend_function), &name, &name_len, ZCG(accel_directives).ignore_dups?NULL:zend_accel_same_function) != SUCCESS) {
-               if (zend_hash_find(target, name, name_len, (void *) &function)==SUCCESS
-                       && function->type==ZEND_USER_FUNCTION
-                       && ((zend_op_array *) function)->last>0) {
+       if (zend_hash_unique_copy(target, source, pCopyConstructor, sizeof(zend_function), &name, &name_len, ZCG(accel_directives).ignore_dups?NULL:zend_accel_same_function) != SUCCESS) {
+               if (zend_hash_find(target, name, name_len, (void *) &function) == SUCCESS
+                       && function->type == ZEND_USER_FUNCTION
+                       && ((zend_op_array *) function)->last > 0) {
                        zend_error(E_ERROR, "Cannot redeclare function %.*s() (previously declared in %s:%d). If this code worked without the " ACCELERATOR_PRODUCT_NAME ", please set zend_optimizerplus.dups_fix=1 in your ini file",
                                           (int)name_len, name,
                                           ((zend_op_array *) function)->filename,
@@ -915,7 +915,7 @@ static void zend_accel_class_hash_copy(HashTable *target, HashTable *source, uni
        uint size;
 
        size = sizeof(zend_class_entry*);
-       if(zend_hash_unique_copy(target, source, pCopyConstructor, size, &name, &name_len, ZCG(accel_directives).ignore_dups?NULL:zend_accel_same_class) != SUCCESS) {
+       if (zend_hash_unique_copy(target, source, pCopyConstructor, size, &name, &name_len, ZCG(accel_directives).ignore_dups? NULL : zend_accel_same_class) != SUCCESS) {
                zend_error(E_ERROR, "Cannot redeclare class %.*s. If this code worked without the " ACCELERATOR_PRODUCT_NAME ", please set zend_optimizerplus.dups_fix=1 in your php.ini", (int)name_len, name);
        }
 }
@@ -932,7 +932,7 @@ static void zend_do_delayed_early_binding(zend_op_array *op_array, zend_uint ear
 
                CG(in_compilation) = 1;
                while ((int)opline_num != -1) {
-                       if (zend_lookup_class(Z_STRVAL(op_array->opcodes[opline_num-1].op2.u.constant), Z_STRLEN(op_array->opcodes[opline_num-1].op2.u.constant), &pce TSRMLS_CC) == SUCCESS) {
+                       if (zend_lookup_class(Z_STRVAL(op_array->opcodes[opline_num - 1].op2.u.constant), Z_STRLEN(op_array->opcodes[opline_num - 1].op2.u.constant), &pce TSRMLS_CC) == SUCCESS) {
                                do_bind_inherited_class(&op_array->opcodes[opline_num], EG(class_table), *pce, 1 TSRMLS_CC);
                        }
                        opline_num = op_array->opcodes[opline_num].result.u.opline_num;
@@ -975,8 +975,8 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script,
                        cfilename = persistent_script->full_path;
                        clen = strlen(cfilename);
                        zend_mangle_property_name(&name, &len, haltoff, sizeof(haltoff) - 1, cfilename, clen, 0);
-                       if (!zend_hash_exists(EG(zend_constants), name, len+1)) {
-                               zend_register_long_constant(name, len+1, persistent_script->compiler_halt_offset, CONST_CS, 0 TSRMLS_CC);
+                       if (!zend_hash_exists(EG(zend_constants), name, len + 1)) {
+                               zend_register_long_constant(name, len + 1, persistent_script->compiler_halt_offset, CONST_CS, 0 TSRMLS_CC);
                        }
                        efree(name);
                }
@@ -1040,11 +1040,11 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script,
 #define ADLER32_NMAX 5552
 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
 
-#define ADLER32_DO1(buf)    {s1 += *(buf); s2 += s1;}
-#define ADLER32_DO2(buf,i)  ADLER32_DO1(buf+i); ADLER32_DO1(buf+i+1);
-#define ADLER32_DO4(buf,i)  ADLER32_DO2(buf,i); ADLER32_DO2(buf,i+2);
-#define ADLER32_DO8(buf,i)  ADLER32_DO4(buf,i); ADLER32_DO4(buf,i+4);
-#define ADLER32_DO16(buf)   ADLER32_DO8(buf,0); ADLER32_DO8(buf,8);
+#define ADLER32_DO1(buf)        {s1 += *(buf); s2 += s1;}
+#define ADLER32_DO2(buf, i)     ADLER32_DO1(buf + i); ADLER32_DO1(buf + i + 1);
+#define ADLER32_DO4(buf, i)     ADLER32_DO2(buf, i); ADLER32_DO2(buf, i + 2);
+#define ADLER32_DO8(buf, i)     ADLER32_DO4(buf, i); ADLER32_DO4(buf, i + 4);
+#define ADLER32_DO16(buf)       ADLER32_DO8(buf, 0); ADLER32_DO8(buf, 8);
 
 unsigned int zend_adler32(unsigned int checksum, signed char *buf, uint len)
 {
@@ -1081,7 +1081,7 @@ unsigned int zend_adler32(unsigned int checksum, signed char *buf, uint len)
                }
                s1 %= ADLER32_BASE;
                s2 %= ADLER32_BASE;
-    }
+       }
 
        return (s2 << 16) | s1;
 }
index 44a9809322eef299a88e87846c5dd44f2e2241af..f3438a05bf418c79d656b7e6d7249bc00a7301a2 100644 (file)
@@ -210,7 +210,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
 #endif
                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)) {
                        main_persistent_script->compiler_halt_offset = Z_LVAL(offset);
                }
                EG(active_op_array) = orig_op_array;
@@ -246,7 +246,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
                int offset = 0;
 
                for (;opline<end;opline++, offset++) {
-                       if (ZEND_OP1_TYPE(opline)==IS_CONST) {
+                       if (ZEND_OP1_TYPE(opline) == IS_CONST) {
 #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
                                opline->op1.zv = (zval*)((char*)opline->op1.zv + ((char*)op_array->literals - (char*)orig_literals));
 #else
@@ -254,7 +254,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
                                zend_protect_zval(&opline->op1.u.constant TSRMLS_CC);
 #endif
                        }
-                       if (ZEND_OP2_TYPE(opline)==IS_CONST) {
+                       if (ZEND_OP2_TYPE(opline) == IS_CONST) {
 #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
                                opline->op2.zv = (zval*)((char*)opline->op2.zv + ((char*)op_array->literals - (char*)orig_literals));
 #else
@@ -288,9 +288,9 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
                                case ZEND_DECLARE_INHERITED_CLASS:
                                        if (main_persistent_script && ZCG(accel_directives).inherited_hack) {
                                        if (!has_jmp &&
-                                          ((opline+2) >= end ||
-                                           (opline+1)->opcode != ZEND_FETCH_CLASS ||
-                                           (opline+2)->opcode != ZEND_ADD_INTERFACE)) {
+                                          ((opline + 2) >= end ||
+                                           (opline + 1)->opcode != ZEND_FETCH_CLASS ||
+                                           (opline + 2)->opcode != ZEND_ADD_INTERFACE)) {
 
                                                zend_uint *opline_num = &main_persistent_script->early_binding;
 
@@ -331,7 +331,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
                                                break;
                                }
                        }
-#endif /* if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO */ 
+#endif /* if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO */
                }
 
                efree(op_array->opcodes);
@@ -350,23 +350,23 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
                if ((new_name = zend_shared_alloc_get_xlat_entry(op_array->function_name))) {
                        op_array->function_name = new_name;
                } else {
-                       zend_accel_store(op_array->function_name, strlen(op_array->function_name)+1);
+                       zend_accel_store(op_array->function_name, strlen(op_array->function_name) + 1);
                }
        }
 
        if (op_array->arg_info) {
                zend_arg_info *new_ptr;
-               if((new_ptr = zend_shared_alloc_get_xlat_entry(op_array->arg_info))) {
+               if ((new_ptr = zend_shared_alloc_get_xlat_entry(op_array->arg_info))) {
                        op_array->arg_info = new_ptr;
                } else {
                        zend_uint i;
 
                        zend_accel_store(op_array->arg_info, sizeof(zend_arg_info) * op_array->num_args);
-                       for(i=0;i<op_array->num_args;i++) {
-                               if(op_array->arg_info[i].name) {
+                       for (i = 0; i < op_array->num_args; i++) {
+                               if (op_array->arg_info[i].name) {
                                        zend_accel_store_interned_string(op_array->arg_info[i].name, op_array->arg_info[i].name_len + 1);
                                }
-                               if(op_array->arg_info[i].class_name) {
+                               if (op_array->arg_info[i].class_name) {
                                        zend_accel_store_interned_string(op_array->arg_info[i].class_name, op_array->arg_info[i].class_name_len + 1);
                                }
                        }
@@ -382,15 +382,15 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
                zend_accel_store(op_array->static_variables, sizeof(HashTable));
        }
 
-       if(op_array->scope) {
+       if (op_array->scope) {
                op_array->scope = zend_shared_alloc_get_xlat_entry(op_array->scope);
        }
 
-       if(op_array->doc_comment) {
+       if (op_array->doc_comment) {
                if (ZCG(accel_directives).save_comments) {
                        zend_accel_store(op_array->doc_comment, op_array->doc_comment_len + 1);
                } else {
-                       if(!zend_shared_alloc_get_xlat_entry(op_array->doc_comment)) {
+                       if (!zend_shared_alloc_get_xlat_entry(op_array->doc_comment)) {
                                zend_shared_alloc_register_xlat_entry(op_array->doc_comment, op_array->doc_comment);
                                efree((char*)op_array->doc_comment);
                        }
@@ -399,24 +399,24 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
                }
        }
 
-       if(op_array->try_catch_array) {
+       if (op_array->try_catch_array) {
                zend_accel_store(op_array->try_catch_array, sizeof(zend_try_catch_element) * op_array->last_try_catch);
        }
 
-       if(op_array->vars) {
+       if (op_array->vars) {
                if ((persist_ptr = zend_shared_alloc_get_xlat_entry(op_array->vars))) {
                        op_array->vars = (zend_compiled_variable*)persist_ptr;
                } else {
                        int i;
                        zend_accel_store(op_array->vars, sizeof(zend_compiled_variable) * op_array->last_var);
-                       for(i=0; i<op_array->last_var; i++) {
+                       for (i = 0; i < op_array->last_var; i++) {
                                zend_accel_store_interned_string(op_array->vars[i].name, op_array->vars[i].name_len + 1);
                        }
                }
        }
 
        /* "prototype" may be undefined if "scope" isn't set */
-       if(op_array->scope && op_array->prototype) {
+       if (op_array->scope && op_array->prototype) {
                if ((persist_ptr = zend_shared_alloc_get_xlat_entry(op_array->prototype))) {
                        op_array->prototype = (union _zend_function*)persist_ptr;
                        /* we use refcount to show that op_array is referenced from several places */
@@ -435,11 +435,11 @@ static void zend_persist_op_array(zend_op_array *op_array TSRMLS_DC)
 static void zend_persist_property_info(zend_property_info *prop TSRMLS_DC)
 {
        zend_accel_store_interned_string(prop->name, prop->name_length + 1);
-       if(prop->doc_comment) {
+       if (prop->doc_comment) {
                if (ZCG(accel_directives).save_comments) {
                        zend_accel_store(prop->doc_comment, prop->doc_comment_len + 1);
                } else {
-                       if(!zend_shared_alloc_get_xlat_entry(prop->doc_comment)) {
+                       if (!zend_shared_alloc_get_xlat_entry(prop->doc_comment)) {
                                zend_shared_alloc_register_xlat_entry(prop->doc_comment, prop->doc_comment);
                                efree((char*)prop->doc_comment);
                        }
@@ -486,15 +486,15 @@ static void zend_persist_class_entry(zend_class_entry **pce TSRMLS_DC)
 #endif
                zend_hash_persist(&ce->constants_table, (zend_persist_func_t) zend_persist_zval_ptr, sizeof(zval**) TSRMLS_CC);
 
-               if(ZEND_CE_FILENAME(ce)) {
+               if (ZEND_CE_FILENAME(ce)) {
                        /* do not free! PHP has centralized filename storage, compiler will free it */
                        ZEND_CE_FILENAME(ce) = zend_accel_memdup(ZEND_CE_FILENAME(ce), strlen(ZEND_CE_FILENAME(ce)) + 1);
                }
-               if(ZEND_CE_DOC_COMMENT(ce)) {
+               if (ZEND_CE_DOC_COMMENT(ce)) {
                        if (ZCG(accel_directives).save_comments) {
                                zend_accel_store(ZEND_CE_DOC_COMMENT(ce), ZEND_CE_DOC_COMMENT_LEN(ce) + 1);
                        } else {
-                               if(!zend_shared_alloc_get_xlat_entry(ZEND_CE_DOC_COMMENT(ce))) {
+                               if (!zend_shared_alloc_get_xlat_entry(ZEND_CE_DOC_COMMENT(ce))) {
                                        zend_shared_alloc_register_xlat_entry(ZEND_CE_DOC_COMMENT(ce), ZEND_CE_DOC_COMMENT(ce));
                                        efree((char*)ZEND_CE_DOC_COMMENT(ce));
                                }
@@ -503,7 +503,7 @@ static void zend_persist_class_entry(zend_class_entry **pce TSRMLS_DC)
                        }
                }
                zend_hash_persist(&ce->properties_info, (zend_persist_func_t) zend_persist_property_info, sizeof(zend_property_info) TSRMLS_CC);
-               if(ce->num_interfaces && ce->interfaces) {
+               if (ce->num_interfaces && ce->interfaces) {
                        efree(ce->interfaces);
                }
                ce->interfaces = NULL; /* will be filled in on fetch */
@@ -520,11 +520,11 @@ static void zend_persist_class_entry(zend_class_entry **pce TSRMLS_DC)
                                if (ce->trait_aliases[i]->trait_method) {
                                        if (ce->trait_aliases[i]->trait_method->method_name) {
                                                zend_accel_store(ce->trait_aliases[i]->trait_method->method_name,
-                                                       ce->trait_aliases[i]->trait_method->mname_len+1);
+                                                       ce->trait_aliases[i]->trait_method->mname_len + 1);
                                        }
                                        if (ce->trait_aliases[i]->trait_method->class_name) {
                                                zend_accel_store(ce->trait_aliases[i]->trait_method->class_name,
-                                                       ce->trait_aliases[i]->trait_method->cname_len+1);
+                                                       ce->trait_aliases[i]->trait_method->cname_len + 1);
                                        }
                                        ce->trait_aliases[i]->trait_method->ce = NULL;
                                        zend_accel_store(ce->trait_aliases[i]->trait_method,
@@ -533,7 +533,7 @@ static void zend_persist_class_entry(zend_class_entry **pce TSRMLS_DC)
 
                                if (ce->trait_aliases[i]->alias) {
                                        zend_accel_store(ce->trait_aliases[i]->alias,
-                                               ce->trait_aliases[i]->alias_len+1);
+                                               ce->trait_aliases[i]->alias_len + 1);
                                }
 
 #if ZEND_EXTENSION_API_NO <= PHP_5_4_X_API_NO
@@ -551,9 +551,9 @@ static void zend_persist_class_entry(zend_class_entry **pce TSRMLS_DC)
 
                        while (ce->trait_precedences[i]) {
                                zend_accel_store(ce->trait_precedences[i]->trait_method->method_name,
-                                       ce->trait_precedences[i]->trait_method->mname_len+1);
+                                       ce->trait_precedences[i]->trait_method->mname_len + 1);
                                zend_accel_store(ce->trait_precedences[i]->trait_method->class_name,
-                                       ce->trait_precedences[i]->trait_method->cname_len+1);
+                                       ce->trait_precedences[i]->trait_method->cname_len + 1);
                                ce->trait_precedences[i]->trait_method->ce = NULL;
                                zend_accel_store(ce->trait_precedences[i]->trait_method,
                                        sizeof(zend_trait_method_reference));
@@ -567,7 +567,7 @@ static void zend_persist_class_entry(zend_class_entry **pce TSRMLS_DC)
                                                j++;
                                        }
                                        zend_accel_store(ce->trait_precedences[i]->exclude_from_classes,
-                                               sizeof(zend_class_entry*) * (j+1));
+                                               sizeof(zend_class_entry*) * (j + 1));
                                }
 
 #if ZEND_EXTENSION_API_NO <= PHP_5_4_X_API_NO
@@ -577,7 +577,7 @@ static void zend_persist_class_entry(zend_class_entry **pce TSRMLS_DC)
                                i++;
                        }
                        zend_accel_store(
-                               ce->trait_precedences, sizeof(zend_trait_precedence*) * (i+1));
+                               ce->trait_precedences, sizeof(zend_trait_precedence*) * (i + 1));
                }
 #endif
        }
@@ -600,53 +600,53 @@ static int zend_update_parent_ce(zend_class_entry **pce TSRMLS_DC)
        }
 
        /* update methods */
-       if(ce->constructor) {
+       if (ce->constructor) {
                ce->constructor = zend_shared_alloc_get_xlat_entry(ce->constructor);
                /* we use refcount to show that op_array is referenced from several places */
                ce->constructor->op_array.refcount++;
        }
-       if(ce->destructor) {
+       if (ce->destructor) {
                ce->destructor = zend_shared_alloc_get_xlat_entry(ce->destructor);
                ce->destructor->op_array.refcount++;
        }
-       if(ce->clone) {
+       if (ce->clone) {
                ce->clone = zend_shared_alloc_get_xlat_entry(ce->clone);
                ce->clone->op_array.refcount++;
        }
-       if(ce->__get) {
+       if (ce->__get) {
                ce->__get = zend_shared_alloc_get_xlat_entry(ce->__get);
                ce->__get->op_array.refcount++;
        }
-       if(ce->__set) {
+       if (ce->__set) {
                ce->__set = zend_shared_alloc_get_xlat_entry(ce->__set);
                ce->__set->op_array.refcount++;
        }
-       if(ce->__call) {
+       if (ce->__call) {
                ce->__call = zend_shared_alloc_get_xlat_entry(ce->__call);
                ce->__call->op_array.refcount++;
        }
-       if(ce->serialize_func) {
+       if (ce->serialize_func) {
                ce->serialize_func = zend_shared_alloc_get_xlat_entry(ce->serialize_func);
                ce->serialize_func->op_array.refcount++;
        }
-       if(ce->unserialize_func) {
+       if (ce->unserialize_func) {
                ce->unserialize_func = zend_shared_alloc_get_xlat_entry(ce->unserialize_func);
                ce->unserialize_func->op_array.refcount++;
        }
-       if(ce->__isset) {
+       if (ce->__isset) {
                ce->__isset = zend_shared_alloc_get_xlat_entry(ce->__isset);
                ce->__isset->op_array.refcount++;
        }
-       if(ce->__unset) {
+       if (ce->__unset) {
                ce->__unset = zend_shared_alloc_get_xlat_entry(ce->__unset);
                ce->__unset->op_array.refcount++;
        }
-       if(ce->__tostring) {
+       if (ce->__tostring) {
                ce->__tostring = zend_shared_alloc_get_xlat_entry(ce->__tostring);
                ce->__tostring->op_array.refcount++;
        }
 #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO
-       if(ce->__callstatic) {
+       if (ce->__callstatic) {
                ce->__callstatic = zend_shared_alloc_get_xlat_entry(ce->__callstatic);
                ce->__callstatic->op_array.refcount++;
        }
index 36ec05b7283cbb4793c49f143d7f75a027738a44..72755325bfc25be540780c580be896169bb52e22 100644 (file)
@@ -152,14 +152,14 @@ static uint zend_persist_op_array_calc(zend_op_array *op_array TSRMLS_DC)
        if (!zend_shared_alloc_get_xlat_entry(op_array->opcodes)) {
 #if ZEND_EXTENSION_API_NO <= PHP_5_3_X_API_NO
                zend_op *opline = op_array->opcodes;
-               zend_op *end = op_array->opcodes+op_array->last;
+               zend_op *end = op_array->opcodes + op_array->last;
 
                ADD_DUP_SIZE(op_array->opcodes, sizeof(zend_op) * op_array->last);
                while (opline<end) {
-                       if (opline->op1.op_type==IS_CONST) {
+                       if (opline->op1.op_type == IS_CONST) {
                                ADD_SIZE(zend_persist_zval_calc(&opline->op1.u.constant TSRMLS_CC));
                        }
-                       if (opline->op2.op_type==IS_CONST) {
+                       if (opline->op2.op_type == IS_CONST) {
                                ADD_SIZE(zend_persist_zval_calc(&opline->op2.u.constant TSRMLS_CC));
                        }
                        opline++;
@@ -178,11 +178,11 @@ 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++) {
-                       if(op_array->arg_info[i].name) {
+               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);
                        }
-                       if(op_array->arg_info[i].class_name) {
+                       if (op_array->arg_info[i].class_name) {
                                ADD_INTERNED_STRING(op_array->arg_info[i].class_name, op_array->arg_info[i].class_name_len + 1);
                        }
 
@@ -198,19 +198,19 @@ static uint zend_persist_op_array_calc(zend_op_array *op_array TSRMLS_DC)
                ADD_SIZE(zend_hash_persist_calc(op_array->static_variables, (int (*)(void* TSRMLS_DC)) zend_persist_zval_ptr_calc, sizeof(zval**) TSRMLS_CC));
        }
 
-       if(ZCG(accel_directives).save_comments && op_array->doc_comment) {
+       if (ZCG(accel_directives).save_comments && op_array->doc_comment) {
                ADD_DUP_SIZE(op_array->doc_comment, op_array->doc_comment_len + 1);
        }
 
-       if(op_array->try_catch_array) {
+       if (op_array->try_catch_array) {
                ADD_DUP_SIZE(op_array->try_catch_array, sizeof(zend_try_catch_element) * op_array->last_try_catch);
        }
 
-       if(op_array->vars && !zend_shared_alloc_get_xlat_entry(op_array->vars)) {
+       if (op_array->vars && !zend_shared_alloc_get_xlat_entry(op_array->vars)) {
                int i;
 
                ADD_DUP_SIZE(op_array->vars, sizeof(zend_compiled_variable) * op_array->last_var);
-               for(i=0; i<op_array->last_var; i++) {
+               for (i = 0; i < op_array->last_var; i++) {
                        ADD_INTERNED_STRING(op_array->vars[i].name, op_array->vars[i].name_len + 1);
                }
        }
@@ -222,7 +222,7 @@ static uint zend_persist_property_info_calc(zend_property_info *prop TSRMLS_DC)
 {
        START_SIZE();
        ADD_INTERNED_STRING(prop->name, prop->name_length + 1);
-       if(ZCG(accel_directives).save_comments && prop->doc_comment) {
+       if (ZCG(accel_directives).save_comments && prop->doc_comment) {
                ADD_DUP_SIZE(prop->doc_comment, prop->doc_comment_len + 1);
        }
        RETURN_SIZE();
@@ -267,7 +267,7 @@ static uint zend_persist_class_entry_calc(zend_class_entry **pce TSRMLS_DC)
                if (ZEND_CE_FILENAME(ce)) {
                        ADD_DUP_SIZE(ZEND_CE_FILENAME(ce), strlen(ZEND_CE_FILENAME(ce)) + 1);
                }
-               if(ZCG(accel_directives).save_comments && ZEND_CE_DOC_COMMENT(ce)) {
+               if (ZCG(accel_directives).save_comments && ZEND_CE_DOC_COMMENT(ce)) {
                        ADD_DUP_SIZE(ZEND_CE_DOC_COMMENT(ce), ZEND_CE_DOC_COMMENT_LEN(ce) + 1);
                }
 
@@ -279,16 +279,16 @@ static uint zend_persist_class_entry_calc(zend_class_entry **pce TSRMLS_DC)
                        while (ce->trait_aliases[i]) {
                                if (ce->trait_aliases[i]->trait_method) {
                                        if (ce->trait_aliases[i]->trait_method->method_name) {
-                                               ADD_SIZE(ce->trait_aliases[i]->trait_method->mname_len+1);
+                                               ADD_SIZE(ce->trait_aliases[i]->trait_method->mname_len + 1);
                                        }
                                        if (ce->trait_aliases[i]->trait_method->class_name) {
-                                               ADD_SIZE(ce->trait_aliases[i]->trait_method->cname_len+1);
+                                               ADD_SIZE(ce->trait_aliases[i]->trait_method->cname_len + 1);
                                        }
                                        ADD_SIZE(sizeof(zend_trait_method_reference));
                                }
 
                                if (ce->trait_aliases[i]->alias) {
-                                       ADD_SIZE(ce->trait_aliases[i]->alias_len+1);
+                                       ADD_SIZE(ce->trait_aliases[i]->alias_len + 1);
                                }
                                ADD_SIZE(sizeof(zend_trait_alias));
                                i++;
@@ -300,8 +300,8 @@ static uint zend_persist_class_entry_calc(zend_class_entry **pce TSRMLS_DC)
                        int i = 0;
 
                        while (ce->trait_precedences[i]) {
-                               ADD_SIZE(ce->trait_precedences[i]->trait_method->mname_len+1);
-                               ADD_SIZE(ce->trait_precedences[i]->trait_method->cname_len+1);
+                               ADD_SIZE(ce->trait_precedences[i]->trait_method->mname_len + 1);
+                               ADD_SIZE(ce->trait_precedences[i]->trait_method->cname_len + 1);
                                ADD_SIZE(sizeof(zend_trait_method_reference));
 
                                if (ce->trait_precedences[i]->exclude_from_classes) {
@@ -311,12 +311,12 @@ static uint zend_persist_class_entry_calc(zend_class_entry **pce TSRMLS_DC)
                                                ADD_SIZE(strlen((char*)ce->trait_precedences[i]->exclude_from_classes[j]) + 1);
                                                j++;
                                        }
-                                       ADD_SIZE(sizeof(zend_class_entry*) * (j+1));
+                                       ADD_SIZE(sizeof(zend_class_entry*) * (j + 1));
                                }
                                ADD_SIZE(sizeof(zend_trait_precedence));
                                i++;
                        }
-                       ADD_SIZE(sizeof(zend_trait_precedence*) * (i+1));
+                       ADD_SIZE(sizeof(zend_trait_precedence*) * (i + 1));
                }
 #endif
        }
index abdc195d79683c736a894a8bdd2b8695f4089175..3e867d136132dee93a8a208fcab5efa8bd581191 100644 (file)
@@ -56,7 +56,7 @@ zend_smm_shared_globals *smm_shared_globals;
 static MUTEX_T zts_lock;
 #endif
 int lock_file;
-static char lockfile_name[sizeof(TMP_DIR)+sizeof(SEM_FILENAME_PREFIX)+8];
+static char lockfile_name[sizeof(TMP_DIR) + sizeof(SEM_FILENAME_PREFIX) + 8];
 #endif
 
 static const zend_shared_memory_handler_entry handler_table[] = {
@@ -111,7 +111,7 @@ static void copy_shared_segments(void *to, void *from, int count, int size)
        void *shared_segments_from_p = from;
        int i;
 
-       for(i=0;i<count;i++) {
+       for (i = 0; i < count; i++) {
                shared_segments_v[i] =  shared_segments_to_p;
                memcpy(shared_segments_to_p, shared_segments_from_p, size);
                shared_segments_to_p = ((char *)shared_segments_to_p + size);
@@ -129,15 +129,15 @@ static int zend_shared_alloc_try(const zend_shared_memory_handler_entry *he, int
 
        res = S_H(create_segments)(requested_size, shared_segments_p, shared_segments_count, error_in);
 
-       if( res ) {
+       if (res) {
                /* this model works! */
                return res;
        }
-       if(*shared_segments_p) {
+       if (*shared_segments_p) {
                int i;
                /* cleanup */
-               for(i=0;i<*shared_segments_count;i++) {
-                       if((*shared_segments_p)[i]->p && (int)(*shared_segments_p)[i]->p != -1) {
+               for (i = 0; i < *shared_segments_count; i++) {
+                       if ((*shared_segments_p)[i]->p && (int)(*shared_segments_p)[i]->p != -1) {
                                S_H(detach_segment)((*shared_segments_p)[i]);
                        }
                }
@@ -167,17 +167,17 @@ int zend_shared_alloc_startup(int requested_size)
 
        zend_shared_alloc_create_lock();
 
-       if(ZCG(accel_directives).memory_model && ZCG(accel_directives).memory_model[0]) {
-               charmodel = ZCG(accel_directives).memory_model;
+       if (ZCG(accel_directives).memory_model && ZCG(accel_directives).memory_model[0]) {
+               char *model = ZCG(accel_directives).memory_model;
                /* "cgi" is really "shm"... */
-               if( strncmp(ZCG(accel_directives).memory_model,"cgi",4) == 0 ){
+               if (strncmp(ZCG(accel_directives).memory_model, "cgi", sizeof("cgi")) == 0) {
                        model = "shm";
                }
 
-               for(he = handler_table; he->name; he++) {
-                       if(strcmp(model, he->name) == 0) {
-                               res=zend_shared_alloc_try(he, requested_size, &ZSMMG(shared_segments), &ZSMMG(shared_segments_count), &error_in);
-                               if( res ) {
+               for (he = handler_table; he->name; he++) {
+                       if (strcmp(model, he->name) == 0) {
+                               res = zend_shared_alloc_try(he, requested_size, &ZSMMG(shared_segments), &ZSMMG(shared_segments_count), &error_in);
+                               if (res) {
                                        /* this model works! */
                                }
                                break;
@@ -185,38 +185,38 @@ int zend_shared_alloc_startup(int requested_size)
                }
        }
 
-       if( res == FAILED_REATTACHED ){
+       if (res == FAILED_REATTACHED) {
                smm_shared_globals = NULL;
                return res;
        }
 
-       if(!g_shared_alloc_handler) {
+       if (!g_shared_alloc_handler) {
                /* try memory handlers in order */
-               for(he = handler_table; he->name; he++) {
-                       res=zend_shared_alloc_try(he, requested_size, &ZSMMG(shared_segments), &ZSMMG(shared_segments_count), &error_in);
-                       if( res ) {
+               for (he = handler_table; he->name; he++) {
+                       res = zend_shared_alloc_try(he, requested_size, &ZSMMG(shared_segments), &ZSMMG(shared_segments_count), &error_in);
+                       if (res) {
                                /* this model works! */
                                break;
                        }
                }
        }
 
-       if(!g_shared_alloc_handler) {
+       if (!g_shared_alloc_handler) {
                no_memory_bailout(requested_size, error_in);
                return ALLOC_FAILURE;
        }
 
-       if( res == SUCCESSFULLY_REATTACHED ){
+       if (res == SUCCESSFULLY_REATTACHED) {
                return res;
        }
 
-       shared_segments_array_size = ZSMMG(shared_segments_count)*S_H(segment_type_size)();
+       shared_segments_array_size = ZSMMG(shared_segments_count) * S_H(segment_type_size)();
 
        /* move shared_segments and shared_free to shared memory */
        ZCG(locked) = 1; /* no need to perform a real lock at this point */
        p_tmp_shared_globals = (zend_smm_shared_globals *) zend_shared_alloc(sizeof(zend_smm_shared_globals));
 
-       tmp_shared_segments = zend_shared_alloc(shared_segments_array_size+ZSMMG(shared_segments_count)*sizeof(void *));
+       tmp_shared_segments = zend_shared_alloc(shared_segments_array_size + ZSMMG(shared_segments_count) * sizeof(void *));
        copy_shared_segments(tmp_shared_segments, ZSMMG(shared_segments)[0], ZSMMG(shared_segments_count), S_H(segment_type_size)());
 
        *p_tmp_shared_globals = tmp_shared_globals;
@@ -225,7 +225,7 @@ int zend_shared_alloc_startup(int requested_size)
        free(ZSMMG(shared_segments));
        ZSMMG(shared_segments) = tmp_shared_segments;
 
-       ZSMMG(shared_memory_state).positions = (int *) zend_shared_alloc(sizeof(int)*ZSMMG(shared_segments_count));
+       ZSMMG(shared_memory_state).positions = (int *)zend_shared_alloc(sizeof(int) * ZSMMG(shared_segments_count));
        ZCG(locked) = 0;
 
        return res;
@@ -240,12 +240,12 @@ void zend_shared_alloc_shutdown(void)
 
        tmp_shared_globals = *smm_shared_globals;
        smm_shared_globals = &tmp_shared_globals;
-       shared_segments_array_size = ZSMMG(shared_segments_count)*(S_H(segment_type_size)()+sizeof(void *));
+       shared_segments_array_size = ZSMMG(shared_segments_count) * (S_H(segment_type_size)() + sizeof(void *));
        tmp_shared_segments = emalloc(shared_segments_array_size);
        copy_shared_segments(tmp_shared_segments, ZSMMG(shared_segments)[0], ZSMMG(shared_segments_count), S_H(segment_type_size)());
        ZSMMG(shared_segments) = tmp_shared_segments;
 
-       for(i=0; i<ZSMMG(shared_segments_count); i++) {
+       for (i = 0; i < ZSMMG(shared_segments_count); i++) {
                S_H(detach_segment)(ZSMMG(shared_segments)[i]);
        }
        efree(ZSMMG(shared_segments));
@@ -265,7 +265,7 @@ void zend_shared_alloc_shutdown(void)
 void *zend_shared_alloc(size_t size)
 {
        int i;
-       unsigned int block_size = size+sizeof(zend_shared_memory_block_header);
+       unsigned int block_size = size + sizeof(zend_shared_memory_block_header);
        TSRMLS_FETCH();
 
 #if 1
@@ -277,20 +277,20 @@ void *zend_shared_alloc(size_t size)
                SHARED_ALLOC_FAILED();
                return NULL;
        }
-       for (i=0; i<ZSMMG(shared_segments_count); i++) {
-               if (ZSMMG(shared_segments)[i]->size-ZSMMG(shared_segments)[i]->pos >= block_size) { /* found a valid block */
-                       zend_shared_memory_block_header *p = (zend_shared_memory_block_header *) (((char *) ZSMMG(shared_segments)[i]->p)+ZSMMG(shared_segments)[i]->pos);
+       for (i = 0; i < ZSMMG(shared_segments_count); i++) {
+               if (ZSMMG(shared_segments)[i]->size - ZSMMG(shared_segments)[i]->pos >= block_size) { /* found a valid block */
+                       zend_shared_memory_block_header *p = (zend_shared_memory_block_header *) (((char *) ZSMMG(shared_segments)[i]->p) + ZSMMG(shared_segments)[i]->pos);
                        int remainder = block_size % PLATFORM_ALIGNMENT;
                        void *retval;
 
-                       if (remainder!=0) {
-                               size += PLATFORM_ALIGNMENT-remainder;
-                               block_size += PLATFORM_ALIGNMENT-remainder;
+                       if (remainder != 0) {
+                               size += PLATFORM_ALIGNMENT - remainder;
+                               block_size += PLATFORM_ALIGNMENT - remainder;
                        }
                        ZSMMG(shared_segments)[i]->pos += block_size;
                        ZSMMG(shared_free) -= block_size;
                        p->size = size;
-                       retval = ((char *) p)+sizeof(zend_shared_memory_block_header);
+                       retval = ((char *) p) + sizeof(zend_shared_memory_block_header);
                        memset(retval, 0, size);
                        return retval;
                }
@@ -303,7 +303,7 @@ int zend_shared_memdup_size(void *source, size_t size)
 {
        void **old_p;
 
-       if (zend_hash_index_find(&xlat_table, (ulong) source, (void **) &old_p)==SUCCESS) {
+       if (zend_hash_index_find(&xlat_table, (ulong)source, (void **)&old_p) == SUCCESS) {
                /* we already duplicated this pointer */
                return 0;
        }
@@ -315,7 +315,7 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source TSRML
 {
        void **old_p, *retval;
 
-       if (zend_hash_index_find(&xlat_table, (ulong) source, (void **) &old_p)==SUCCESS) {
+       if (zend_hash_index_find(&xlat_table, (ulong)source, (void **)&old_p) == SUCCESS) {
                /* we already duplicated this pointer */
                return *old_p;
        }
@@ -407,14 +407,14 @@ void zend_shared_alloc_clear_xlat_table(void)
 
 void zend_shared_alloc_register_xlat_entry(const void *old, const void *new)
 {
-       zend_hash_index_update(&xlat_table, (ulong) old, (void*)&new, sizeof(void *), NULL);
+       zend_hash_index_update(&xlat_table, (ulong)old, (void*)&new, sizeof(void *), NULL);
 }
 
 void *zend_shared_alloc_get_xlat_entry(const void *old)
 {
        void **retval;
 
-       if (zend_hash_index_find(&xlat_table, (ulong) old, (void **) &retval)==FAILURE) {
+       if (zend_hash_index_find(&xlat_table, (ulong)old, (void **)&retval) == FAILURE) {
                return NULL;
        }
        return *retval;
@@ -428,9 +428,9 @@ size_t zend_shared_alloc_get_free_memory(void)
 size_t zend_shared_alloc_get_largest_free_block(void)
 {
        int i;
-       size_t largest_block_size=0;
+       size_t largest_block_size = 0;
 
-       for (i=0; i<ZSMMG(shared_segments_count); i++) {
+       for (i = 0; i < ZSMMG(shared_segments_count); i++) {
                size_t block_size = ZSMMG(shared_segments)[i]->size - ZSMMG(shared_segments)[i]->pos;
 
                if (block_size>largest_block_size) {
@@ -444,7 +444,7 @@ void zend_shared_alloc_save_state(void)
 {
        int i;
 
-       for (i=0; i<ZSMMG(shared_segments_count); i++) {
+       for (i = 0; i < ZSMMG(shared_segments_count); i++) {
                ZSMMG(shared_memory_state).positions[i] = ZSMMG(shared_segments)[i]->pos;
        }
        ZSMMG(shared_memory_state).shared_free = ZSMMG(shared_free);
@@ -454,7 +454,7 @@ void zend_shared_alloc_restore_state(void)
 {
        int i;
 
-       for (i=0; i<ZSMMG(shared_segments_count); i++) {
+       for (i = 0; i < ZSMMG(shared_segments_count); i++) {
                ZSMMG(shared_segments)[i]->pos = ZSMMG(shared_memory_state).positions[i];
        }
        ZSMMG(shared_free) = ZSMMG(shared_memory_state).shared_free;
@@ -478,7 +478,7 @@ void zend_accel_shared_protect(int mode TSRMLS_DC)
                mode = PROT_READ|PROT_WRITE;
        }
 
-       for(i=0; i < ZSMMG(shared_segments_count); i++) {
+       for (i = 0; i < ZSMMG(shared_segments_count); i++) {
                mprotect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->size, mode);
        }
 #endif