]> Cypherpunks repositories - dsc.git/commitdiff
No need in dict
authorSergey Matveev <stargrave@stargrave.org>
Wed, 24 Dec 2025 11:42:58 +0000 (14:42 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 24 Dec 2025 11:42:58 +0000 (14:42 +0300)
dsc

diff --git a/dsc b/dsc
index 50186ebedaff0f22de910167563702aa5e719992950d085f42da12ad80728882..779367c364ab644545acd56316052925fc464f02c2b5090eb93fb394026abf66 100755 (executable)
--- a/dsc
+++ b/dsc
@@ -58,16 +58,16 @@ if {[info exists env(DSC_SCHEMA)]} {set Schema $env(DSC_SCHEMA)} {set Schema sch
 if {[info exists env(DSC_STASH)]} {set Stash $env(DSC_STASH)} {set Stash stash}
 if {[info exists env(DSC_SAVED)]} {set Saved $env(DSC_SAVED)} {set Saved saved}
 if {[info exists env(DSC_HASHES)]} {
-    set Hashes [dict create]
+    set Hashes [list]
     foreach pair [split $env(DSC_HASHES) ,] {
         set cols [split $pair :]
         if {[llength $cols] != 2} {
             error "bad DSC_HASHES"
         }
-        dict set Hashes [lindex $cols 0] [lindex $cols 1]
+        lappend Hashes [lindex $cols 0] [lindex $cols 1]
     }
 } {
-    set Hashes [dict create sha2-512 sha512]
+    set Hashes [list sha2-512 sha512]
 }
 
 proc readents {root typ} {
@@ -349,23 +349,21 @@ switch [lindex $argv 0] {
         file delete -force $Saved.bak
     }
     csum {
-        set hsh [dict create]
-        dict for {name cmd} $Hashes {
+        set hsh [list]
+        foreach {name cmd} $Hashes {
             lassign [pipe] r w
             set fh [open [list |$cmd >@$w] w]
             fconfigure $fh -translation binary
-            dict set hsh $name [list $fh $r $w]
+            lappend hsh $name $fh $r $w
         }
         fconfigure stdin -translation binary
         while {![eof stdin]} {
             set buf [read stdin $CopyBufLen]
-            dict for {_ fhs} $hsh {
-                lassign $fhs fh
+            foreach {_ $fh _ _} $hsh {
                 puts -nonewline $fh $buf
             }
         }
-        foreach name [lsort [dict keys $hsh]] {
-            lassign [dict get $hsh $name] fh r w
+        foreach {name fh r w} $hsh {
             close $fh
             close $w
             gets $r v