Changeset 27 in svn for trunk/coverager.c


Ignore:
Timestamp:
2006-05-26T02:30:20Z (9 years ago)
Author:
Xuefer
Message:

rename coverage -> coverager

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/coverager.c

    r17 r27  
    1111#include "stack.h"
    1212#include "xcache_globals.h"
    13 #include "coverage.h"
     13#include "coverager.h"
    1414#include "utils.h"
    15 typedef HashTable *coverage_t;
     15typedef HashTable *coverager_t;
    1616#define PCOV_HEADER_MAGIC 0x564f4350
    1717
     
    2323static void xc_destroy_coverage(void *pDest) /* {{{ */
    2424{
    25     coverage_t cov = *(coverage_t*) pDest;
     25    coverager_t cov = *(coverager_t*) pDest;
    2626#ifdef DEBUG
    2727    fprintf(stderr, "destroy %p\n", cov);
     
    6565}
    6666/* }}} */
    67 static void xc_coverage_save_cov(char *srcfile, char *outfilename, coverage_t cov TSRMLS_DC) /* {{{ */
     67static void xc_coverager_save_cov(char *srcfile, char *outfilename, coverager_t cov TSRMLS_DC) /* {{{ */
    6868{
    6969    long *buf = NULL, *p;
     
    193193}
    194194/* }}} */
    195 void xc_coverage_request_init(TSRMLS_D) /* {{{ */
     195void xc_coverager_request_init(TSRMLS_D) /* {{{ */
    196196{
    197197    if (XG(coveragedumper)) {
     
    201201}
    202202/* }}} */
    203 void xc_coverage_request_shutdown(TSRMLS_D) /* {{{ */
    204 {
    205     coverage_t *pcov;
     203void xc_coverager_request_shutdown(TSRMLS_D) /* {{{ */
     204{
     205    coverager_t *pcov;
    206206    zstr s;
    207207    char *outfilename;
     
    231231            fprintf(stderr, "outfilename %s\n", outfilename);
    232232#endif
    233             xc_coverage_save_cov(ZSTR_S(s), outfilename, *pcov TSRMLS_CC);
     233            xc_coverager_save_cov(ZSTR_S(s), outfilename, *pcov TSRMLS_CC);
    234234            zend_hash_move_forward(XG(coverages));
    235235        }
     
    243243
    244244/* helper func to store hits into coverages */
    245 static coverage_t xc_coverage_get(char *filename TSRMLS_DC) /* {{{ */
     245static coverager_t xc_coverager_get(char *filename TSRMLS_DC) /* {{{ */
    246246{
    247247    int len = strlen(filename) + 1;
    248     coverage_t cov, *pcov;
     248    coverager_t cov, *pcov;
    249249
    250250    if (zend_hash_find(XG(coverages), filename, len, (void **) &pcov) == SUCCESS) {
     
    265265}
    266266/* }}} */
    267 static void xc_coverage_add_hits(HashTable *cov, long line, long hits TSRMLS_DC) /* {{{ */
     267static void xc_coverager_add_hits(HashTable *cov, long line, long hits TSRMLS_DC) /* {{{ */
    268268{
    269269    long *poldhits;
     
    285285/* }}} */
    286286
    287 static int xc_coverage_get_op_array_size_no_tail(zend_op_array *op_array) /* {{{ */
     287static int xc_coverager_get_op_array_size_no_tail(zend_op_array *op_array) /* {{{ */
    288288{
    289289    zend_uint size;
     
    309309
    310310/* prefill */
    311 static int xc_coverage_init_op_array(zend_op_array *op_array TSRMLS_DC) /* {{{ */
     311static int xc_coverager_init_op_array(zend_op_array *op_array TSRMLS_DC) /* {{{ */
    312312{
    313313    zend_uint size;
    314     coverage_t cov;
     314    coverager_t cov;
    315315    zend_uint i;
    316316
     
    319319    }
    320320
    321     size = xc_coverage_get_op_array_size_no_tail(op_array);
    322     cov = xc_coverage_get(op_array->filename TSRMLS_CC);
     321    size = xc_coverager_get_op_array_size_no_tail(op_array);
     322    cov = xc_coverager_get(op_array->filename TSRMLS_CC);
    323323    for (i = 0; i < size; i ++) {
    324324        switch (op_array->opcodes[i].opcode) {
     
    328328            case ZEND_EXT_FCALL_END:
    329329#endif
    330                 xc_coverage_add_hits(cov, op_array->opcodes[i].lineno, -1 TSRMLS_CC);
     330                xc_coverager_add_hits(cov, op_array->opcodes[i].lineno, -1 TSRMLS_CC);
    331331                break;
    332332        }
     
    335335}
    336336/* }}} */
    337 static void xc_coverage_init_compile_result(zend_op_array *op_array TSRMLS_DC) /* {{{ */
     337static void xc_coverager_init_compile_result(zend_op_array *op_array TSRMLS_DC) /* {{{ */
    338338{
    339339    xc_compile_result_t cr;
    340340
    341341    xc_compile_result_init_cur(&cr, op_array TSRMLS_CC);
    342     xc_apply_op_array(&cr, (apply_func_t) xc_coverage_init_op_array TSRMLS_CC);
     342    xc_apply_op_array(&cr, (apply_func_t) xc_coverager_init_op_array TSRMLS_CC);
    343343    xc_compile_result_free(&cr);
    344344}
     
    350350    op_array = origin_compile_file(h, type TSRMLS_CC);
    351351    if (XG(coveragedumper) && XG(coverages)) {
    352         xc_coverage_init_compile_result(op_array TSRMLS_CC);
     352        xc_coverager_init_compile_result(op_array TSRMLS_CC);
    353353    }
    354354    return op_array;
     
    357357
    358358/* hits */
    359 void xc_coverage_handle_ext_stmt(zend_op_array *op_array, zend_uchar op) /* {{{ */
     359void xc_coverager_handle_ext_stmt(zend_op_array *op_array, zend_uchar op) /* {{{ */
    360360{
    361361    TSRMLS_FETCH();
    362362
    363363    if (XG(coveragedumper) && XG(coverages)) {
    364         int size = xc_coverage_get_op_array_size_no_tail(op_array);
     364        int size = xc_coverager_get_op_array_size_no_tail(op_array);
    365365        int oplineno = (*EG(opline_ptr)) - op_array->opcodes;
    366366        if (oplineno < size) {
    367             xc_coverage_add_hits(xc_coverage_get(op_array->filename TSRMLS_CC), (*EG(opline_ptr))->lineno, 1 TSRMLS_CC);
     367            xc_coverager_add_hits(xc_coverager_get(op_array->filename TSRMLS_CC), (*EG(opline_ptr))->lineno, 1 TSRMLS_CC);
    368368        }
    369369    }
     
    372372
    373373/* init/destroy */
    374 int xc_coverage_init(int module_number TSRMLS_DC) /* {{{ */
     374int xc_coverager_init(int module_number TSRMLS_DC) /* {{{ */
    375375{
    376376    if (xc_coveragedump_dir) {
     
    390390}
    391391/* }}} */
    392 void xc_coverage_destroy() /* {{{ */
     392void xc_coverager_destroy() /* {{{ */
    393393{
    394394    if (origin_compile_file == xc_compile_file_for_coverage) {
     
    403403
    404404/* user api */
    405 PHP_FUNCTION(xcache_coverage_decode) /* {{{ */
     405PHP_FUNCTION(xcache_coverager_decode) /* {{{ */
    406406{
    407407    char *str;
     
    422422    if (*p++ != PCOV_HEADER_MAGIC) {
    423423#ifdef DEBUG
    424         fprintf(stderr, "wrong magic in xcache_coverage_decode");
     424        fprintf(stderr, "wrong magic in xcache_coverager_decode");
    425425#endif
    426426        return;
Note: See TracChangeset for help on using the changeset viewer.