Ticket #1350: bigint.pmc.patch
File bigint.pmc.patch, 1.3 KB (added by jimmy, 12 years ago) |
---|
-
src/pmc/bigint.pmc
37 37 38 38 static void 39 39 bigint_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); 45 43 } 46 44 47 45 static void 48 46 bigint_clear(PARROT_INTERP, PMC *self) { 49 BIGINT * bi;47 BIGINT * bi; 50 48 GETATTR_BigInt_bi(interp, self, bi); 51 49 mpz_clear(bi->b); 50 mem_sys_free(bi); 52 51 } 53 52 54 53 static void … … 562 561 563 562 #endif /* ifdef PARROT_HAS_GMP */ 564 563 565 pmclass BigInt {564 pmclass BigInt auto_attrs { 566 565 ATTR struct BIGINT * bi; /*bigint val*/ 567 566 568 567 /* … … 603 602 } 604 603 605 604 VTABLE void destroy() { 606 BIGINT *bi;607 Parrot_BigInt_attributes *attrs;608 609 605 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;615 606 } 616 607 617 608 /*