[svn:ponie] r368 - trunk/perl

[email protected] 7 Dec 2005 20:33:35 -0000
Newsgroups perl.ponie.changes
Message-ID <[email protected]>
Author: nicholas
Date: Wed Dec  7 12:33:34 2005
New Revision: 368

Modified:
   trunk/perl/perl.h
   trunk/perl/sv.c
Log:
Convert the pointer table "new_val" into a union that can store U32s as well
as void *s. (With the intent of using the ptr_table for reference counting
instead)


Modified: trunk/perl/perl.h
==============================================================================
--- trunk/perl/perl.h	(original)
+++ trunk/perl/perl.h	Wed Dec  7 12:33:34 2005
@@ -2586,7 +2586,10 @@ typedef I32 CHECKPOINT;
 struct ptr_tbl_ent {
     struct ptr_tbl_ent*		next;
     void*			oldval;
-    void*			newval;
+    union {
+	void*			newval;
+	U32			count;
+    } val_u;
 };
 
 struct ptr_tbl {

Modified: trunk/perl/sv.c
==============================================================================
--- trunk/perl/sv.c	(original)
+++ trunk/perl/sv.c	Wed Dec  7 12:33:34 2005
@@ -9346,7 +9346,7 @@ Perl_ptr_table_delete(pTHX_ PTR_TBL_t *t
 	PTR_TBL_ENT_t *current = *tblent;
 	if (current->oldval == sv) {
 	    /* Found it.  */
-	    void *result = current->newval;
+	    void *result = current->val_u.newval;
 	    if (tbl->iteration_nesting == 0) {
 		*tblent = current->next;
 		S_del_pte(aTHX_ current);
@@ -9356,7 +9356,7 @@ Perl_ptr_table_delete(pTHX_ PTR_TBL_t *t
 		   actually delete this entry right now.  */
 		++tbl->pending_deletes;
 		current->oldval = 0;
-		current->newval = 0;
+		current->val_u.newval = 0;
 	    }
 	    return result;
 	}
@@ -9377,7 +9377,7 @@ Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *tb
     tblent = tbl->tbl_ary[hash & tbl->tbl_max];
     for (; tblent; tblent = tblent->next) {
 	if (tblent->oldval == sv)
-	    return tblent->newval;
+	    return tblent->val_u.newval;
     }
     return (void*)NULL;
 }
@@ -9398,13 +9398,13 @@ Perl_ptr_table_store(pTHX_ PTR_TBL_t *tb
     otblent = &tbl->tbl_ary[hash & tbl->tbl_max];
     for (tblent = *otblent; tblent; empty=0, tblent = tblent->next) {
 	if (tblent->oldval == oldv) {
-	    tblent->newval = newv;
+	    tblent->val_u.newval = newv;
 	    return;
 	}
     }
     tblent = S_new_pte(aTHX);
     tblent->oldval = oldv;
-    tblent->newval = newv;
+    tblent->val_u.newval = newv;
     tblent->next = *otblent;
     *otblent = tblent;
     tbl->tbl_items++;