]> gitweb.factorcode.org Git - factor.git/commitdiff
win32 IO memory leak fix
authorMackenzie Straight <eizneckam@gmail.com>
Tue, 8 Feb 2005 15:48:12 +0000 (15:48 +0000)
committerMackenzie Straight <eizneckam@gmail.com>
Tue, 8 Feb 2005 15:48:12 +0000 (15:48 +0000)
library/dlists.factor
library/io/win32-io-internals.factor

index 51aef3013c90160f4acb128f393dcece70c10b19..b147b98811b109860d1c1473818d64549c387e24 100644 (file)
@@ -29,3 +29,17 @@ C: dlist-node
 
 : dlist-pop-front ( dlist -- data )
     dup dlist-empty? [ drop f ] [ (dlist-pop-front) ] ifte ;
+
+: (dlist-each) ( quot dnode -- )
+    [
+        [ dlist-node-data swap [ call ] keep ] keep 
+        dlist-node-next (dlist-each)
+    ] [
+        drop
+    ] ifte* ;
+
+: dlist-each ( dlist quot -- )
+    swap dlist-first (dlist-each) ;
+
+: dlist-length ( dlist -- length )
+    0 swap [ drop 1 + ] dlist-each ;
index 2f25cc2a50c1c2c8f2fe681c1f39d234a614dc9d..1664b87f1965e2fab5e35317d3fc5387c0e9d948 100644 (file)
@@ -1,8 +1,6 @@
-! :folding=indent:collapseFolds=1:
-
 ! $Id$
 !
-! Copyright (C) 2004 Mackenzie Straight.
+! Copyright (C) 2004, 2005 Mackenzie Straight.
 ! 
 ! Redistribution and use in source and binary forms, with or without
 ! modification, are permitted provided that the following conditions are met:
@@ -131,7 +129,7 @@ END-STRUCT
 
 : win32-io-thread ( -- )
     10 wait-for-io swap [
-        [ schedule-thread call ] callcc0
+        [ schedule-thread call ] callcc0 2drop
     ] [
         drop yield
     ] ifte*