1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00
Commit Graph

124 Commits

Author SHA1 Message Date
Nick Wellnhofer
769e5a4a42 threads: Allocate global RMutexes statically
Avoid memory allocations during initialization.
2024-07-16 17:42:10 +02:00
Nick Wellnhofer
5d36664fc9 memory: Deprecate xmlGcMemSetup 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
728869809e error: Add helper functions to print errors and abort 2024-07-15 16:33:38 +02:00
Nick Wellnhofer
2e63656ec6 parser: Check return value of inputPush
inputPush typically doesn't fail because we pre-allocate the input
table. The return value should be checked nevertheless.
2024-07-08 11:27:52 +02:00
Nick Wellnhofer
c127c89f98 catalog: Deprecate xmlCatalogSetDefaultPrefer 2024-07-02 22:06:53 +02:00
Nick Wellnhofer
606f410891 parser: Allow to disable catalogs with parser options
Implement XML_PARSE_NO_SYS_CATALOG and XML_PARSE_NO_CATALOG_PI.

Fixes #735.
2024-07-02 22:06:53 +02:00
Nick Wellnhofer
598ee0d2c6 error: Remove underscores from xmlRaiseError 2024-06-27 14:43:10 +02:00
Nick Wellnhofer
84a4f84c1c build: Don't check for required headers and functions
Unless we are on Windows, the following POSIX headers are required.
They're part of the earliest POSIX specs and it doesn't make sense to
check for them.

- fcntl.h
- unistd.h
- sys/stat.h
- sys/time.h

On Windows, io.h, fcntl.h and sys/stat.h are always available.
2024-06-22 18:41:00 +02:00
Rosen Penev
2def7b4b28 clang-tidy: move assignments out of if
Found with bugprone-assignment-in-if-condition

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2024-06-20 21:11:44 -07:00
Nick Wellnhofer
08a6a0848e Fix previous commit 2024-06-15 22:00:00 +02:00
Nick Wellnhofer
84666581c2 catalog: Fix initialization
Initialize mutex via xmlInitParser.

Fix some other initialization calls.
2024-06-15 21:15:26 +02:00
Nick Wellnhofer
723b4de040 catalog: Fetch XML catalog before dumping
Catalog entries seem to be loaded lazily.

Should fix #699.
2024-03-03 22:29:05 +01:00
Nick Wellnhofer
a9e73f11c0 catalog: Remove Windows hack
Shouldn't be necessary after commit 865520f0.

Fixes #688.
2024-02-11 12:49:45 +01:00
Nick Wellnhofer
955c177f69 parser: Stop using 'directory' struct member
This was only used as a pointless fallback for URI resolution.
2023-12-25 23:38:40 +01:00
Nick Wellnhofer
6cb8420a9e catalog: Improve error handling
Handle malloc failures from xmlRaiseError.

Remove arguments from memor error handler.

Remove TODO macro.

Make debugging code print to stderr instead of xmlGenericError.
2023-12-21 02:46:27 +01:00
Nick Wellnhofer
699299cae3 globals: Stop including globals.h 2023-09-20 22:07:40 +02:00
Nick Wellnhofer
c9e4c6d416 catalog: Fix memory leaks
Fixes #377.
2023-02-21 15:22:01 +01:00
Lukáš Tyrychtr
85c6cacd67 catalog.c: Silence a cast warning on VS 2022
Fixes #457.
2022-12-08 13:34:03 +01:00
Chun-wei Fan
cfbe68e468 sources: Silence C4013 warnings on Visual Studio
The read(), close(), open(), lseek() functions are found in io.h on Visual
Studio, which does not ship unistd.h, so include io.h on Windows if unistd.h
is not found.

C4013 (aka implicit declaration of ...) warnings can often ring alarm bells.
2022-11-22 15:20:53 +08:00
Nick Wellnhofer
b6f1298ae7 warnings: Remove set-but-unused variables
Fixes compiler warnings with clang 15.
2022-10-25 19:34:38 +02:00
Nick Wellnhofer
5bffa33a12 Stop including sys/types.h 2022-09-02 18:33:36 +02:00
Nick Wellnhofer
2cac626976 Don't use sizeof(xmlChar) or sizeof(char) 2022-09-01 03:35:19 +02:00
Nick Wellnhofer
0f568c0b73 Consolidate private header files
Private functions were previously declared

- in header files in the root directory
- in public headers guarded with IN_LIBXML
- in libxml.h
- redundantly in source files that used them.

Consolidate all private header files in include/private.
2022-08-26 02:11:56 +02:00
Nick Wellnhofer
920753c4aa Don't use default SAX handler to report unrelated errors 2022-08-22 13:48:59 +02:00
David Seifert
865520f048 Respect --sysconfdir in source files
* Prefix installations need to point to a non-root `etc`
  - Gentoo Prefix has been patching this for over 10 years:
    https://bugs.gentoo.org/317891
  - MacPorts has to manually replace paths after patching:
    cc3bb736e9/textproc/libxml2/Portfile (L46)
2022-03-30 14:36:49 +00:00
Nick Wellnhofer
776d15d383 Don't check for standard C89 headers
Don't check for

- ctype.h
- errno.h
- float.h
- limits.h
- math.h
- signal.h
- stdarg.h
- stdlib.h
- string.h
- time.h

Stop including non-standard headers

