Skip to content

Commit

Permalink
Update to libxml-2.12.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyolee committed Dec 6, 2023
1 parent 7db59c1 commit 1fbaf4c
Show file tree
Hide file tree
Showing 19 changed files with 146 additions and 410 deletions.
368 changes: 0 additions & 368 deletions INSTALL

This file was deleted.

15 changes: 15 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
NEWS file for libxml2

v2.12.1: Nov 23 2023

### Regressions

- hash: Fix deletion of entries during scan
- parser: Only enable SAX2 if there are SAX2 element handlers

### Build fixes

- autotools: Stop checking for snprintf
- dict: Fix '__thread' before 'static'
- fix: pthread weak references in globals.c (Mike Dalessio)
- tests: Fix build with older MSVC


v2.12.0: Nov 16 2023

### Major changes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

libxml2 Windows build with Visual Studio.

This version is libxml2-2.12.0.
This version is libxml2-2.12.1.

Note that LZMA support is only available for VS2013 or later.

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,8 +909,8 @@ static xmlMutex xmlRngMutex;
static unsigned globalRngState[2];

#ifdef XML_THREAD_LOCAL
XML_THREAD_LOCAL static int localRngInitialized = 0;
XML_THREAD_LOCAL static unsigned localRngState[2];
static XML_THREAD_LOCAL int localRngInitialized = 0;
static XML_THREAD_LOCAL unsigned localRngState[2];
#endif

