From: Joe Groff Date: Mon, 31 Aug 2009 22:49:55 +0000 (-0500) Subject: Merge branch 'master' of git://factorcode.org/git/factor X-Git-Tag: 0.97~5641 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=0834b8270c71d6dfebcae6731a85db1357b53a83 Merge branch 'master' of git://factorcode.org/git/factor --- 0834b8270c71d6dfebcae6731a85db1357b53a83 diff --cc basis/struct-arrays/struct-arrays.factor index a378754590,390a03455d..53815c7da4 --- a/basis/struct-arrays/struct-arrays.factor +++ b/basis/struct-arrays/struct-arrays.factor @@@ -41,17 -60,12 +60,15 @@@ M: struct-array resize ( n seq -- newse ERROR: bad-byte-array-length byte-array ; : byte-array>struct-array ( byte-array c-type -- struct-array ) - [ heap-size [ + [ + heap-size [ dup length ] dip /mod 0 = [ drop bad-byte-array-length ] unless - ] keep ] [ c-type-struct-class ] bi struct-array boa ; inline - - : ( alien length c-type -- struct-array ) - [ heap-size ] [ c-type-struct-class ] bi struct-array boa ; inline + ] keep ; inline +: struct-array-on ( struct length -- struct-array ) + [ [ >c-ptr ] [ class ] bi ] dip swap ; inline + : malloc-struct-array ( length c-type -- struct-array ) [ heap-size calloc ] 2keep ; inline