Show
Ignore:
Timestamp:
06/19/08 18:01:31 (6 months ago)
Author:
bart
Message:

Remove support for all php versions older than php 5.1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/ea_store.c

    r336 r344  
    8181} 
    8282 
    83 #ifdef ZEND_ENGINE_2 
    8483static size_t calc_property_info(zend_property_info * from TSRMLS_DC) 
    8584{ 
     
    9089    size += calc_string(from->name, from->name_length + 1 TSRMLS_CC); 
    9190#ifdef INCLUDE_DOC_COMMENTS 
    92 #ifdef ZEND_ENGINE_2_1 
    9391     if (from->doc_comment != NULL) { 
    9492        size += calc_string(from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 
    9593     } 
    9694#endif 
    97 #endif 
    9895     return size; 
    9996} 
    100 #endif 
    10197 
    10298/* Calculate the size of an HashTable */ 
     
    165161        zend_bailout(); 
    166162    } 
    167 #ifdef ZEND_ENGINE_2 
    168163    if (from->num_args > 0) { 
    169164        zend_uint i; 
     
    178173        } 
    179174    } 
    180 #else 
    181     if (from->arg_types != NULL) { 
    182         size += calc_string((char *) from->arg_types, (from->arg_types[0] + 1) * sizeof(zend_uchar) TSRMLS_CC); 
    183     } 
    184 #endif 
    185175    if (from->function_name != NULL) { 
    186176        size += calc_string(from->function_name, strlen(from->function_name) + 1 TSRMLS_CC); 
    187177    } 
    188 #ifdef ZEND_ENGINE_2 
    189178    if (from->scope != NULL) { 
    190179        // HOESH: the same problem? 
     
    198187        } 
    199188    } 
    200 #endif 
    201189    if (from->type == ZEND_INTERNAL_FUNCTION) { 
    202190        return size; 
     
    222210        ADDSIZE(size, sizeof(zend_brk_cont_element) * from->last_brk_cont); 
    223211    } 
    224 #ifdef ZEND_ENGINE_2 
    225212    if (from->try_catch_array != NULL) { 
    226213        ADDSIZE(size, sizeof(zend_try_catch_element) * from->last_try_catch); 
    227214    } 
    228 #endif 
    229215    if (from->static_variables != NULL) { 
    230216        ADDSIZE(size, sizeof(HashTable)); 
    231217        size += calc_zval_hash(from->static_variables); 
    232218    } 
    233 #ifdef ZEND_ENGINE_2_1 
    234219    if (from->vars != NULL) { 
    235220        int i; 
     
    239224        } 
    240225    } 
    241 #endif 
    242226    if (from->filename != NULL) { 
    243227        size += calc_string(from->filename, strlen(from->filename) + 1 TSRMLS_CC); 
    244228    } 
    245229#ifdef INCLUDE_DOC_COMMENTS 
    246 #ifdef ZEND_ENGINE_2 
    247230    if (from->doc_comment != NULL) { 
    248231        size += calc_string(from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 
    249232    } 
    250 #endif 
    251233#endif 
    252234 
     
    270252        size += calc_string(from->parent->name, from->parent->name_length + 1 TSRMLS_CC); 
    271253    } 
    272 #ifdef ZEND_ENGINE_2 
    273254    if (from->filename != NULL) { 
    274255        size += calc_string(from->filename, strlen(from->filename) + 1 TSRMLS_CC); 
     
    284265    size += calc_hash(&from->properties_info, (calc_bucket_t) calc_property_info); 
    285266 
    286 #  ifdef ZEND_ENGINE_2_1 
    287267    size += calc_zval_hash(&from->default_static_members); 
    288268    if ((from->static_members != NULL) && (from->static_members != &from->default_static_members)) { 
    289 #  else 
    290     if (from->static_members != NULL) { 
    291 #  endif 
    292269        ADDSIZE(size, sizeof(HashTable)); 
    293270        size += calc_zval_hash(from->static_members); 
    294271    } 
    295 #else 
    296     size += calc_zval_hash(&from->default_properties); 
    297 #endif 
    298272    size += calc_hash(&from->function_table, (calc_bucket_t) calc_op_array); 
    299273 
     
    331305    } 
    332306    while (c != NULL) { 
    333 #ifdef ZEND_ENGINE_2 
    334307        size += calc_class_entry(*(zend_class_entry **) c->pData TSRMLS_CC); 
    335 #else 
    336         size += calc_class_entry((zend_class_entry *) c->pData TSRMLS_CC); 
    337 #endif 
    338308        c = c->pListNext; 
    339309    } 
     
    504474 
    505475    DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
    506 #ifdef ZEND_ENGINE_2 
    507476    DBG(ea_debug_printf, (EA_DEBUG, "[%d] store_op_array: %s [scope=%s type=%x]\n",  
    508477            getpid(), from->function_name ? from->function_name : "(top)", 
     
    510479            , from->type 
    511480        )); 
    512 #else 
    513     DBG(ea_debug_printf, (EA_DEBUG, "[%d] store_op_array: %s [scope=%s type=%x]\n",  
    514             getpid(), from->function_name ? from->function_name : "(top)", 
    515             "NULL" 
    516             , from->type 
    517         )); 
    518 #endif       
    519481 
    520482    if (from->type == ZEND_INTERNAL_FUNCTION) { 
     
    527489 
    528490    to->type = from->type; 
    529 #ifdef ZEND_ENGINE_2 
    530491    to->num_args = from->num_args; 
    531492    to->required_num_args = from->required_num_args; 
     
    543504                to->arg_info[i].class_name_len = from->arg_info[i].class_name_len; 
    544505            } 
    545 #  ifdef ZEND_ENGINE_2_1 
    546506            /* php 5.1 introduces this in zend_arg_info for array type hinting */ 
    547507            to->arg_info[i].array_type_hint = from->arg_info[i].array_type_hint; 
    548 #  endif 
    549508            to->arg_info[i].allow_null = from->arg_info[i].allow_null; 
    550509            to->arg_info[i].pass_by_reference = from->arg_info[i].pass_by_reference; 
     
    553512    } 
    554513    to->pass_rest_by_reference = from->pass_rest_by_reference; 
    555 #else 
    556     if (from->arg_types != NULL) 
    557         to->arg_types = (unsigned char *)store_string(at, (char *)from->arg_types, (from->arg_types[0] + 1) * sizeof(zend_uchar) TSRMLS_CC); 
    558 #endif 
    559514    if (from->function_name != NULL) 
    560515        to->function_name = store_string(at, from->function_name, strlen(from->function_name) + 1 TSRMLS_CC); 
    561 #ifdef ZEND_ENGINE_2 
    562516    to->fn_flags = from->fn_flags; 
    563517    to->scope_name = NULL; 
     
    585539        } 
    586540    } 
    587 #endif 
    588541 
    589542    if (from->type == ZEND_INTERNAL_FUNCTION) { 
    590 #ifdef ZEND_ENGINE_2 
    591543        /* zend_internal_function also contains return_reference in ZE2 */ 
    592544        to->return_reference = from->return_reference; 
    593 #endif       
    594             return to; 
     545        return to; 
    595546    } 
    596547     
     
    600551    to->brk_cont_array = from->brk_cont_array; 
    601552    to->last_brk_cont = from->last_brk_cont; 
    602 #ifdef ZEND_ENGINE_2 
    603553    to->try_catch_array = from->try_catch_array; 
    604554    to->last_try_catch = from->last_try_catch; 
     
    610560        to->last_try_catch = 0; 
    611561    } 
    612 #else 
    613     to->uses_globals = from->uses_globals; 
    614 #endif 
    615562 
    616563    to->static_variables = from->static_variables; 
     
    632579                store_zval(at, &opline->op2.u.constant TSRMLS_CC); 
    633580            } 
    634 #ifdef ZEND_ENGINE_2 
    635581            switch (opline->opcode) { 
    636582            case ZEND_JMP: 
     
    644590                break; 
    645591            } 
    646 #endif 
    647592        } 
    648593        EAG(compress) = 1; 
     
    659604        store_zval_hash(at, to->static_variables, from->static_variables); 
    660605    } 
    661 #ifdef ZEND_ENGINE_2_1 
    662606    if (from->vars != NULL) { 
    663607            int i; 
     
    674618    to->line_start = from->line_start; 
    675619    to->line_end = from->line_end; 
    676 #  ifdef INCLUDE_DOC_COMMENTS 
     620#ifdef INCLUDE_DOC_COMMENTS 
    677621    to->doc_comment_len = from->doc_comment_len; 
    678622    if (from->doc_comment != NULL) { 
    679623        to->doc_comment = store_string(at, from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 
    680624    } 
    681 #  endif 
    682625#endif 
    683626 
     
    688631} 
    689632 
    690 #ifdef ZEND_ENGINE_2 
    691633static zend_property_info *store_property_info(char **at, zend_property_info * from TSRMLS_DC) 
    692634{ 
     
    697639    memcpy(to, from, sizeof(zend_property_info)); 
    698640    to->name = store_string(at, from->name, from->name_length + 1 TSRMLS_CC); 
    699 #ifdef ZEND_ENGINE_2_1 
    700 #  ifdef INCLUDE_DOC_COMMENTS 
     641#ifdef INCLUDE_DOC_COMMENTS 
    701642    to->doc_comment_len = from->doc_comment_len;  
    702643    if (from->doc_comment != NULL) {  
    703644       to->doc_comment = store_string(at, from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 
    704645    } 
    705 #  else 
     646#else 
    706647    to->doc_comment_len = 0; 
    707648    to->doc_comment = NULL; 
    708 #endif 
    709649#endif 
    710650    return to; 
     
    770710            } 
    771711            /* If the static member points to the same value in parent and child, remove for proper inheritance during restore */ 
    772 #  ifdef ZEND_ENGINE_2_1 
    773712            if(zend_hash_quick_find(&parent->default_static_members, p->arKey, p->nKeyLength, p->h, &pprop.ptr) == SUCCESS) { 
    774 #  else 
    775             if(zend_hash_quick_find(parent->static_members, p->arKey, p->nKeyLength, p->h, &pprop.ptr) == SUCCESS) { 
    776 #  endif 
    777713                if(*pprop.v == *cprop.v) { 
    778714                    return ZEND_HASH_APPLY_REMOVE; 
     
    802738    return ZEND_HASH_APPLY_REMOVE; 
    803739} 
    804 #endif 
    805740 
    806741static ea_class_entry *store_class_entry(char **at, zend_class_entry * from TSRMLS_DC) 
     
    831766    } 
    832767 
    833 #ifdef ZEND_ENGINE_2 /* php >= 5.0 */ 
    834768    to->ce_flags = from->ce_flags; 
    835769    to->static_members = NULL; 
     
    868802    store_hash(at, &to->properties_info, &from->properties_info, (store_bucket_t) store_property_info, (check_bucket_t) store_property_access_check, from); 
    869803     
    870 #  ifdef ZEND_ENGINE_2_1 /* php >= 5.1 */ 
    871804    if ((from->static_members != NULL) && (from->static_members != &from->default_static_members)) { 
    872805        store_zval_hash(at, &to->default_static_members, &from->default_static_members); 
     
    879812        to->static_members = &to->default_static_members; 
    880813    } 
    881 #  else /* php == 5.0 */ 
    882     if (from->static_members != NULL) { 
    883         to->static_members = (HashTable *)ALLOCATE(at, sizeof(HashTable)); 
    884  
    885         store_hash(at, to->static_members, from->static_members, (store_bucket_t) store_zval_ptr, (check_bucket_t) store_static_member_access_check, from); 
    886     }    
    887 #  endif 
    888814    store_hash(at, &to->function_table, &from->function_table, (store_bucket_t) store_op_array, (check_bucket_t) store_function_inheritance_check, from); 
    889815     
    890 #else /* PHP 4 */ 
    891     store_zval_hash(at, &to->default_properties, &from->default_properties); 
    892     store_hash(at, &to->function_table, &from->function_table, (store_bucket_t) store_op_array, NULL, NULL); 
    893 #endif 
    894  
    895816#ifdef DEBUG 
    896817    EAG(xpad)--; 
     
    940861        fc->htablen = c->nKeyLength; 
    941862        fc->next = NULL; 
    942 #ifdef ZEND_ENGINE_2 
    943863        fc->fc = *(zend_class_entry **) c->pData; 
    944 #else 
    945         fc->fc = c->pData; 
    946 #endif 
    947864        c = c->pListNext; 
    948865        x = fc->htabkey;