summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2013-12-06 02:00:56 +0100
committerFrédéric Péters <fpeters@entrouvert.com>2013-12-06 02:00:56 +0100
commitaf05f9b3179c19d8dcba641b38d76309631985ff (patch)
treefdb585e09ddc4c0e08589c8cb75ae94792a79de6 /bindings
parentff0b9ba8d40e77126f6b6edf337427eb98ccfaf1 (diff)
downloadlasso-af05f9b3179c19d8dcba641b38d76309631985ff.tar.gz
lasso-af05f9b3179c19d8dcba641b38d76309631985ff.tar.xz
lasso-af05f9b3179c19d8dcba641b38d76309631985ff.zip
perl: make it compatible with recent libxml2
Diffstat (limited to 'bindings')
-rw-r--r--bindings/perl/glist_handling.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/bindings/perl/glist_handling.c b/bindings/perl/glist_handling.c
index e51cc6cb..01deb274 100644
--- a/bindings/perl/glist_handling.c
+++ b/bindings/perl/glist_handling.c
@@ -28,6 +28,25 @@
#include <lasso/utils.h>
#include "../utils.c"
+static xmlBuffer*
+xmlnode_to_xmlbuffer(xmlNode *node)
+{
+ xmlOutputBufferPtr output_buffer;
+ xmlBuffer *buffer;
+
+ if (! node)
+ return NULL;
+
+ buffer = xmlBufferCreate();
+ output_buffer = xmlOutputBufferCreateBuffer(buffer, NULL);
+ xmlNodeDumpOutput(output_buffer, NULL, node, 0, 0, NULL);
+ xmlOutputBufferClose(output_buffer);
+ xmlBufferAdd(buffer, BAD_CAST "", 1);
+
+ return buffer;
+}
+
+
/**
* xmlnode_to_pv:
* @node: an xmlNode* object
@@ -38,25 +57,18 @@
static SV*
xmlnode_to_pv(xmlNode *node, gboolean do_free)
{
- xmlOutputBufferPtr buf;
+ xmlBuffer *buf;
SV *pestring = NULL;
if (node == NULL) {
return &PL_sv_undef;
}
- buf = xmlAllocOutputBuffer(NULL);
+ buf = xmlnode_to_xmlbuffer(node);
if (buf == NULL) {
pestring = &PL_sv_undef;
} else {
- xmlNodeDumpOutput(buf, NULL, node, 0, 1, NULL);
- xmlOutputBufferFlush(buf);
- if (buf->conv == NULL) {
- pestring = newSVpv((char*)buf->buffer->content, 0);
- } else {
- pestring = newSVpv((char*)buf->conv->content, 0);
- }
- xmlOutputBufferClose(buf);
+ pestring = newSVpv((char*)xmlBufferContent(buf), 0);
}
if (do_free) {
lasso_release_xml_node(node);