]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/db/postgresql/lib/lib.factor
Updating code to use with-out-parameters
[factor.git] / basis / db / postgresql / lib / lib.factor
index 0d50d1ab2c915f5cddb8fa31bca87c3dc23a3676..7fe40a73d6ce30eaf5af2628e7e3e072f1aafe97 100644 (file)
@@ -2,11 +2,13 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays continuations db io kernel math namespaces
 quotations sequences db.postgresql.ffi alien alien.c-types
-db.types tools.walker ascii splitting math.parser combinators
-libc calendar.format byte-arrays destructors prettyprint
-accessors strings serialize io.encodings.binary io.encodings.utf8
-alien.strings io.streams.byte-array summary present urls
-specialized-arrays.uint specialized-arrays.alien db.private ;
+alien.data db.types tools.walker ascii splitting math.parser
+combinators libc calendar.format byte-arrays destructors
+prettyprint accessors strings serialize io.encodings.binary
+io.encodings.utf8 alien.strings io.streams.byte-array summary
+present urls specialized-arrays db.private ;
+SPECIALIZED-ARRAY: uint
+SPECIALIZED-ARRAY: void*
 IN: db.postgresql.lib
 
 : postgresql-result-error-message ( res -- str/f )
@@ -137,15 +139,14 @@ M: postgresql-malloc-destructor dispose ( obj -- )
         [ 3drop ] dip
         [
             memory>byte-array >string
-            0 <uint>
+            { uint }
             [
                 PQunescapeBytea dup zero? [
                     postgresql-result-error-message throw
                 ] [
                     &postgresql-free
                 ] if
-            ] keep
-            *uint memory>byte-array
+            ] [ ] with-out-parameters memory>byte-array
         ] with-destructors 
     ] [
         drop pq-get-is-null nip [ f ] [ B{ } clone ] if