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

75 Commits

Author SHA1 Message Date
Nick Wellnhofer
65d381f32c threads: Allocate mutexes statically 2022-11-25 15:12:56 +01:00
Nick Wellnhofer
9dbf137455 parser: Make some module init/cleanup functions private 2022-11-25 15:02:04 +01:00
Nick Wellnhofer
cecd364dd2 parser: Don't call *DefaultSAXHandlerInit from xmlInitParser
Change the default handler definitions to match the result after calling
the initialization functions.

This makes sure that no thread-local variables are accessed when calling
xmlInitParser.
2022-11-25 15:02:04 +01:00
Nick Wellnhofer
ad338ca737 Remove explicit integer casts
Remove explicit integer casts as final operation

- in assignments
- when passing arguments
- when returning values

Remove casts

- to the same type
- from certain range-bound values

The main motivation is that these explicit casts don't change the result
of operations and only render UBSan's implicit-conversion checks
useless. Removing these casts allows UBSan to detect cases where
truncation or sign-changes occur unexpectedly.

Document some explicit casts as truncating and add a few missing ones.
2022-09-01 02:33:57 +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
3513d76aa2 Improve documentation of globals
Document more global variables as deprecated. Some of the variables
don't generate deprecation warnings yet, but they shouldn't be used in
new code.
2022-08-24 02:27:50 +02:00
Nick Wellnhofer
92bb889be3 Don't index anything in DOC_DISABLE sections
Somewhat misleadingly, the DOC_DISABLE directive only disabled warnings.
Now we really stop the documentation generator from indexing.

This results in additional warnings for xmlThrDef* functions. This should
be fixed by documenting or deprecating them.
2022-08-24 00:51:52 +02:00
Nick Wellnhofer
75b5bc2b0a Deprecate some global variables
Most of these should be completely unused.
2022-08-24 00:31:10 +02:00
Nick Wellnhofer
4b184240be Remove htmlDefaultSAXHandler from non-SAX1 build
This matches long-standing behavior of the XML counterpart.
2022-08-22 14:24:25 +02:00
Nick Wellnhofer
40483d0ce2 Deprecate module init and cleanup functions
These functions shouldn't be part of the public API. Most init
functions are only thread-safe when called from xmlInitParser. Global
variables should only be cleaned up by calling xmlCleanupParser.
2022-03-06 15:59:43 +01:00
Nick Wellnhofer
4a8c71eb7c Remove DOCBparser
This code has been broken and deprecated since version 2.6.0, released
in 2003. Because of a bug in commit 961b535c, DOCBparser.c was never
compiled since 2012. I couldn't find a Debian package using any of its
symbols, so it seems safe to remove this module.
2022-03-04 22:56:21 +01:00
Nick Wellnhofer
5dcfbc4900 Move xmlCleanupGlobals to non-generated section
The bottom of the file was generated by build_glob.py. The generator
script needs some updates, but might still be useful.
2022-03-02 20:34:37 +01: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
89d9ef3ee8 Reset last error in xmlCleanupGlobals
Before, we tried to reset the last error in xmlCleanupParser. But if
xmlCleanupParser wasn't called from the main thread, this would reset
the thread-local error object. xmlCleanupGlobals has access to the
error object of the main thread and can reset it reliably.
2022-03-01 15:14:00 +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
Nick Wellnhofer
20c60886e4 Fix typos
Resolves #133.
2020-03-08 17:41:53 +01:00
Jared Yanovich
2a350ee9b4 Large batch of typo fixes
Closes #109.
2019-09-30 18:04:38 +02:00
Nick Wellnhofer
71462a6006 Introduce xmlPosixStrdup and update xmlMemStrdup
Introduce xmlPosixStrdup, an internal strdup implementation matching the
POSIX strdup type signature, and update xmlMemStrdup to use it.