- malloc.h
- strings.h
2022-03-02 00:43:54 +01:00
Nick Wellnhofer
b094e814fa Remove broken Windows CE support 2022-03-01 00:02:59 +01:00
Nick Wellnhofer
346c3a930c Remove elfgcchack.h
The same optimization can be enabled with -fno-semantic-interposition
since GCC 5. clang has always used this option by default.
2022-02-20 21:49:04 +01:00
David King
f0904f3266 Fix memory leak in xmlParseSGMLCatalog
Found by Coverity.

https://bugzilla.redhat.com/show_bug.cgi?id=1938806
2022-01-16 14:13:26 +01:00
David King
2510f43cba Fix memory leak in xmlParseCatalogFile
Found by Coverity.

https://bugzilla.redhat.com/show_bug.cgi?id=1938806
2022-01-16 14:12:06 +01:00
Nick Wellnhofer
20c60886e4 Fix typos
Resolves #133.
2020-03-08 17:41:53 +01:00
raniervf
d724861536 Null pointer handling in catalog.c
Fix potential deferencing potential null pointers;
Small optimizations.

Closes #123.
2019-11-06 11:47:57 +01:00
Jared Yanovich
2a350ee9b4 Large batch of typo fixes
Closes #109.
2019-09-30 18:04:38 +02:00
Nick Wellnhofer
e03f0a199a Fix hash callback signatures
Make sure that all parameters and return values of hash callback
functions exactly match the callback function type. This is required
to pass clang's Control Flow Integrity checks and to allow compilation
to asm.js with Emscripten.

Fixes bug 784861.
2017-11-09 16:42:47 +01:00
J. Peter Mugaas
d2c329a9a4 Fix -Wimplicit-fallthrough warnings
Add "falls through" comments to quench implicit-fallthrough warnings
which are enabled by -Wextra under GCC 7.
2017-10-21 13:49:31 +02:00
David Kilzer
4472c3a5a5 Fix some format string warnings with possible format string vulnerability
For https://bugzilla.gnome.org/show_bug.cgi?id=761029

Decorate every method in libxml2 with the appropriate
LIBXML_ATTR_FORMAT(fmt,args) macro and add some cleanups
following the reports.
2016-05-23 15:01:07 +08:00
Jan Pokorný
9811ce7864 Fix typos: PATH_{ SEAPARATOR -> SEPARATOR }
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2016-04-15 22:22:43 +08:00
Daniel Veillard
15d12040ff Fix an fd leak in an error case 2014-02-06 10:38:00 +01:00
Daniel Veillard
b8bdc258de Avoid a deadcode in catalog.c
For https://bugzilla.gnome.org/show_bug.cgi?id=703504
2013-09-30 11:12:04 +08:00
Denis Pauk
e1631e1cfc Few cleanup patches for Windows
https://bugzilla.gnome.org/show_bug.cgi?id=690878
provided by Cole <coleharrisjohnson@gmail.com>
2013-03-27 09:55:14 +08:00
Daniel Veillard
f8e3db0445 Big space and tab cleanup
Remove all space before tabs and space and tabs at end of lines.
2012-09-11 13:26:36 +08:00
Daniel Veillard
61551a1eb7 Cleanup function xmlBufResetInput() to set input from Buffer
This was scattered in a number of modules, xmlParserInputPtr
have usually their base, cur and end pointer set from an
xmlBuf used as input.
* buf.c buf.h: add a new function implementing this setup
* parser.c HTMLparser.c catalog.c parserInternals.c xmlreader.c
  use the new function instead of digging into the buffer in
  all those modules
2012-07-23 14:24:27 +08:00
Daniel Veillard
2a1d2422a4 Convert catalog code to the new input buffers
Only one place where the buffers fields where accessed directly
2012-07-23 14:24:27 +08:00
Daniel Veillard
59df1e4f92 Avoid an extra operation
In the catalog code, tsan also complained of testing
the variable without locking and that was done a few lines below
2012-05-21 10:19:21 +08:00
Carlo Bramini
c43ac66988 Avoid a descriptor leak in catalog loading code
File descriptors could be leaked in xmlLoadFileContent()
2010-10-14 14:27:54 +02:00
Daniel Veillard
63806b5373 apply a couple of fixes based on a Coverity report forwarded by Derrick
* catalog.c: apply a couple of fixes based on a Coverity report
  forwarded by Derrick Price.
* VxWorks/README VxWorks/Makefile VxWorks/build.sh: instructions
  Makefile, and shell script to build on VxWorks 6.4+ provided by
  Jim Wert.
Daniel

svn path=/trunk/; revision=3747
2008-06-10 14:56:11 +00:00
Daniel Veillard
be8d9d33eb fixed bug #383687, some case of recursion on next were not caught in the
* catalog.c: fixed bug #383687, some case of recursion on next
  were not caught in the catalog code.
Daniel

svn path=/trunk/; revision=3628
2007-06-12 09:14:11 +00:00
Daniel Veillard
59d3ed8fe0 applied patch from Andreas Stricke to ease the compilation on Windows CE
* catalog.c libxml.h win32/wince/wincecompat.h win32/wince/wincecompat.c
  xmlIO.c nanohttp.c nanoftp.c trio.c triostr.c triostr.h: applied 
  patch from Andreas Stricke to ease the compilation on Windows CE
Daniel

svn path=/trunk/; revision=3600
2007-04-17 12:44:58 +00:00
Daniel Veillard
ed12138b18 "xmllint unusable on win32" so applied a libxml2 patch from Christian
* xmllint.c catalog.c: "xmllint unusable on win32" so applied
  a libxml2 patch from Christian Ehrlicher
Daniel

svn path=/trunk/; revision=3599
2007-04-17 12:33:19 +00:00