Ticket #1350: bigint.pmc.patch

File bigint.pmc.patch, 1.3 KB (added by jimmy, 12 years ago)
  • src/pmc/bigint.pmc

     
    3737 
    3838static void 
    3939bigint_init(PARROT_INTERP, PMC *self) { 
    40     Parrot_BigInt_attributes *attrs = 
    41         mem_allocate_zeroed_typed(Parrot_BigInt_attributes); 
    42     attrs->bi = mem_allocate_zeroed_typed(BIGINT); 
    43     mpz_init(attrs->bi->b); 
    44     PMC_data(self) = attrs; 
     40    BIGINT * const bi = mem_allocate_zeroed_typed(BIGINT); 
     41    SETATTR_BigInt_bi(interp, self, bi); 
     42    mpz_init(bi->b); 
    4543} 
    4644 
    4745static void 
    4846bigint_clear(PARROT_INTERP, PMC *self) { 
    49     BIGINT *bi; 
     47    BIGINT * bi; 
    5048    GETATTR_BigInt_bi(interp, self, bi); 
    5149    mpz_clear(bi->b); 
     50    mem_sys_free(bi); 
    5251} 
    5352 
    5453static void 
     
    562561 
    563562#endif /* ifdef PARROT_HAS_GMP */ 
    564563 
    565 pmclass BigInt { 
     564pmclass BigInt auto_attrs { 
    566565    ATTR struct BIGINT * bi; /*bigint val*/ 
    567566 
    568567/* 
     
    603602    } 
    604603 
    605604    VTABLE void destroy() { 
    606         BIGINT                   *bi; 
    607         Parrot_BigInt_attributes *attrs; 
    608  
    609605        bigint_clear(INTERP, SELF); 
    610  
    611         attrs = (Parrot_BigInt_attributes*)PMC_data(SELF); 
    612         mem_sys_free(attrs->bi); 
    613         mem_sys_free(attrs); 
    614         PMC_data(SELF) = NULL; 
    615606    } 
    616607 
    617608/*