     [ drop ] [ port-flush ] if ; inline
 
 M: output-port stream-write1
-    dup check-disposed
-    1 over wait-to-write
-    buffer>> buffer-write1 ; inline
+    [ check-disposed ]
+    [ 1 swap wait-to-write ]
+    [ buffer>> buffer-write1 ] tri ; inline
 
 <PRIVATE
 

    n-remaining port read-step :> ( n-buffered ptr )
    ptr [
        dst ptr n-buffered memcpy
        n-remaining n-buffered - :> n-remaining'
        n-read n-buffered + :> n-read'
        n-buffered dst <displaced-alien> :> dst'
        dst' n-remaining' port n-read' read-loop
    ] [ n-read ] if ; inline recursive

M: input-port stream-read1
    dup check-disposed
    dup wait-to-read [ drop f ] [ buffer>> buffer-pop ] if ; inline

ERROR: not-a-c-ptr object ;

: check-c-ptr ( c-ptr -- c-ptr )
    dup c-ptr? [ not-a-c-ptr ] unless ; inline

<PRIVATE

