1
0
mirror of https://github.com/GNOME/libxml2.git synced 2025-05-08 21:07:54 +08:00

137 Commits

Author SHA1 Message Date
Nick Wellnhofer
9bbffec568 doc: Move brief to top, params to bottom of doc comments 2025-05-06 19:51:38 +02:00
Nick Wellnhofer
cb1635a642 doc: Use @since command 2025-05-02 19:05:25 +02:00
Nick Wellnhofer
e78e05c990 doc: Fix autolinks to functions
Unfortunately, autolinks in .c files aren't converted by Doxygen for
some reason.
2025-05-02 17:45:31 +02:00
Nick Wellnhofer
f7c412874b doc: Remove more comment block headers 2025-05-02 17:41:26 +02:00
Nick Wellnhofer
e525564f65 doc: Remove empty lines at start of block
These lines were left over after automatic conversion.
2025-05-02 11:42:05 +02:00
Nick Wellnhofer
e549622bc5 doc: Convert documentation to Doxygen
Automated conversion based on a few regexes.
2025-05-01 23:23:42 +02:00
Nick Wellnhofer
69879da88f doc: Remove email addresses from documentation
Also remove authorship information from generated files, hash.c and
globals.c which were rewritten.
2025-05-01 23:23:42 +02:00
Nick Wellnhofer
0aa87d85ff globals: Fix --with-thread-alloc build 2025-04-04 12:48:20 +02:00
Nick Wellnhofer
2af05f76fe globals: Fix Windows build 2025-03-05 12:24:38 +01:00
Nick Wellnhofer
696572248f globals: Remove unused globals
- xmlBufferAllocScheme
- xmlDefaultBufferSize
- xmlParserDebugEntities
2025-03-05 12:24:38 +01:00
Nick Wellnhofer
85bd58ef56 globals: Remove functions related to global state handling
- xmlGetGlobalState
- xmlInitializeGlobalState
- xmlGetThreadId
- xmlIsMainThread
2025-03-04 17:38:10 +01:00
Nick Wellnhofer
3d37ff84c3 globals: Also use global state struct if threads are disabled 2025-03-04 16:54:41 +01:00
Nick Wellnhofer
a15ad9b268 parser: Remove compatibility symbols 2025-03-04 16:54:41 +01:00
Nick Wellnhofer
8e871162a6 parser: Remove oldXMLWDcompatibility 2025-03-04 16:54:41 +01:00
Nick Wellnhofer
cdc5cfed0b legacy: Remove legacy symbols 2025-03-04 16:54:05 +01:00
Nick Wellnhofer
2e3a91a766 doc: Fix documentation 2024-12-26 21:05:39 +01:00
Nick Wellnhofer
2fcdc5f7e7 globals: More comments on future directions 2024-11-19 00:08:39 +01:00
Nick Wellnhofer
1f7d4af355 globals: Clean up macros and add comments 2024-07-16 19:58:09 +02:00
Nick Wellnhofer
4f08a1a249 globals: Also use thread-specific storage on "main" thread
Don't treat "main" thread specially. This simplifies access to
thread-specific data.

xmlGetGlobalState can now also fail on the former main thread, leading
to an unrecoverable condition if malloc fails.

The globals were never defined in public header files when compiling
with thread support. Now they're only defined in a legacy build.

Move TlsFree to DllMain to make cleanup more robust on Windows.

Obsoletes #1.
2024-07-16 19:48:40 +02:00
Nick Wellnhofer
a87944e970 windows: Use DllMain for cleanup 2024-07-16 17:42:10 +02:00
Nick Wellnhofer
5f3f66c683 threads: Use pthread_once and InitOnceExecuteOnce
Static initialization flags aren't thread-safe. Also avoids an
allocation on Windows.

TODO: Breaks xmllint on Windows.
2024-07-16 17:42:10 +02:00
Nick Wellnhofer
79e119954c error: Make xmlLastError const 2024-07-16 17:42:10 +02:00
Nick Wellnhofer
8e871a31f8 buf: Rework xmlBuffer code
Port most changes made to the xmlBuf code in f3807d76, except that
"size" still includes the terminating NULL byte.

Make xmlSetBufferAllocationScheme, xmlBufferAllocScheme and
xmlDefaultBufferSize no-ops.

Deprecate a few functions.
2024-07-16 17:42:10 +02:00
Nick Wellnhofer
728869809e error: Add helper functions to print errors and abort 2024-07-15 16:33:38 +02:00
Nick Wellnhofer
6794c1b91d globals: Document remaining thread-local vars as deprecated
See #407.
2024-07-02 20:03:23 +02:00
Nick Wellnhofer
35146ff31c save: Implement xmlSaveSetIndentString
Allow to set indent string without using global xmlTreeIndentString.

See #736.
2024-07-02 20:03:23 +02:00
Nick Wellnhofer
7cc619d568 save: Implement save options for indenting
Implement XML_SAVE_NO_INDENT to disable and XML_SAVE_INDENT to enable
indenting regardless of the global xmlIndentTreeOutput.

Implement XML_SAVE_EMPTY to enable empty tags regardless of the global
xmlSaveNoEmptyTags.

