Ticket #8283: fix-lame-object-copying.patch

File fix-lame-object-copying.patch, 608 bytes (added by Kohei Takahashi <flast@…>, 10 years ago)
  • engine/lists.c

    diff --git a/engine/lists.c b/engine/lists.c
    index e982719..44b3785 100644
    a b LIST * list_new( OBJECT * value )  
    107107{
    108108    LIST * const head = list_alloc( 1 ) ;
    109109    head->impl.size = 1;
    110     list_begin( head )[ 0 ] = value;
     110    list_begin( head )[ 0 ] = object_copy( value );
    111111    return head;
    112112}
    113113
    LIST * list_push_back( LIST * head, OBJECT * value )  
    136136        head = l;
    137137    }
    138138
    139     list_begin( head )[ size ] = value;
     139    list_begin( head )[ size ] = object_copy( value );
    140140    head->impl.size = size + 1;
    141141
    142142    return head;