[gdome]Re: [PATCH] Add memory buffer length param to SaveToMemory*
- From: Blair Zajac <blair orcaware com>
- To: GDome Mailing List <gdome gnome org>, GMetaDom C++ Mailing List <gmetadom-cppdev lists sourceforge net>, GMetaDom Ocaml Mailing List <gmetadom-ocamldev lists sourceforge net>
- Subject: [gdome]Re: [PATCH] Add memory buffer length param to SaveToMemory*
- Date: Sat, 15 Mar 2003 14:23:30 -0800
Blair Zajac wrote:
>
> Hello,
>
> Right now the gdome2 saveDocToMemory and saveDocToMemoryEnc functions
> only return to the caller the memory buffer created by libxml2, even
> though libxml2 returns the length of that buffer.
>
> I'm using gmetadom Ocaml bindings (gmetadom uses gdome2) and need to
> copy an XSLT generated file from the gmetadom/gdome2 to Ocaml string.
>
> Right now the Ocaml bindings scan the buffer to find the \0 and then
> make another pass to copy the buffer, which is a waste of CPU time.
>
> The attached patch modifies gdome2 to add an additional int * parameter
> to the *saveDocToMemory* calls.
Regarding freeing the memory returned by gdome2 (from libxml2 in this
case), two thoughts:
1) Provide a free() function that calls the vtable function.
2) Have *saveDocToMemory* return a function pointer to the proper
free() to use. The caller saves this pointer until it's needed.
If the second method is better, I can modify this patch to do that.
Let me know.
Best,
Blair
--
Blair Zajac <blair orcaware com>
Plots of your system's performance - http://www.orcaware.com/orca/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]