Changeset 935 in svn


Ignore:
Timestamp:
2012-06-28T09:38:59+02:00 (3 years ago)
Author:
Xuefer
Message:

simplify sandbox/compiler_result code, removed alloc

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/utils.c

    r930 r935  
    4242        HashTable *class_table)
    4343{
    44     if (cr) {
    45         cr->alloc = 0;
    46     }
    47     else {
    48         cr = emalloc(sizeof(xc_compile_result_t));
    49         cr->alloc = 1;
    50     }
     44    assert(cr);
    5145    cr->op_array       = op_array;
    5246    cr->function_table = function_table;
     
    5751xc_compile_result_t *xc_compile_result_init_cur(xc_compile_result_t *cr, zend_op_array *op_array TSRMLS_DC) /* {{{ */
    5852{
     53    assert(cr);
    5954    return xc_compile_result_init(cr, op_array, CG(function_table), CG(class_table));
    6055}
     
    6257void xc_compile_result_free(xc_compile_result_t *cr) /* {{{ */
    6358{
    64     if (cr->alloc) {
    65         efree(cr);
    66     }
    6759}
    6860/* }}} */
     
    743735    HashTable *h;
    744736
    745     if (sandbox) {
    746         memset(sandbox, 0, sizeof(sandbox[0]));
    747     }
    748     else {
    749         ECALLOC_ONE(sandbox);
    750         sandbox->alloc = 1;
    751     }
     737    assert(sandbox);
     738    memset(sandbox, 0, sizeof(sandbox[0]));
    752739
    753740    memcpy(&OG(included_files), &EG(included_files), sizeof(EG(included_files)));
     
    972959    CG(compiler_options) = sandbox->orig_compiler_options;
    973960#endif
    974 
    975     if (sandbox->alloc) {
    976         efree(sandbox);
    977     }
    978961}
    979962/* }}} */
  • trunk/utils.h

    r903 r935  
    4545
    4646typedef struct {
    47     int alloc;
    4847    zend_op_array *op_array;
    4948    HashTable *function_table;
     
    8382/* sandbox */
    8483typedef struct {
    85     int alloc;
    8684    ZEND_24(NOTHING, const) char *filename;
    8785
Note: See TracChangeset for help on using the changeset viewer.