ATTRIBUTE_NO_SANITIZE_INTEGER
Expand Down
2 changes: 1 addition & 1 deletion distfiles/download.url
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://download.gnome.org/sources/libxml2/2.12/libxml2-2.12.0.tar.xz
https://download.gnome.org/sources/libxml2/2.12/libxml2-2.12.1.tar.xz
Binary file removed distfiles/libxml2-2.12.0.tar.xz
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Copyright
HTMLparser.c
HTMLtree.c
INSTALL
NEWS
README.libxml2.md
SAX.c
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
fec7ecfe714722b2bb0aaff7d200c701 Copyright
7d91f49e89d9dfca6fcad04d6016c926 HTMLparser.c
ac5d42c343d2093d2a031f59036c5f99 HTMLtree.c
dd63184811cb2ff705c3e466364d3773 INSTALL
0a529ae23334abce65b8bb99d8cc3f0d NEWS
965b40f91fe10130140303264f1f634f NEWS
d52aad5f8ace0ed3e5f9b126d72473e1 README.libxml2.md
7283878f36a935a3c00df077cf45af54 SAX.c
5d6ed317082936da928e972ed854851f SAX2.c
Expand All @@ -11,12 +10,12 @@ d52aad5f8ace0ed3e5f9b126d72473e1 README.libxml2.md
0d7ba01913e22fd832d634c862fc1716 catalog.c
691708e81dee605336b6ef6e431c5c21 chvalid.c
fa4c7d0b18fba04f8458ed1b21ea563a debugXML.c
863f3d71c43f0775a611ae467a5c650c dict.c
d1071113f634435266c21de0bffc0315 dict.c
10a103a4ea5dce7e3906291f958b7e9f encoding.c
83e8ff3c5b69908c4a93357bdc60e91c entities.c
bbb4bd2d42423b727ef64d7ce71611f6 error.c
26a3ccf8ef53d894efb57b48c289cba7 globals.c
b7cd78c639412ad8b42eb6870f1e09f4 hash.c
d92b8032899705b6573c7ddb54e288fe globals.c
33d90ee08788d335c459779c0c5fd6e5 hash.c
c3cd3bf7e9b4c37de582641b614cf6e8 include/libxml/HTMLparser.h
bb4e2df91d33306ab3c2d71374559877 include/libxml/HTMLtree.h
44e6202b2e65e38c48a5cacb75afe5bf include/libxml/SAX.h
Expand All @@ -33,7 +32,7 @@ e567122520ed052588fd6469f2efbc59 include/libxml/encoding.h
6c03428a747fbfab599d4e86dd17d6b1 include/libxml/list.h
d5c907a6d7d205e286168e007f32504c include/libxml/nanoftp.h
3f166ef07a961ee21d3561682d859edc include/libxml/nanohttp.h
872a31d2638f7140b7fb28f7219bbc48 include/libxml/parser.h
ac7a4b3593e7f6fbc8bd8118c24fdf06 include/libxml/parser.h
36c2360e8bdaac08bfccba24e461d07f include/libxml/parserInternals.h
f1afd2d52bf66fbf45f02dc35c72c3eb include/libxml/pattern.h
5c004f394f8ea72b37b7b4ad5f963863 include/libxml/relaxng.h
Expand Down Expand Up @@ -86,24 +85,24 @@ c2b5c54ee40fd7bfba8eb6b9e90d6dbd libxml.h
67985a9e0fc42eebc29d12b884baa00a list.c
a9e486124ef2c3a00ecb44001d774484 nanoftp.c
a2c34ca6d295906ebc9b56d8e056bf7a nanohttp.c
7090f7438f3eda1da11ab9aaf99a8758 parser.c
f3da8b0608c2faee5ea032c38991345f parser.c
dbdd7331d719e88c2fca9977bf9e950f parserInternals.c
8809dafc22e8463d81a392ac8a853a59 pattern.c
15a40570e75a1cf9f9da7350f9557b86 relaxng.c
c4ed3b49d3da9fa398c96b31f1798a8d runsuite.c
0350285a951d372a9c5331bf86550c41 runtest.c
0ac472b7f3bdb46ec3ede026357e99c6 runxmlconf.c
b66e180243852be9fa9f97b0722679ba runsuite.c
6aa2a375c3866f81e493eb39457d63bb runtest.c
feb122dee4d10cb493ca85bbb2162792 runxmlconf.c
fc8947f2849d2f27a30318dc3ca831f5 schematron.c
c48cacc169fbe69e961ceafbfb92ee71 testModule.c
673cbe4047f34b7d954fd597d46b8716 testThreads.c
11c95b21f63ce98bf5d009d42d0994b0 testapi.c
e85d38ab99ab20ed6649989919e52fbd testapi.c
1b039d4e46c69d01fdfdb0977c18ab4c testchar.c
2792f948169570feeb744ddf0cce5025 testdict.c
6a3e7cbf9864c04639a1a8ac0c388ea2 testdso.c
e84fe8d1a9d8ea089bf9ea8544a6ea1b testlimits.c
f4891e39cf0cba64b9b66382d8d2b9fb testparser.c
fa2d8165b19e096fe24c36908952c343 testrecurse.c
ef766dc5d4968a60f91bc79c7d2d498a threads.c
f9dd10b6caf75faf002e92b703b36897 testrecurse.c
bef5d0bbecbb90f5a441e52bd2f926a2 threads.c
1bcb15667ab695cdd2cc8d5b1bc05169 timsort.h
8a61540f8b10ef82b0b6124bba783352 tree.c
5b543ee91a3c2f2c4fb79e37caa071ea trio.c
Expand Down
Binary file added distfiles/libxml2-2.12.1.tar.xz
Binary file not shown.
15 changes: 14 additions & 1 deletion globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ static XML_THREAD_LOCAL xmlGlobalState globalState;
defined(__GLIBC__) && \
__GLIBC__ * 100 + __GLIBC_MINOR__ < 234

#pragma weak pthread_getspecific
#pragma weak pthread_setspecific
#pragma weak pthread_key_create
#pragma weak pthread_key_delete
#pragma weak pthread_equal
#pragma weak pthread_self

#define XML_PTHREAD_WEAK

