*: update all clients of the `CString::to_s` services
[nit.git] / lib / mongodb / mongodb.nit
index 80c4d4c..fdc03b6 100644 (file)
@@ -42,6 +42,7 @@
 # ~~~
 module mongodb
 
+import json::static
 import json
 private import native_mongodb
 
@@ -90,9 +91,9 @@ private class BSON
        end
 
        redef fun to_s do
-               var ns = native.to_native_string
-               var res = ns.to_s_with_copy
-               ns.free # manual free of gc allocated NativeString
+               var ns = native.to_c_string
+               var res = ns.to_s
+               ns.free # manual free of gc allocated CString
                return res
        end
 
@@ -146,7 +147,7 @@ class MongoError
        # Human readable error message.
        fun message: String do
                var ns = native.message
-               var res = ns.to_s_with_copy
+               var res = ns.to_s
                ns.free
                return res
        end
@@ -236,7 +237,7 @@ class MongoClient
                var i = 0
                var name = nas[i]
                while not name.address_is_null do
-                       res.add name.to_s_with_copy
+                       res.add name.to_s
                        name.free
                        i += 1
                        name = nas[i]
@@ -322,7 +323,7 @@ class MongoDb
                var i = 0
                var name = nas[i]
                while not name.address_is_null do
-                       res.add name.to_s_with_copy
+                       res.add name.to_s
                        name.free
                        i += 1
                        name = nas[i]