changeset 97:fa437d23bb24

fix memory corruption bug
author Mike Pavone <pavone@retrodev.com>
date Tue, 03 Aug 2010 22:38:25 -0400
parents 5a08705f7610
children a34a982ecd32
files dict.rhope list.rhope runtime/array.c
diffstat 3 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/dict.rhope	Mon Aug 02 05:12:19 2010 -0400
+++ b/dict.rhope	Tue Aug 03 22:38:25 2010 -0400
@@ -238,14 +238,14 @@
 	}
 }
 
-_Print Seq[dict,key]
+_Print Seq[dict,key:out]
 {
 	val <- String[[dict]Index[key]]
 	Print[ [[["\t"]Append[String[key]]]Append[":\t"]]Append[val] ]
 	{
-		[dict]Next[key]
+		,out <- [dict]Next[key]
 		{
-			_Print Seq[dict, ~]
+			out <- _Print Seq[dict, ~]
 		}
 	}
 }
@@ -253,12 +253,12 @@
 Print@Dictionary[dict:out]
 {
 	Print["Dictionary"]
-	{ _Print Seq[dict, [dict]First] }
+	{ out <- _Print Seq[dict, [dict]First] }
 }
 
 Print@Empty Dictionary[dict:out]
 {
-	Print["Dictionary\n\t{Empty}"]
+	out <- Print["Dictionary\n\t{Empty}"]
 }
 
 Length@Empty Dictionary[dict:out]
--- a/list.rhope	Mon Aug 02 05:12:19 2010 -0400
+++ b/list.rhope	Tue Aug 03 22:38:25 2010 -0400
@@ -319,15 +319,15 @@
 	If[[[list]Buffer >>]Length]
 	{
 		Print["List"]
-		{ _Print Seq[list, [list]First] }
+		{ out <- _Print Seq[list, [list]First] }
 	}{
-		Print["List\n\t{Empty}"]
+		out <- Print["List\n\t{Empty}"]
 	}	
 }
 
 Print@List[list:out]
 {
 	Print["List"]
-	{ _Print Seq[list, [list]First] }
+	{ out <- _Print Seq[list, [list]First] }
 }
 
--- a/runtime/array.c	Mon Aug 02 05:12:19 2010 -0400
+++ b/runtime/array.c	Tue Aug 03 22:38:25 2010 -0400
@@ -1,5 +1,6 @@
 #include "integer.h"
 #include "object.h"
+#include <stdio.h>
 
 void _internal_array_copyout(object * array, int32_t index, object * dest)
 {
@@ -76,7 +77,7 @@
 object * _internal_array_allocnakedcopy(object * osource, int32_t size)
 {
 	int32_t tocopy,idx;
-	object *cur;
+	char *cur;
 	t_Array * ret, *source = (t_Array *)osource;
 	t_Blueprint * bp = source->payload.Eltype;
 	
@@ -86,7 +87,6 @@
 	add_ref((object *)bp);
 	ret->payload.Eltype = bp;
 	tocopy = size < source->payload.Length ? size : source->payload.Length;
-
 	memcpy(ret+1, source+1, tocopy*bp->bp->size);
 	//Lower type IDs don't have any reference params so we can safely skip this for those
 	if(bp->bp->type_id >= TYPE_ARRAY)
@@ -99,6 +99,7 @@
 			cur += bp->bp->size;
 		}
 	}
+	fflush(stdout);
 	release_ref(osource);
 	
 	return (object *)ret;