]> gitweb.factorcode.org Git - factor.git/commitdiff
checksums: inherit checksum-state from disposable
authorAlexander Iljin <ajsoft@yandex.ru>
Wed, 29 Jul 2020 16:33:25 +0000 (18:33 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 29 Jul 2020 17:42:02 +0000 (17:42 +0000)
This allows the inherited tuples, including block-checksum-state, to be
treated like the normal disposable tuples, instead of imitating only part
of the interface.

core/checksums/checksums.factor

index c5fc5f7058a093ffed59dc3668fdcb1afc4fc770..4503ee05ff4606d2adb52e9dc6d478e946f58624 100644 (file)
@@ -23,16 +23,18 @@ M: checksum checksum-lines
 : checksum-file ( path checksum -- value )
     [ binary <file-reader> ] dip checksum-stream ;
 
-TUPLE: checksum-state checksum { bytes byte-vector } ;
+TUPLE: checksum-state < disposable
+    checksum
+    { bytes byte-vector } ;
 
-M: checksum-state dispose drop ;
+M: checksum-state dispose* drop ;
 
 M: checksum-state clone
     call-next-method
     [ clone ] change-bytes ;
 
 : new-checksum-state ( class -- checksum-state )
-    new BV{ } clone >>bytes ;
+    new-disposable BV{ } clone >>bytes ;
 
 GENERIC: initialize-checksum-state ( checksum -- checksum-state )
 GENERIC#: add-checksum-bytes 1 ( checksum-state data -- checksum-state )