Changeset 228 for trunk


Ignore:
Timestamp:
2006-10-08T08:46:14+02:00 (9 years ago)
Author:
moo
Message:

fixed #45, more robust xc_coverager_get_op_array_size_no_tail

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/coverager.c

    r212 r228  
    396396
    397397    size = op_array->size;
    398 #ifdef ZEND_ENGINE_2
    399     if (op_array->opcodes[size - 1].opcode == ZEND_HANDLE_EXCEPTION) {
    400         size --;
    401 #endif
    402         if (op_array->opcodes[size - 1].opcode == ZEND_RETURN) {
    403             size --;
    404             /* it's not real php statement */
    405             if (op_array->opcodes[size - 1].opcode == ZEND_EXT_STMT) {
     398    do {
     399next_op:
     400        if (size == 0) {
     401            break;
     402        }
     403        switch (op_array->opcodes[size - 1].opcode) {
     404#ifdef ZEND_HANDLE_EXCEPTION
     405            case ZEND_HANDLE_EXCEPTION:
     406#endif
     407            case ZEND_RETURN:
     408            case ZEND_EXT_STMT:
    406409                size --;
    407             }
    408         }   
    409 #ifdef ZEND_ENGINE_2
    410     }
    411 #endif
     410                goto next_op;
     411        }
     412    } while (0);
    412413    return size;
    413414}
Note: See TracChangeset for help on using the changeset viewer.