Show
Ignore:
Timestamp:
02/13/07 16:11:14 (2 years ago)
Author:
bart
Message:

Cleanup: Removed some commented out code, changed some debug statements,

reordered some conditional includes to reduce ifdef statements

Files:

Legend:

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

    r290 r291  
    583583        } 
    584584#endif 
    585         to->opcodes = from->opcodes; 
    586         to->last = to->size = from->last; 
    587         to->T = from->T; 
    588         to->brk_cont_array = from->brk_cont_array; 
    589         to->last_brk_cont = from->last_brk_cont; 
    590          
    591            to->current_brk_cont = -1; 
    592            to->static_variables = from->static_variables; 
    593 /*         to->start_op         = to->opcodes; */ 
    594            to->backpatch_count  = 0; 
    595          
    596         to->return_reference = from->return_reference; 
    597         to->done_pass_two = 1; 
    598         to->filename = from->filename; 
    599 /*      if (from->filename != NULL) { 
    600                 size_t len = strlen(from->filename) + 1; 
    601                 to->filename = emalloc(len); 
    602                 memcpy(to->filename, from->filename, len); 
    603         }*/ 
    604  
    605 #ifdef ZEND_ENGINE_2 
    606         /* HOESH: try & catch support */ 
    607         to->try_catch_array = from->try_catch_array; 
    608         to->last_try_catch = from->last_try_catch; 
     585    to->opcodes = from->opcodes; 
     586    to->last = to->size = from->last; 
     587    to->T = from->T; 
     588    to->brk_cont_array = from->brk_cont_array; 
     589    to->last_brk_cont = from->last_brk_cont; 
     590 
     591    to->current_brk_cont = -1; 
     592    to->static_variables = from->static_variables; 
     593    to->backpatch_count  = 0; 
     594 
     595    to->return_reference = from->return_reference; 
     596    to->done_pass_two = 1; 
     597    to->filename = from->filename; 
     598 
     599#ifdef ZEND_ENGINE_2 
     600    to->try_catch_array = from->try_catch_array; 
     601    to->last_try_catch = from->last_try_catch; 
    609602        to->uses_this = from->uses_this; 
    610603 
     
    639632        to->last_var         = from->last_var; 
    640633        to->size_var         = 0; 
    641 /*      if (from->vars) { 
    642                 zend_uint i; 
    643                 to->vars = (zend_compiled_variable*)emalloc(from->last_var*sizeof(zend_compiled_variable));              
    644                 memcpy(to->vars, from->vars, sizeof(zend_compiled_variable) * from->last_var); 
    645                 for (i = 0; i < from->last_var; i ++) { 
    646                         to->vars[i].name = estrndup(from->vars[i].name, from->vars[i].name_len); 
    647                 } 
    648         }*/ 
    649634#endif 
    650635 
     
    795780        memset(to, 0, sizeof(zend_class_entry)); 
    796781        to->type = from->type; 
    797         /* 
    798            to->name        = NULL; 
    799            to->name_length = from->name_length; 
    800            to->constants_updated = 0; 
    801            to->parent      = NULL; 
    802          */ 
    803 #ifdef ZEND_ENGINE_2 
    804         to->ce_flags = from->ce_flags; 
    805         to->num_interfaces = from->num_interfaces; 
    806         to->interfaces = NULL; 
    807  
    808         if (to->num_interfaces > 0) { 
    809                 /* hrak: Allocate the slots which will later be populated by ZEND_ADD_INTERFACE */ 
    810                 to->interfaces = (zend_class_entry **) emalloc(sizeof(zend_class_entry *) * to->num_interfaces); 
    811                 memset(to->interfaces, 0, sizeof(zend_class_entry *) * to->num_interfaces); 
    812         } 
    813 #endif 
    814782 
    815783        if (from->name != NULL) { 
     
    823791 
    824792#ifdef ZEND_ENGINE_2 
     793    to->ce_flags = from->ce_flags; 
     794    to->num_interfaces = from->num_interfaces; 
     795    to->interfaces = NULL; 
    825796        to->refcount = 1; 
    826  
    827797        to->line_start = from->line_start; 
    828798        to->line_end = from->line_end; 
     799     
     800    if (to->num_interfaces > 0) { 
     801        /* hrak: Allocate the slots which will later be populated by ZEND_ADD_INTERFACE */ 
     802        to->interfaces = (zend_class_entry **) emalloc(sizeof(zend_class_entry *) * to->num_interfaces); 
     803        memset(to->interfaces, 0, sizeof(zend_class_entry *) * to->num_interfaces); 
     804    } 
    829805#ifdef INCLUDE_DOC_COMMENTS 
    830806        to->doc_comment_len = from->doc_comment_len; 
     807    if (from->doc_comment != NULL) { 
     808        to->doc_comment = emalloc(from->doc_comment_len + 1); 
     809        memcpy(to->doc_comment, from->doc_comment, from->doc_comment_len + 1); 
     810    } 
    831811#else 
    832812        to->doc_comment_len = 0; 
    833813    to->doc_comment = NULL; 
    834814#endif 
    835 /*      if (from->filename != NULL) { 
    836                 size_t len = strlen(from->filename) + 1; 
    837                 to->filename = emalloc(len); 
    838                 memcpy(to->filename, from->filename, len); 
    839         }*/ 
    840         to->filename = from->filename; 
    841 #ifdef INCLUDE_DOC_COMMENTS 
    842      if (from->doc_comment != NULL) { 
    843      to->doc_comment = emalloc(from->doc_comment_len + 1); 
    844      memcpy(to->doc_comment, from->doc_comment, from->doc_comment_len + 1); 
    845      } 
    846 #endif 
     815 
     816    to->filename = from->filename; 
    847817 
    848818        /* restore constants table */ 
     
    853823        to->default_properties.pDestructor = ZVAL_PTR_DTOR; 
    854824        /* restore properties */ 
    855         restore_hash(&to->properties_info, &from->properties_info,  
    856             (restore_bucket_t) restore_property_info TSRMLS_CC); 
     825        restore_hash(&to->properties_info, &from->properties_info, (restore_bucket_t) restore_property_info TSRMLS_CC); 
    857826        to->properties_info.pDestructor = properties_info_dtor; 
    858827 
     
    891860        } 
    892861#endif 
     862 
    893863        if (from->parent != NULL) { 
    894864                restore_class_parent(from->parent, strlen(from->parent), to TSRMLS_CC); 
     
    905875        restore_class_methods(to TSRMLS_CC); 
    906876#endif 
    907         if (to->parent) 
     877 
     878        if (to->parent) { 
    908879#ifdef ZEND_ENGINE_2 
    909880                zend_do_inheritance(to, to->parent TSRMLS_CC); 
     
    911882        zend_do_inheritance(to, to->parent); 
    912883#endif 
     884    } 
    913885        EAG(class_entry) = old; 
    914886