Ticket #1350 (closed patch: fixed)
[patch]changed bigint.pmc to use GET_ATTR syntax
| Reported by: | jimmy | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | core | Version: | 1.8.0 |
| Severity: | medium | Keywords: | |
| Cc: | Language: | ||
| Patch status: | new | Platform: |
Description
changed bigint.pmc to use GET_ATTR syntax
Index: src/pmc/bigint.pmc
===================================================================
--- src/pmc/bigint.pmc (版本 42868)
+++ src/pmc/bigint.pmc (工作副本)
@@ -37,18 +37,17 @@
static void
bigint_init(PARROT_INTERP, PMC *self) {
- Parrot_BigInt_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_BigInt_attributes);
- attrs->bi = mem_allocate_zeroed_typed(BIGINT);
- mpz_init(attrs->bi->b);
- PMC_data(self) = attrs;
+ BIGINT * const bi = mem_allocate_zeroed_typed(BIGINT);
+ SETATTR_BigInt_bi(interp, self, bi);
+ mpz_init(bi->b);
}
static void
bigint_clear(PARROT_INTERP, PMC *self) {
- BIGINT *bi;
+ BIGINT * bi;
GETATTR_BigInt_bi(interp, self, bi);
mpz_clear(bi->b);
+ mem_sys_free(bi);
}
static void
@@ -562,7 +561,7 @@
#endif /* ifdef PARROT_HAS_GMP */
-pmclass BigInt {
+pmclass BigInt auto_attrs {
ATTR struct BIGINT * bi; /*bigint val*/
/*
@@ -603,15 +602,7 @@
}
VTABLE void destroy() {
- BIGINT *bi;
- Parrot_BigInt_attributes *attrs;
-
bigint_clear(INTERP, SELF);
-
- attrs = (Parrot_BigInt_attributes*)PMC_data(SELF);
- mem_sys_free(attrs->bi);
- mem_sys_free(attrs);
- PMC_data(SELF) = NULL;
}
/*
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