Thanks to Vlad Tsyrklevich for the initial patch.
2017-11-09 15:30:15 +01: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
Akira TAGOH
961b535c10 Bug 676544 - fails to build with --without-sax1
Added some ifdef'd LIBXML_SAX1_ENABLED to make it buildable with
--without-sax1 configure option.
2012-08-28 22:03:16 +08:00
Kai Henning
2c2128387d Fix an init bug in global.c
* globals.c: fix the initialization of the mutex
2009-10-12 22:30:32 +02:00
MOD
44d1eff028 594514 memory leaks - duplicate initialization
* globals.c: xmlInitGlobals() might be called multiple times, leaking
  the xmlThrDefMutex value
2009-09-09 19:03:13 +02:00
Wang Lam
1de382eb06 Fix SetGenericErrorFunc and SetStructured clash
* include/libxml/globals.h globals.c global.data: define a new global
  variable (per thread) for structured error reporting, to not conflict
  with generic one
* error.c: when defined use the structured error report over any generic
  one
2009-08-24 17:34:25 +02:00
Daniel Veillard
ccc476f177 patch from Alex Khesin fixing CDATA output after a text node. fixed the
* xmlwriter.c: patch from Alex Khesin fixing CDATA output after
  a text node.
* parser.c: fixed the comment for xmlParserCleanup
* globals.c: fixed indentation
Daniel

svn path=/trunk/; revision=3699
2008-03-04 13:19:49 +00:00
Rob Richards
91eb560c7c __xmlGlobalInitMutexDestroy() will free global_init_lock on Win32. Patch
* globals.c threads.c include/libxml/threads.h: 
  __xmlGlobalInitMutexDestroy() will free global_init_lock on Win32.
  Patch from Marc-Antoine Ruel.

svn path=/trunk/; revision=3664
2007-11-16 10:54:59 +00:00
Daniel Veillard
bca3ad25f9 fixed compilation when configured --without-sax1 and other cleanups fixes
* SAX2.c globals.c runtest.c testC14N.c testapi.c tree.c
  include/libxml/SAX2.h include/libxml/xmlregexp.h: fixed compilation
  when configured --without-sax1 and other cleanups fixes bug #172683
