Skip to content

Commit aae50e9

Browse files
committed
Fix some libxml2 HEAD deprecations
1 parent bad83df commit aae50e9

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

src/dom.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ domTestDocument(xmlNodePtr cur, xmlNodePtr refNode) {
602602
return 1;
603603
}
604604

605-
static void _domScanEntry(void* value, int* refs, xmlChar* key ATTRIBUTE_UNUSED) {
605+
static void _domScanEntry(void* value, int* refs, xmlChar*) {
606606
if (value != NULL && ((xmlNodePtr)value)->_private != NULL) {
607607
(*refs)++;
608608
}
@@ -1300,14 +1300,15 @@ domGetNodeValue( xmlNodePtr n ) {
13001300
/* ok then toString in this case ... */
13011301
while (cnode) {
13021302
xmlBufferPtr buffer = xmlBufferCreate();
1303-
/* buffer = xmlBufferCreate(); */
1303+
const xmlChar* content;
13041304
xmlNodeDump( buffer, n->doc, cnode, 0, 0 );
1305-
if ( buffer->content != NULL ) {
1305+
content = xmlBufferContent( buffer );
1306+
if ( content != NULL ) {
13061307
if ( rv != NULL ) {
1307-
rv = xmlStrcat( rv, buffer->content );
1308+
rv = xmlStrcat( rv, content );
13081309
}
13091310
else {
1310-
rv = xmlStrdup( buffer->content );
1311+
rv = xmlBufferDetach( buffer );
13111312
}
13121313
}
13131314
xmlBufferFree( buffer );
@@ -1993,8 +1994,7 @@ domAttrSerializeContent(xmlAttrPtr attr) {
19931994
children = children->next;
19941995
}
19951996

1996-
rv = buffer->content;
1997-
buffer->content = NULL;
1997+
rv = xmlBufferDetach(buffer);
19981998
xmlBufferFree( buffer );
19991999

20002000
return rv;

src/domXPath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ DLLEXPORT xmlNodeSetPtr domReverseNodeSet(xmlNodeSetPtr rv) {
303303
}
304304

305305
static void
306-
_domNodeSetGC(void *entry, unsigned char *key ATTRIBUTE_UNUSED) {
306+
_domNodeSetGC(void *entry, unsigned char*) {
307307
xmlNodePtr twig = (xmlNodePtr) entry;
308308
xmlNodePtr owner = _domItemOwner(twig);
309309
if (owner) {

src/xml6_hash.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ static xmlChar* _xml6_make_ns_key(xmlChar* name, xmlChar *pfx) {
2222
return key;
2323
}
2424

25-
static void _xml6_get_key(void* value ATTRIBUTE_UNUSED, const xmlChar*** keys, xmlChar* name, xmlChar* pfx, xmlChar* _ ATTRIBUTE_UNUSED ) {
25+
static void _xml6_get_key(void*, const xmlChar*** keys, xmlChar* name, xmlChar* pfx, xmlChar*) {
2626
*((*keys)++) = _xml6_make_ns_key(name, pfx);
2727
}
2828

29-
static void _xml6_get_value(void* value, const void*** values, xmlChar* _ ATTRIBUTE_UNUSED, xmlChar* _2 ATTRIBUTE_UNUSED, xmlChar* _3 ATTRIBUTE_UNUSED) {
29+
static void _xml6_get_value(void* value, const void*** values, xmlChar*, xmlChar*, xmlChar*) {
3030
*((*values)++) = value;
3131
}
3232

33-
static void _xml6_get_pair(void* value, const void*** pairs, xmlChar* name, xmlChar *pfx, xmlChar* _3 ATTRIBUTE_UNUSED) {
33+
static void _xml6_get_pair(void* value, const void*** pairs, xmlChar* name, xmlChar *pfx, xmlChar*) {
3434
*((*pairs)++) = (void*) _xml6_make_ns_key(name, pfx);
3535
*((*pairs)++) = value;
3636
}
@@ -232,7 +232,7 @@ DLLEXPORT void* xml6_hash_lookup_ns(xmlHashTablePtr self, xmlChar* name) {
232232
}
233233

234234
// Free the hash, leave contents intact
235-
static void _keep_hash_contents(void *entry ATTRIBUTE_UNUSED, const xmlChar *name ATTRIBUTE_UNUSED) {
235+
static void _keep_hash_contents(void*, const xmlChar*) {
236236
// do nothing
237237
}
238238
DLLEXPORT void xml6_hash_discard(xmlHashTablePtr self) {

src/xml6_node.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,10 @@ DLLEXPORT xmlChar* xml6_node_to_buf(xmlNodePtr self, int options, size_t* len, c
153153
xmlSaveClose(save_ctx);
154154

155155
if (stat >= 0) {
156-
rv = buffer->content;
157-
buffer->content = NULL;
158156
if (len != NULL) {
159-
*len = buffer->use;
157+
*len = xmlBufferLength(buffer);
160158
}
159+
rv = xmlBufferDetach(buffer);
161160
}
162161
xmlBufferFree(buffer);
163162
}

0 commit comments

Comments
 (0)