From b1135e3d40203a90e9ea126ad842db6295e76709 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Fri, 6 May 2005 18:38:45 +0000 Subject: [PATCH] Change types of PL_he_arenaroot and PL_pte_arenaroot to avoid casting. p4raw-id: //depot/perl@24408 --- hv.c | 8 +++----- intrpvar.h | 4 ++-- sv.c | 26 ++++++++++++++++---------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/hv.c b/hv.c index 2f2c7f3..9ab43b8 100644 --- a/hv.c +++ b/hv.c @@ -60,12 +60,10 @@ S_more_he(pTHX) { register HE* he; register HE* heend; - XPV *ptr; - New(54, ptr, PERL_ARENA_SIZE/sizeof(XPV), XPV); - ptr->xpv_pv = (char*)PL_he_arenaroot; - PL_he_arenaroot = ptr; + New(54, he, PERL_ARENA_SIZE/sizeof(HE), HE); + HeNEXT(he) = PL_he_arenaroot; + PL_he_arenaroot = he; - he = (HE*)ptr; heend = &he[PERL_ARENA_SIZE / sizeof(HE) - 1]; PL_he_root = ++he; while (he < heend) { diff --git a/intrpvar.h b/intrpvar.h index 2125acf..9688541 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -437,8 +437,8 @@ PERLVAR(Ixpvhv_arenaroot,XPVHV*) /* list of allocated xpvhv areas */ PERLVAR(Ixpvmg_arenaroot,XPVMG*) /* list of allocated xpvmg areas */ PERLVAR(Ixpvlv_arenaroot,XPVLV*) /* list of allocated xpvlv areas */ PERLVAR(Ixpvbm_arenaroot,XPVBM*) /* list of allocated xpvbm areas */ -PERLVAR(Ihe_arenaroot, XPV*) /* list of allocated he areas */ -PERLVAR(Ipte_arenaroot, XPV*) /* list of allocated he areas */ +PERLVAR(Ihe_arenaroot, HE *) /* list of allocated he areas */ +PERLVAR(Ipte_arenaroot, struct ptr_tbl_ent *) /* list of allocated he areas */ /* 5.6.0 stopped here */ diff --git a/sv.c b/sv.c index f1cffd0..64eea01 100644 --- a/sv.c +++ b/sv.c @@ -614,16 +614,24 @@ Perl_sv_free_arenas(pTHX) PL_xpvbm_arenaroot = 0; PL_xpvbm_root = 0; - for (arena = (XPV*)PL_he_arenaroot; arena; arena = arenanext) { - arenanext = (XPV*)arena->xpv_pv; - Safefree(arena); + { + HE *he; + HE *he_next; + for (he = PL_he_arenaroot; he; he = he_next) { + he_next = HeNEXT(he); + Safefree(he); + } } PL_he_arenaroot = 0; PL_he_root = 0; - for (arena = (XPV*)PL_pte_arenaroot; arena; arena = arenanext) { - arenanext = (XPV*)arena->xpv_pv; - Safefree(arena); + { + struct ptr_tbl_ent *pte; + struct ptr_tbl_ent *pte_next; + for (pte = PL_pte_arenaroot; pte; pte = pte_next) { + pte_next = pte->next; + Safefree(pte); + } } PL_pte_arenaroot = 0; PL_pte_root = 0; @@ -10426,12 +10434,10 @@ S_more_pte(pTHX) { register struct ptr_tbl_ent* pte; register struct ptr_tbl_ent* pteend; - XPV *ptr; - New(54, ptr, PERL_ARENA_SIZE/sizeof(XPV), XPV); - ptr->xpv_pv = (char*)PL_pte_arenaroot; + New(0, ptr, PERL_ARENA_SIZE/sizeof(struct ptr_tbl_ent), struct ptr_tbl_ent); + ptr->next = PL_pte_arenaroot; PL_pte_arenaroot = ptr; - pte = (struct ptr_tbl_ent*)ptr; pteend = &pte[PERL_ARENA_SIZE / sizeof(struct ptr_tbl_ent) - 1]; PL_pte_root = ++pte; while (pte < pteend) { -- 2.7.4