Changeset 1281 in svn for trunk/xcache/xc_utils.c


Ignore:
Timestamp:
2013-07-08T10:00:36+02:00 (2 years ago)
Author:
Xuefer
Message:

remove php 4 support completely

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache/xc_utils.c

    r1213 r1281  
    7878{
    7979    /* avoid duplicate apply for shadowed method */
    80 #ifdef ZEND_ENGINE_2
    8180    if (mi->ce != zf->common.scope) {
    8281        /* fprintf(stderr, "avoided duplicate %s\n", zf->common.function_name); */
    8382        return 0;
    8483    }
    85 #else
    86     char *name = zf->common.function_name;
    87     int name_s = strlen(name) + 1;
    88     zend_class_entry *ce;
    89     zend_function *ptr;
    90 
    91     for (ce = mi->ce->parent; ce; ce = ce->parent) {
    92         if (zend_hash_find(&ce->function_table, name, name_s, (void **) &ptr) == SUCCESS) {
    93             if (ptr->op_array.refcount == zf->op_array.refcount) {
    94                 return 0;
    95             }
    96         }
    97     }
    98 #endif
    9984    return xc_apply_function(zf, &mi->fi TSRMLS_CC);
    10085}
    10186/* }}} */
    102 static int xc_apply_cest(xc_cest_t *cest, xc_apply_func_info *fi TSRMLS_DC) /* {{{ */
     87static int xc_apply_class(zend_class_entry **ce, xc_apply_func_info *fi TSRMLS_DC) /* {{{ */
    10388{
    10489    xc_apply_method_info mi;
    10590
    10691    mi.fi = *fi;
    107     mi.ce = CestToCePtr(*cest);
    108     zend_hash_apply_with_argument(&(CestToCePtr(*cest)->function_table), (apply_func_arg_t) xc_apply_method, &mi TSRMLS_CC);
     92    mi.ce = *ce;
     93    zend_hash_apply_with_argument(&((*ce)->function_table), (apply_func_arg_t) xc_apply_method, &mi TSRMLS_CC);
    10994    return 0;
    11095}
     
    115100    fi.applyer = applyer;
    116101    zend_hash_apply_with_argument(cr->function_table, (apply_func_arg_t) xc_apply_function, &fi TSRMLS_CC);
    117     zend_hash_apply_with_argument(cr->class_table, (apply_func_arg_t) xc_apply_cest, &fi TSRMLS_CC);
     102    zend_hash_apply_with_argument(cr->class_table, (apply_func_arg_t) xc_apply_class, &fi TSRMLS_CC);
    118103
    119104    return applyer(cr->op_array TSRMLS_CC);
     
    278263static void xc_fix_opcode_ex_znode(int tofix, xc_op_spec_t spec, Z_OP_TYPEOF_TYPE *op_type, znode_op *op, int type TSRMLS_DC) /* {{{ */
    279264{
    280 #ifdef ZEND_ENGINE_2
    281265    if ((*op_type != IS_UNUSED && (spec == OPSPEC_UCLASS || spec == OPSPEC_CLASS)) ||
    282266            spec == OPSPEC_FETCH) {
     
    304288        }
    305289    }
    306 #endif
    307290}
    308291/* }}} */
     
    380363                break;
    381364
    382 #ifdef ZEND_ENGINE_2
    383365            case ZEND_DECLARE_INHERITED_CLASS:
    384366                callback(opline, opline - begin, data TSRMLS_CC);
    385367                break;
    386 #else
    387             case ZEND_DECLARE_FUNCTION_OR_CLASS:
    388                 if (opline->extended_value == ZEND_DECLARE_INHERITED_CLASS) {
    389                     callback(opline, opline - begin, data TSRMLS_CC);
    390                 }
    391                 break;
    392 #endif
    393368        }
    394369
     
    415390
    416391    switch (opline->opcode) {
    417 #ifdef ZEND_ENGINE_2
    418392    case ZEND_DECLARE_INHERITED_CLASS:
    419393        {
     
    464438            ZEND_VM_SET_OPCODE_HANDLER(abstract_op);
    465439        }
    466 #else
    467     case ZEND_DECLARE_FUNCTION_OR_CLASS:
    468         if (do_bind_function_or_class(opline, NULL, class_table, 1) == FAILURE) {
    469             return FAILURE;
    470         }
    471 #endif
    472440        break;
    473441
     
    531499                    NULL
    532500                    ) == FAILURE) {
    533             CG(zend_lineno) = ZESW(func->op_array.opcodes[0].lineno, func->op_array.line_start);
     501            CG(zend_lineno) = func->op_array.line_start;
    534502#ifdef IS_UNICODE
    535503            zend_error(E_ERROR, "Cannot redeclare %R()", type, key);
     
    541509}
    542510/* }}} */
    543 ZESW(xc_cest_t *, void) xc_install_class(ZEND_24(NOTHING, const) char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
     511void xc_install_class(ZEND_24(NOTHING, const) char *filename, zend_class_entry *ce, int oplineno, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
    544512{
    545513    zend_bool istmpkey;
    546     zend_class_entry *cep = CestToCePtr(*cest);
    547     ZESW(void *stored_ce_ptr, NOTHING);
    548514
    549515#ifdef IS_UNICODE
     
    554520    if (istmpkey) {
    555521        zend_u_hash_quick_update(CG(class_table), type, key, len, h,
    556                     cest, sizeof(xc_cest_t),
    557                     ZESW(&stored_ce_ptr, NULL)
     522                    ce, sizeof(zend_class_entry *),
     523                    NULL
    558524                    );
    559525#ifndef ZEND_COMPILE_DELAYED_BINDING
     
    564530    }
    565531    else if (zend_u_hash_quick_add(CG(class_table), type, key, len, h,
    566                 cest, sizeof(xc_cest_t),
    567                 ZESW(&stored_ce_ptr, NULL)
     532                ce, sizeof(zend_class_entry *),
     533                NULL
    568534                ) == FAILURE) {
    569         CG(zend_lineno) = ZESW(0, Z_CLASS_INFO(*cep).line_start);
     535        CG(zend_lineno) = Z_CLASS_INFO(*ce).line_start;
    570536#ifdef IS_UNICODE
    571         zend_error(E_ERROR, "Cannot redeclare class %R", type, cep->name);
    572 #else
    573         zend_error(E_ERROR, "Cannot redeclare class %s", cep->name);
     537        zend_error(E_ERROR, "Cannot redeclare class %R", type, ce->name);
     538#else
     539        zend_error(E_ERROR, "Cannot redeclare class %s", ce->name);
    574540#endif
    575541        assert(oplineno == -1);
    576542    }
    577     ZESW(return (xc_cest_t *) stored_ce_ptr, NOTHING);
    578543}
    579544/* }}} */
Note: See TracChangeset for help on using the changeset viewer.