static int libxml_is_threaded = -1;
Expand Down Expand Up @@ -566,7 +573,13 @@ void xmlInitGlobalsInternal(void) {
(pthread_getspecific != NULL) &&
(pthread_setspecific != NULL) &&
(pthread_key_create != NULL) &&
(pthread_key_delete != NULL);
(pthread_key_delete != NULL) &&
/*
* pthread_equal can be inline, resuting in -Waddress warnings.
* Let's assume it's available if all the other functions are.
*/
/* (pthread_equal != NULL) && */
(pthread_self != NULL);
if (libxml_is_threaded == 0)
return;
#endif /* XML_PTHREAD_WEAK */
Expand Down
76 changes: 64 additions & 12 deletions hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,15 +913,42 @@ xmlHashScan(xmlHashTablePtr hash, xmlHashScanner scan, void *data) {
void
xmlHashScanFull(xmlHashTablePtr hash, xmlHashScannerFull scan, void *data) {
const xmlHashEntry *entry, *end;
xmlHashEntry old;
unsigned i;

if ((hash == NULL) || (hash->size == 0) || (scan == NULL))
return;

/*
* We must handle the case that a scanned entry is removed when executing
* the callback (xmlCleanSpecialAttr and possibly other places).
*
* Find the start of a probe sequence to avoid scanning entries twice if
* a deletion happens.
*/
entry = hash->table;
end = &hash->table[hash->size];
while (entry->hashValue != 0) {
if (++entry >= end)
entry = hash->table;
}

for (entry = hash->table; entry < end; entry++) {
if ((entry->hashValue != 0) && (entry->payload != NULL))
scan(entry->payload, data, entry->key, entry->key2, entry->key3);
for (i = 0; i < hash->size; i++) {
if ((entry->hashValue != 0) && (entry->payload != NULL)) {
/*
* Make sure to rescan after a possible deletion.
*/
do {
old = *entry;
scan(entry->payload, data, entry->key, entry->key2, entry->key3);
} while ((entry->hashValue != 0) &&
(entry->payload != NULL) &&
((entry->key != old.key) ||
(entry->key2 != old.key2) ||
(entry->key3 != old.key3)));
}
if (++entry >= end)
entry = hash->table;
}
}

Expand Down Expand Up @@ -966,22 +993,47 @@ xmlHashScanFull3(xmlHashTablePtr hash, const xmlChar *key,
const xmlChar *key2, const xmlChar *key3,
xmlHashScannerFull scan, void *data) {
const xmlHashEntry *entry, *end;
xmlHashEntry old;
unsigned i;

if ((hash == NULL) || (hash->size == 0) || (scan == NULL))
return;

/*
* We must handle the case that a scanned entry is removed when executing
* the callback (xmlCleanSpecialAttr and possibly other places).
*
* Find the start of a probe sequence to avoid scanning entries twice if
* a deletion happens.
*/
entry = hash->table;
end = &hash->table[hash->size];
while (entry->hashValue != 0) {
if (++entry >= end)
entry = hash->table;
}

for (entry = hash->table; entry < end; entry++) {
if (entry->hashValue == 0)
continue;
if (((key == NULL) ||
(strcmp((const char *) key, (const char *) entry->key) == 0)) &&
((key2 == NULL) || (xmlFastStrEqual(key2, entry->key2))) &&
((key3 == NULL) || (xmlFastStrEqual(key3, entry->key3))) &&
(entry->payload != NULL)) {
scan(entry->payload, data, entry->key, entry->key2, entry->key3);
for (i = 0; i < hash->size; i++) {
if ((entry->hashValue != 0) && (entry->payload != NULL)) {
/*
* Make sure to rescan after a possible deletion.
*/
do {
if (((key != NULL) && (strcmp((const char *) key,
(const char *) entry->key) != 0)) ||
((key2 != NULL) && (!xmlFastStrEqual(key2, entry->key2))) ||
((key3 != NULL) && (!xmlFastStrEqual(key3, entry->key3))))
break;
old = *entry;
scan(entry->payload, data, entry->key, entry->key2, entry->key3);
} while ((entry->hashValue != 0) &&
(entry->payload != NULL) &&
((entry->key != old.key) ||
(entry->key2 != old.key2) ||
(entry->key3 != old.key3)));
}
if (++entry >= end)
entry = hash->table;
}
}

Expand Down
21 changes: 20 additions & 1 deletion include/libxml/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,19 @@ struct _xmlSAXHandler {
setDocumentLocatorSAXFunc setDocumentLocator;
startDocumentSAXFunc startDocument;
endDocumentSAXFunc endDocument;
/*
* `startElement` and `endElement` are only used by the legacy SAX1
* interface and should not be used in new software. If you really
* have to enable SAX1, the preferred way is set the `initialized`
* member to 1 instead of XML_SAX2_MAGIC.
*
* For backward compatibility, it's also possible to set the
* `startElementNs` and `endElementNs` handlers to NULL.
*
* You can also set the XML_PARSE_SAX1 parser option, but versions
* older than 2.12.0 will probably crash if this option is provided
* together with custom SAX callbacks.
*/
startElementSAXFunc startElement;
endElementSAXFunc endElement;
referenceSAXFunc reference;
Expand All @@ -758,8 +771,14 @@ struct _xmlSAXHandler {
getParameterEntitySAXFunc getParameterEntity;
cdataBlockSAXFunc cdataBlock;
externalSubsetSAXFunc externalSubset;
/*
* `initialized` should always be set to XML_SAX2_MAGIC to enable the
* modern SAX2 interface.
*/
unsigned int initialized;
/* The following fields are extensions available only on version 2 */
/*
* The following members are only used by the SAX2 interface.
*/
void *_private;
startElementNsSAX2Func startElementNs;
endElementNsSAX2Func endElementNs;
Expand Down
8 changes: 4 additions & 4 deletions include/libxml/xmlversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ XMLPUBFUN void xmlCheckVersion(int version);
*
* the version string like "1.2.3"
*/
#define LIBXML_DOTTED_VERSION "2.12.0"
#define LIBXML_DOTTED_VERSION "2.12.1"

/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
#define LIBXML_VERSION 21200
#define LIBXML_VERSION 21201

/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
#define LIBXML_VERSION_STRING "21200"
#define LIBXML_VERSION_STRING "21201"

/**
* LIBXML_VERSION_EXTRA:
Expand All @@ -58,7 +58,7 @@ XMLPUBFUN void xmlCheckVersion(int version);
* Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against
*/
#define LIBXML_TEST_VERSION xmlCheckVersion(21200);
#define LIBXML_TEST_VERSION xmlCheckVersion(21201);

#ifndef VMS
#if 0
Expand Down
9 changes: 8 additions & 1 deletion parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,14 @@ xmlDetectSAX2(xmlParserCtxtPtr ctxt) {
if (ctxt == NULL) return;
sax = ctxt->sax;
#ifdef LIBXML_SAX1_ENABLED
if ((sax) && (sax->initialized == XML_SAX2_MAGIC))
/*
* Only enable SAX2 if there SAX2 element handlers, except when there
* are no element handlers at all.
*/
if ((sax) && (sax->initialized == XML_SAX2_MAGIC) &&
((sax->startElementNs != NULL) ||
(sax->endElementNs != NULL) ||
((sax->startElement == NULL) && (sax->endElement == NULL))))
ctxt->sax2 = 1;
#else
ctxt->sax2 = 1;
Expand Down
2 changes: 1 addition & 1 deletion runtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* [email protected]
*/

#include "config.h"
#include "libxml.h"
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
Expand Down
2 changes: 2 additions & 0 deletions testrecurse.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,8 @@ static void
initSAX(xmlParserCtxtPtr ctxt) {
ctxt->sax->startElementNs = NULL;
ctxt->sax->endElementNs = NULL;
ctxt->sax->startElement = NULL;
ctxt->sax->endElement = NULL;
ctxt->sax->characters = NULL;
ctxt->sax->cdataBlock = NULL;
ctxt->sax->ignorableWhitespace = NULL;
Expand Down
2 changes: 0 additions & 2 deletions threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@
#pragma weak pthread_cond_wait
#pragma weak pthread_equal
#pragma weak pthread_self
#pragma weak pthread_key_create
#pragma weak pthread_key_delete
#pragma weak pthread_cond_signal

#define XML_PTHREAD_WEAK
Expand Down
4 changes: 2 additions & 2 deletions win32/rcVersion.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define LIBXML_MAJOR_VERSION 2
#define LIBXML_MINOR_VERSION 12
#define LIBXML_MICRO_VERSION 0
#define LIBXML_DOTTED_VERSION "2.12.0"
#define LIBXML_MICRO_VERSION 1
#define LIBXML_DOTTED_VERSION "2.12.1"

0 comments on commit 1fbaf4c

Please sign in to comment.