On 18/09/2013 02:04, Marvin Humphrey wrote:
On Sat, Sep 14, 2013 at 12:29 PM,  <[email protected]> wrote:
Introduce Str_To_Utf8

Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/41a5ef76
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/41a5ef76
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/41a5ef76

-    /** Return a fresh copy of the string data in a String with an internal
-     * encoding of UTF-8.
+    /** Return a NULL-terminated copy of the string data in UTF-8 encoding.
+     * The buffer must be freed by the caller.
       */
-    String*
-    To_CB8(String *self);
+    char*
+    To_Utf8(String *self);

Will we need to expose the routines in Clownfish::Util::Memory as public APIs
because `free` doesn't mean the same thing everywhere?  See "free to wrong
pool" errors on Windows, for example.

The buffer returned by Str_To_Utf8 is allocated with MALLOCATE which is a wrapper around the system malloc. So it should be safe to simply free() the buffer. The "free to wrong pool" seems to be related to the Perl allocator which isn't used in this case.

Nick

Reply via email to