# HG changeset patch # User Mike Pavone # Date 1280889505 14400 # Node ID fa437d23bb248a487eeede853d6ac237dee32c6f # Parent 5a08705f76105ceea46e20b4a7c25843274ef483 fix memory corruption bug diff -r 5a08705f7610 -r fa437d23bb24 dict.rhope --- 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] diff -r 5a08705f7610 -r fa437d23bb24 list.rhope --- 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] } } diff -r 5a08705f7610 -r fa437d23bb24 runtime/array.c --- 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 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;