* doc/* elfgcchack.h: regenerated
Daniel
2005-08-23 22:14:02 +00:00
Daniel Veillard
75e389d4e0 more cleanups based on sparse reports, added "make sparse" Daniel
* Makefile.am globals.c parserInternals.c xmlreader.c xmlunicode.c
  xmlwriter.c: more cleanups based on sparse reports, added
  "make sparse"
Daniel
2005-07-29 22:02:24 +00:00
Daniel Veillard
24505b0f5c a lot of small cleanups based on Linus' sparse check output. Daniel
* HTMLparser.c SAX2.c encoding.c globals.c parser.c relaxng.c
  runsuite.c runtest.c schematron.c testHTML.c testReader.c
  testRegexp.c testSAX.c testThreads.c valid.c xinclude.c xmlIO.c
  xmllint.c xmlmodule.c xmlschemas.c xpath.c xpointer.c: a lot of
  small cleanups based on Linus' sparse check output.
Daniel
2005-07-28 23:49:35 +00:00
Daniel Veillard
ffa3c74933 applied a patch from Marcus Boerger to fix problems with calling
* error.c globals.c parser.c runtest.c testHTML.c testSAX.c
  threads.c valid.c xmllint.c xmlreader.c xmlschemas.c xmlstring.c
  xmlwriter.c include/libxml/parser.h include/libxml/relaxng.h
  include/libxml/valid.h include/libxml/xmlIO.h
  include/libxml/xmlerror.h include/libxml/xmlexports.h
  include/libxml/xmlschemas.h: applied a patch from Marcus Boerger
  to fix problems with calling conventions on Windows this should
  fix #309757
Daniel
2005-07-21 13:24:09 +00:00
Daniel Veillard
d846768e27 applied patch from Morten Welinder, closing bug #306901 on compiling
* globals.c: applied patch from Morten Welinder, closing bug #306901
  on compiling subsets of the library
Daniel
2005-06-08 17:42:42 +00:00
Daniel Veillard
5d4644ef6e revamped the elfgcchack.h format to cope with gcc4 change of aliasing
* doc/apibuild.py doc/elfgcchack.xsl: revamped the elfgcchack.h
  format to cope with gcc4 change of aliasing allowed scopes, had
  to add extra informations to doc/libxml2-api.xml to separate
  the header from the c module source.
* *.c: updated all c library files to add a #define bottom_xxx
  and reimport elfgcchack.h thereafter, and a bit of cleanups.
* doc//* testapi.c: regenerated when rebuilding the API
Daniel
2005-04-01 13:11:58 +00:00
William M. Brack
21e4ef20f6 Re-examined the problems of configuring a "minimal" library.
Synchronized the header files with the library code in order
to assure that all the various conditionals (LIBXML_xxxx_ENABLED)
were the same in both.  Modified the API database content to more
accurately reflect the conditionals.  Enhanced the generation
of that database.  Although there was no substantial change to
any of the library code's logic, a large number of files were
modified to achieve the above, and the configuration script
was enhanced to do some automatic enabling of features (e.g.
--with-xinclude forces --with-xpath).  Additionally, all the format
errors discovered by apibuild.py were corrected.
* configure.in: enhanced cross-checking of options
* doc/apibuild.py, doc/elfgcchack.xsl, doc/libxml2-refs.xml,
  doc/libxml2-api.xml, gentest.py: changed the usage of the
  <cond> element in module descriptions
* elfgcchack.h, testapi.c: regenerated with proper conditionals
* HTMLparser.c, SAX.c, globals.c, tree.c, xmlschemas.c, xpath.c,
  testSAX.c: cleaned up conditionals
* include/libxml/[SAX.h, SAX2.h, debugXML.h, encoding.h, entities.h,
  hash.h, parser.h, parserInternals.h, schemasInternals.h, tree.h,
  valid.h, xlink.h, xmlIO.h, xmlautomata.h, xmlreader.h, xpath.h]:
  synchronized the conditionals with the corresponding module code
* doc/examples/tree2.c, doc/examples/xpath1.c, doc/examples/xpath2.c:
  added additional conditions required for compilation
* doc/*.html, doc/html/*.html: rebuilt the docs
2005-01-02 09:53:13 +00:00
Daniel Veillard
fc484dd0a0 added support for HTML PIs #156087 added specific tests Daniel
* HTMLparser.c: added support for HTML PIs #156087
* test/HTML/python.html result/HTML/python.html*: added specific tests
Daniel
2004-10-22 14:34:23 +00:00
William M. Brack
f4025492f5 added some code to include the CVS ChangeLog version in the
* configure.in globals.c include/libxml/xmlversion.h.in
  include/libxml/xmlwin32version.h.in: added some code to
  include the CVS ChangeLog version in the xmlParserVersion
  string (printed by xmllint with --version)
2004-08-18 21:08:46 +00:00
William M. Brack
5ab479b0e4 fixed problem when configuring using --with-thread-alloc
* configure.in, xmlmemory.c, globals.c: fixed problem when
  configuring using --with-thread-alloc
2004-06-10 13:00:15 +00:00
Daniel Veillard
1b243b4fc9 applied patch from Rob Richards for the per thread I/O mappings Daniel
* globals.c xmlIO.c include/libxml/globals.h include/libxml/xmlIO.h:
  applied patch from Rob Richards for the per thread I/O mappings
Daniel
2004-06-08 10:16:42 +00:00
William M. Brack
803812b9fe minor cosmetic changes, no change to logic. regenerated added a newline at
* xmlschemas.c: minor cosmetic changes, no change to logic.
* result/schemas/attruse_0_[12].err: regenerated
* globals.c: added a newline at end to make gcc happy
2004-06-03 02:11:24 +00:00
Daniel Veillard
0335a846ad applied patch from Rob Richards for custom I/O BufferCreateFilenane fixes
* globals.c xmlIO.c include/libxml/globals.h: applied patch from
  Rob Richards for custom I/O BufferCreateFilenane fixes bug
  #143366
Daniel
2004-06-02 16:18:40 +00:00
William M. Brack
966668a703 fixed xmlXPathReturnString to cater for NULL pointer (bug 129561) added
* include/libxml/xpathInternals.h: fixed xmlXPathReturnString
  to cater for NULL pointer (bug 129561)
* globals.c: added comment to suppress documentation warning
* doc/apibuild.py: fixed problem which caused last APIchunkxx.html
  to be lost.  Rebuilt doc/* (including adding APIchunk26.html)
2003-12-20 02:10:28 +00:00
Daniel Veillard
1e90661bb8 cleanup the make rebuild in doc, this include new directive to stop
* globals.c xmlwriter.c doc/apibuild.py include/libxml/globals.h
  include/libxml/pattern.h include/libxml/schemasInternals.h
  include/libxml/xmlexports.h include/libxml/xmlwriter.h: cleanup
  the make rebuild in doc, this include new directive to stop
  documentation warnings
* doc/* doc/html/*: rebuilt the docs
* pattern.c xmlreader.c include/libxml/pattern.h
  include/libxml/xmlreader.h: adding xmlTextReaderPreservePattern()
  to save nodes while scanning the tree with the reader, cleanup
  the way element were freed, and xmlTextReaderPreserve()
  implementation, the API might change for namespace binding support
  when compiling patterns.
* doc/examples/*: added reader3.c exposing the xmlTextReaderPreserve()
Daniel
2003-12-05 14:57:46 +00:00
Daniel Veillard
659e71ec24 Setting up the framework for structured error reporting, touches a lot of
* HTMLparser.c c14n.c catalog.c error.c globals.c parser.c
  parserInternals.c relaxng.c valid.c xinclude.c xmlIO.c xmlregexp.c
  xmlschemas.c xpath.c xpointer.c include/libxml/globals.h
  include/libxml/parser.h include/libxml/valid.h
  include/libxml/xmlerror.h: Setting up the framework for structured
  error reporting, touches a lot of modules, but little code now
  the error handling trail has been cleaned up.
Daniel
2003-10-10 14:10:40 +00:00
Daniel Veillard
2b8c4a151b changed 'make tests' to use a concise output, scrolling to see where thing
* Makefile.am: changed 'make tests' to use a concise output,
  scrolling to see where thing broke wasn't pleasant
* configure.in: some beta4 preparation, but not ready yet
* error.c globals.c include/libxml/globals.h include/libxml/xmlerror.h:
  new error handling code, last error informations are stored
  in the parsing context or a global variable, new APIs to
  handle the xmlErrorPtr type.
* parser.c parserInternals.c valid.c : started migrating to the
  new error handling code, it's a royal pain.
* include/libxml/parser.h include/libxml/parserInternals.h:
  moved the definition of xmlNewParserCtxt()
* parser.c: small potential buffer access problem in push code
  provided by Justin Fletcher
* result/*.sax result/VC/PENesting* result/namespaces/*
  result/valid/*.err: some error messages were sligthly changed.
Daniel
2003-10-02 22:28:19 +00:00
Daniel Veillard
8127390f03 added 2 new configure option: --with-reader --with-sax1 to allow removing
* Makefile.am SAX.c SAX2.c configure.in globals.c parser.c
  parserInternals.c testReader.c testSAX.c xmlIO.c xmllint.c
  xmlreader.c example/gjobread.c include/libxml/xmlversion.h.in:
  added 2 new configure option: --with-reader --with-sax1
  to allow removing the reader or non-xmlReadxxx() interfaces.
Daniel
2003-09-30 00:43:48 +00:00
Daniel Veillard
4432df239b cleanup, creating a new legacy.c module, made sure make tests ran in
* Makefile.am: cleanup, creating a new legacy.c module,
  made sure make tests ran in reduced conditions
* SAX.c SAX2.c configure.in entities.c globals.c parser.c
  parserInternals.c tree.c valid.c xlink.c xmlIO.c xmlcatalog.c
  xmlmemory.c xpath.c xmlmemory.c include/libxml/xmlversion.h.in:
  increased the modularization, allow to configure out
  validation code and legacy code, added a configuration
  option --with-minimum compiling only the mandatory code
  which then shrink to 200KB.
Daniel
2003-09-28 18:58:27 +00:00
Daniel Veillard
092643b52d preparing a beta3 solving the ABI problems make sure the global variables
* configure.in: preparing a beta3 solving the ABI problems
* globals.c parser.c parserInternals.c testHTML.c HTMLparser.c SAX.c
  include/libxml/globals.h include/libxml/SAX.h: make sure the
  global variables for the default SAX handler are V1 ones to
  avoid ABI compat problems.
* xmlreader.c: cleanup of uneeded code
* hash.c: fix a comment
Daniel
2003-09-25 14:29:29 +00:00
Daniel Veillard
07cb8226c0 Time to commit 3 days of work rewriting the parser internal,
fixing bugs and migrating to SAX2 interface by default. There
is some work letf TODO, like namespace validation and attributes
normalization (this break C14N right now)
* Makefile.am: fixed the test rules
* include/libxml/SAX2.h include/libxml/parser.h
  include/libxml/parserInternals.h SAX2.c parser.c
  parserInternals.c: changing the parser, migrating to SAX2,
  adding new interface to switch back to SAX1 or initialize a
  SAX block for v1 or v2. Most of the namespace work is done
  below SAX, as well as attribute defaulting
* globals.c: changed initialization of the default SAX handlers
* hash.c tree.c include/libxml/hash.h: added QName specific handling
* xmlIO.c: small fix
* xmllint.c testSAX.c: provide a --sax1 switch to test the old
  version code path
* result/p3p result/p3p.sax result/noent/p3p test/p3p: the new code
  pointed out a typo in a very old test namespace
Daniel
2003-09-10 10:51:05 +00:00
Daniel Veillard
5805be2921 fixing bug #120870 try to avoid problem with uninitialized mutexes Daniel
* globals.c threads.c: fixing bug #120870 try to avoid problem
  with uninitialized mutexes
Daniel
2003-08-28 08:03:23 +00:00
Daniel Veillard
1af9a41f24 Adding new version of the SAX interface, it's not there yet, currently
* Makefile.am SAX2.c include/libxml/Makefile.am include/libxml/SAX2.h:
  Adding new version of the SAX interface, it's not there yet,
  currently just preparing the work
* globals.c parser.c SAX.c include/libxml/SAX.h
  include/libxml/globals.h include/libxml/parser.h: doing some
  refactoring of the SAXv1 interfaces, obsoleting a bunch of them
  while keeping functionalities, preparing SAX2 integration.
* dict.c: small cleanup.
Daniel
2003-08-20 22:54:39 +00:00
Daniel Veillard
9848532c2a get rid of some compilation warnings. fix the performance problem reported
* DOCBparser.c globals.c include/libxml/xmlmemory.h: get rid of
  some compilation warnings.
* xinclude.c: fix the performance problem reported by Kevin Ruscoe
  plus some cleanup and better error reporting.
Daniel
2003-08-14 15:44:40 +00:00
Daniel Veillard
2009c4ed4d add xmlThrDefMutex = NULL in xmlCleanupGlobals() as suggested by Rob
* globals.c: add xmlThrDefMutex = NULL in xmlCleanupGlobals()
  as suggested by Rob Richards
Daniel
2003-07-15 20:04:34 +00:00