See #736.
2024-07-02 20:03:23 +02:00
Nick Wellnhofer
f505dcaea0 tree: Remove underscores from xmlRegisterCallbacks 2024-06-27 14:45:35 +02:00
Nick Wellnhofer
2b0c4abb1f threads: Remove pthread weak symbol hack
On Linux, we tried to detect the presence of libpthread to disable
things like locks. This questionable hack doesn't work since glibc 2.34
which merged libpthread into libc.
2024-06-17 00:54:47 +02:00
Nick Wellnhofer
e75e878e02 doc: Update and fix documentation 2024-05-20 14:23:39 +02:00
Nick Wellnhofer
1cdfece12b memory: Remove memory debugging
This is useless compared to sanitizers or valgrind and has a
considerable performance impact if enabled accidentally.
2024-04-28 20:42:55 +02:00
Nick Wellnhofer
12f0bb9478 parser: Synchronize more options 2024-01-05 20:39:40 +01:00
Nick Wellnhofer
9c2c87b55d dict: Move local RNG state to global state
Don't use TLS variables directly.
2023-12-24 16:24:34 +01:00
Nick Wellnhofer
54c70ed57f parser: Improve error handling
Introduce xmlCtxtSetErrorHandler allowing to set a structured error for
a parser context. There already was the "serror" SAX handler but this
always receives the parser context as argument.

Start to use xmlRaiseMemoryError.

Remove useless arguments from memory error functions. Rename
xmlErrMemory to xmlCtxtErrMemory.

Remove a few calls to xmlGenericError.

Remove support for runtime entity debugging.
2023-12-21 02:46:27 +01:00
Nick Wellnhofer
9122ad0ce6 include: Move globals from xmlsave.h to parser.h
Fix downstream build issues after reworking globals.h.
2023-12-07 12:31:06 +01:00
Nick Wellnhofer
c011e7605d globals: Remove unused globals from thread storage
Setting these deprecated globals hasn't had an effect for a long time.
Make them constants. This reduces the size of per-thread storage from
~700 to ~250 bytes.
2023-12-06 20:07:54 +01:00
Nick Wellnhofer
4c17804050 globals: Disable TLS in static Windows builds
The cleanup callback would run after TLS was deallocated.
2023-12-01 17:19:55 +01:00
Mike Dalessio
62d318f86c
fix: more pthread weak references in globals.c 2023-11-18 15:37:26 -05:00
Mike Dalessio
1ac88300c1 fix: pthread weak references in globals.c
Linking executables will fail on systems with glibc < 2.34 without
declaring these symbols as weak references.

In commit c19771c1f13de9196f98260d142d8c8672eb5733 these references
were moved to globals.c from threads.c, but the `#pragma weak`
declarations were lost in the process.

Also removing unneeded weak declarations from threads.c.
2023-11-18 18:26:48 +00:00
Nick Wellnhofer
253f260bb1 threads: Fix --with-thread-alloc
Fixes #606.
2023-10-18 20:07:04 +02:00
Nick Wellnhofer
b8961a75e9 parser: Fix reinitialization 2023-09-27 17:24:46 +02:00
Nick Wellnhofer
bc4e82ff42 globals: Don't use thread-local storage on Darwin
It seems that thread-local storage destructors are run before pthread
thread-specific data destructors on Darwin, defeating our scheme to use
TSD to clean up TLS.

Here's an example program that reports a use-after-free when compiled
with `-fsanitize=address` on macOS:

    #include <pthread.h>

    typedef struct {
	int v;
    } my_struct;

    static _Thread_local my_struct tls;
    pthread_key_t key;

    void dtor(void *tsd) {
	my_struct *s = (my_struct *) tsd;
	/*
	 * This will crash ASan, apparently because
	 * TLS has already been freed.
	 */
	s->v = 1;
    }

    void *thread(void *p) {
	pthread_setspecific(key, &tls);
	return NULL;
    }

    int main(void) {
	pthread_key_create(&key, dtor);

	pthread_t handle;
	pthread_create(&handle, NULL, thread, NULL);
	pthread_join(handle, NULL);

	return 0;
    }
2023-09-22 13:37:28 +02:00
Nick Wellnhofer
8c084ebdc7 doc: Make apibuild.py happy 2023-09-21 22:57:33 +02:00
Nick Wellnhofer
05135536b1 globals: Fix build --with-threads --without-output
Fixes #593.
2023-09-21 20:40:32 +02:00
Nick Wellnhofer
f0e8358eae globals: Final fixes 2023-09-20 23:18:21 +02:00
Nick Wellnhofer
11a1839ddd globals: Move remaining globals back to correct header files
This undoes a lot of damage.
2023-09-20 22:06:49 +02:00
Nick Wellnhofer
eb985d6f8e globals: Move error globals back to xmlerror.c 2023-09-20 22:06:49 +02:00
Nick Wellnhofer
d1336fd393 globals: Move malloc hooks back to xmlmemory.h 2023-09-20 22:06:49 +02:00
Nick Wellnhofer
a77f9ab84c globals: Don't include SAX2.h from globals.h 2023-09-20 22:06:49 +02:00
Nick Wellnhofer
2e6c49a74d globals: Don't store xmlParserVersion in global state
This is a constant.
2023-09-20 22:06:49 +02:00