]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix combinators so that directory. can infer on Unix
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 18 Nov 2008 17:45:55 +0000 (11:45 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 18 Nov 2008 17:45:55 +0000 (11:45 -0600)
basis/unix/groups/groups.factor
basis/unix/users/users.factor

index b8edf7fa3607417dc4449113f0b6bf63f69c1501..177949aec9591adf826ef6712a97c1b790f93290 100644 (file)
@@ -76,9 +76,11 @@ M: integer user-groups ( id -- seq )
 : all-groups ( -- seq )
     [ getgrent dup ] [ group-struct>group ] [ drop ] produce ;
 
+: <group-cache> ( -- assoc )
+    all-groups [ [ id>> ] keep ] H{ } map>assoc ;
+
 : with-group-cache ( quot -- )
-    all-groups [ [ id>> ] keep ] H{ } map>assoc
-    group-cache rot with-variable ; inline
+    [ <group-cache> group-cache ] dip with-variable ; inline
 
 : real-group-id ( -- id )
     getgid ; inline
index f76fbd53889c1affc15e51130f51e94c1d001a54..8487d5adf2a01c9d52c9da5725af66f05c16fc5e 100644 (file)
@@ -41,9 +41,11 @@ PRIVATE>
 
 SYMBOL: user-cache
 
+: <user-cache> ( -- assoc )
+    all-users [ [ uid>> ] keep ] H{ } map>assoc ;
+
 : with-user-cache ( quot -- )
-    all-users [ [ uid>> ] keep ] H{ } map>assoc
-    user-cache rot with-variable ; inline
+    [ <user-cache> user-cache ] dip with-variable ; inline
 
 GENERIC: user-passwd ( obj -- passwd )