Skip to content

Commit 0f568c0

Browse files
committed
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.
1 parent 48f84ea commit 0f568c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+308
-337
lines changed

HTMLparser.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@
2828
#include <libxml/globals.h>
2929
#include <libxml/uri.h>
3030

31-
#include "buf.h"
32-
#include "enc.h"
31+
#include "private/buf.h"
32+
#include "private/enc.h"
33+
#include "private/error.h"
34+
#include "private/html.h"
35+
#include "private/parser.h"
36+
#include "private/tree.h"
3337

3438
#define HTML_MAX_NAMELEN 1000
3539
#define HTML_PARSER_BIG_BUFFER_SIZE 1000

HTMLtree.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
#include <libxml/globals.h>
2626
#include <libxml/uri.h>
2727

28-
#include "buf.h"
28+
#include "private/buf.h"
29+
#include "private/error.h"
30+
#include "private/io.h"
31+
#include "private/save.h"
2932

3033
/************************************************************************
3134
* *
@@ -328,11 +331,6 @@ htmlIsBooleanAttr(const xmlChar *name)
328331
}
329332

330333
#ifdef LIBXML_OUTPUT_ENABLED
331-
/*
332-
* private routine exported from xmlIO.c
333-
*/
334-
xmlOutputBufferPtr
335-
xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
336334
/************************************************************************
337335
* *
338336
* Output error handlers *
@@ -622,8 +620,6 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
622620
* *
623621
************************************************************************/
624622

625-
void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
626-
627623
/**
628624
* htmlDtdDumpOutput:
629625
* @buf: the HTML buffer output

Makefile.am

+2-2
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ EXTRA_DIST = xml2-config.in libxml.spec.in \
395395
libxml-2.0.pc.in libxml-2.0-uninstalled.pc.in \
396396
libxml2-config.cmake.in autogen.sh \
397397
trionan.c trionan.h triostr.c triostr.h trio.c trio.h \
398-
triop.h triodef.h libxml.h xzlib.h buf.h \
399-
enc.h save.h genUnicode.py TODO_SCHEMAS \
398+
triop.h triodef.h libxml.h \
399+
genUnicode.py TODO_SCHEMAS \
400400
dbgen.pl dbgenattr.pl \
401401
README.tests Makefile.tests libxml2.syms timsort.h \
402402
README.zOS README.md \

SAX2.c

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#include <libxml/HTMLtree.h>
2929
#include <libxml/globals.h>
3030

31+
#include "private/error.h"
32+
#include "private/parser.h"
33+
#include "private/tree.h"
34+
3135
/* Define SIZE_T_MAX unless defined through <limits.h>. */
3236
#ifndef SIZE_T_MAX
3337
# define SIZE_T_MAX ((size_t)-1)

buf.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
#include <libxml/globals.h>
2525
#include <libxml/tree.h>
2626
#include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */
27-
#include "buf.h"
27+
28+
#include "private/buf.h"
29+
#include "private/error.h"
2830

2931
#ifndef SIZE_MAX
3032
#define SIZE_MAX ((size_t) -1)

c14n.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
#include <libxml/xpathInternals.h>
2626
#include <libxml/c14n.h>
2727

28-
#include "buf.h"
28+
#include "private/buf.h"
29+
#include "private/error.h"
2930

3031
/************************************************************************
3132
* *

catalog.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
#include <libxml/threads.h>
4040
#include <libxml/globals.h>
4141

42-
#include "buf.h"
42+
#include "private/buf.h"
43+
#include "private/error.h"
4344

4445
#define MAX_DELEGATE 50
4546
#define MAX_CATAL_DEPTH 50

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ AC_SUBST(RELDATE)
14371437
AC_SUBST(PYTHON_TESTS)
14381438

14391439
# keep on one line for cygwin c.f. #130896
1440-
AC_CONFIG_FILES([libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile fuzz/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h libxml-2.0.pc libxml-2.0-uninstalled.pc libxml2-config.cmake])
1440+
AC_CONFIG_FILES([libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile include/private/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile fuzz/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h libxml-2.0.pc libxml-2.0-uninstalled.pc libxml2-config.cmake])
14411441
AC_CONFIG_FILES([python/setup.py], [chmod +x python/setup.py])
14421442
AC_CONFIG_FILES([xml2-config], [chmod +x xml2-config])
14431443
AC_OUTPUT

debugXML.c

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include <libxml/relaxng.h>
3131
#endif
3232

33+
#include "private/error.h"
34+
3335
#define DUMP_TEXT_TYPE 1
3436

3537
typedef struct _xmlDebugCtxt xmlDebugCtxt;

dict.c

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include <stdlib.h>
2424
#include <time.h>
2525

26+
#include "private/dict.h"
27+
2628
/*
2729
* Following http://www.ocert.org/advisories/ocert-2011-003.html
2830
* it seems that having hash randomization might be a good idea

doc/apibuild.py

-6
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@
2323
"trio.c": "too many non standard macros",
2424
"trionan.c": "too many non standard macros",
2525
"triostr.c": "too many non standard macros",
26-
"acconfig.h": "generated portability layer",
2726
"config.h": "generated portability layer",
2827
"libxml.h": "internal only",
2928
"testOOM.c": "out of memory tester",
3029
"testOOMlib.h": "out of memory tester",
3130
"testOOMlib.c": "out of memory tester",
3231
"rngparser.c": "not yet integrated",
33-
"rngparser.h": "not yet integrated",
3432
"testAutomata.c": "test tool",
3533
"testModule.c": "test tool",
3634
"testThreads.c": "test tool",
@@ -41,10 +39,6 @@
4139
"test.c": "not part of the library",
4240
"testdso.c": "test for dynamid shared libraries",
4341
"testrecurse.c": "test for entities recursions",
44-
"xzlib.h": "Internal API only 2.8.0",
45-
"buf.h": "Internal API only 2.9.0",
46-
"enc.h": "Internal API only 2.9.0",
47-
"/save.h": "Internal API only 2.9.0",
4842
"timsort.h": "Internal header only for xpath.c 2.9.0",
4943
}
5044

enc.h

-32
This file was deleted.

encoding.c

+8-33
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@
4040
#include <libxml/globals.h>
4141
#include <libxml/xmlerror.h>
4242

43-
#include "buf.h"
44-
#include "enc.h"
43+
#include "private/buf.h"
44+
#include "private/enc.h"
45+
#include "private/error.h"
4546

4647
#ifdef LIBXML_ICU_ENABLED
4748
#include <unicode/ucnv.h>
@@ -2056,11 +2057,10 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
20562057
}
20572058

20582059
/**
2059-
* xmlCharEncFirstLineInt:
2060+
* xmlCharEncFirstLine:
20602061
* @handler: char encoding transformation data structure
20612062
* @out: an xmlBuffer for the output.
20622063
* @in: an xmlBuffer for the input
2063-
* @len: number of bytes to convert for the first line, or -1
20642064
*
20652065
* Front-end for the encoding handler input function, but handle only
20662066
* the very first line, i.e. limit itself to 45 chars.
@@ -2071,8 +2071,8 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
20712071
* the result of transformation can't fit into the encoding we want), or
20722072
*/
20732073
int
2074-
xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
2075-
xmlBufferPtr in, int len) {
2074+
xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
2075+
xmlBufferPtr in) {
20762076
int ret;
20772077
int written;
20782078
int toconv;
@@ -2092,13 +2092,8 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
20922092
* The actual value depending on guessed encoding is passed as @len
20932093
* if provided
20942094
*/
2095-
if (len >= 0) {
2096-
if (toconv > len)
2097-
toconv = len;
2098-
} else {
2099-
if (toconv > 180)
2100-
toconv = 180;
2101-
}
2095+
if (toconv > 180)
2096+
toconv = 180;
21022097
if (toconv * 2 >= written) {
21032098
xmlBufferGrow(out, toconv * 2);
21042099
written = out->size - out->use - 1;
@@ -2142,26 +2137,6 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
21422137
return(written ? written : ret);
21432138
}
21442139

2145-
/**
2146-
* xmlCharEncFirstLine:
2147-
* @handler: char encoding transformation data structure
2148-
* @out: an xmlBuffer for the output.
2149-
* @in: an xmlBuffer for the input
2150-
*
2151-
* Front-end for the encoding handler input function, but handle only
2152-
* the very first line, i.e. limit itself to 45 chars.
2153-
*
2154-
* Returns the number of byte written if success, or
2155-
* -1 general error
2156-
* -2 if the transcoding fails (for *in is not valid utf8 string or
2157-
* the result of transformation can't fit into the encoding we want), or
2158-
*/
2159-
int
2160-
xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
2161-
xmlBufferPtr in) {
2162-
return(xmlCharEncFirstLineInt(handler, out, in, -1));
2163-
}
2164-
21652140
/**
21662141
* xmlCharEncFirstLineInput:
21672142
* @input: a parser input buffer

entities.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
#include <libxml/globals.h>
2727
#include <libxml/dict.h>
2828

29-
#include "save.h"
29+
#include "private/entities.h"
30+
#include "private/error.h"
3031

3132
/*
3233
* The XML predefined entities.

error.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
#include <libxml/xmlmemory.h>
1717
#include <libxml/globals.h>
1818

19-
void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
20-
const char *msg,
21-
...) LIBXML_ATTR_FORMAT(2,3);
19+
#include "private/error.h"
2220

2321
#define XML_GET_VAR_STR(msg, str) { \
2422
int size, prev_size = -1; \

globals.c

+4-9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
#include <libxml/xmlmemory.h>
2222
#include <libxml/threads.h>
2323

24+
#include "private/error.h"
25+
#include "private/threads.h"
26+
#include "private/tree.h"
27+
2428
/* #define DEBUG_GLOBALS */
2529

2630
/*
@@ -325,15 +329,6 @@ static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilename
325329
xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
326330
static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
327331

328-
/*
329-
* Error handling
330-
*/
331-
332-
/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
333-
/* Must initialize xmlGenericError in xmlInitParser */
334-
void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
335-
const char *msg,
336-
...);
337332
/**
338333
* xmlGenericError:
339334
*

hash.c

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
#include <libxml/xmlerror.h>
4040
#include <libxml/globals.h>
4141

42+
#include "private/dict.h"
43+
4244
#define MAX_HASH_LEN 8
4345

4446
/* #define DEBUG_GROW */

include/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Process this file with automake to produce Makefile.in
2-
SUBDIRS=libxml
2+
SUBDIRS=libxml private
33

44
EXTRA_DIST = win32config.h wsockcompat.h
55

include/libxml/parserInternals.h

-19
Original file line numberDiff line numberDiff line change
@@ -317,16 +317,6 @@ XMLPUBFUN int XMLCALL
317317
xmlParserInputPtr input,
318318
xmlCharEncodingHandlerPtr handler);
319319

320-
#ifdef IN_LIBXML
321-
/* internal error reporting */
322-
XMLPUBFUN void XMLCALL
323-
__xmlErrEncoding (xmlParserCtxtPtr ctxt,
324-
xmlParserErrors xmlerr,
325-
const char *msg,
326-
const xmlChar * str1,
327-
const xmlChar * str2) LIBXML_ATTR_FORMAT(3,0);
328-
#endif
329-
330320
/**
331321
* Input Streams.
332322
*/
@@ -645,15 +635,6 @@ XMLPUBFUN void XMLCALL
645635

646636
#endif /* LIBXML_LEGACY_ENABLED */
647637

648-
#ifdef IN_LIBXML
649-
/*
650-
* internal only
651-
*/
652-
XMLPUBFUN void XMLCALL
653-
xmlErrMemory (xmlParserCtxtPtr ctxt,
654-
const char *extra);
655-
#endif
656-
657638
#ifdef __cplusplus
658639
}
659640
#endif

include/libxml/valid.h

-15
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,6 @@ typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx,
5858
const char *msg,
5959
...) LIBXML_ATTR_FORMAT(2,3);
6060

61-
#ifdef IN_LIBXML
62-
/**
63-
* XML_VCTXT_DTD_VALIDATED:
64-
*
65-
* Set after xmlValidateDtdFinal was called.
66-
*/
67-
#define XML_VCTXT_DTD_VALIDATED (1u << 0)
68-
/**
69-
* XML_VCTXT_USE_PCTXT:
70-
*
71-
* Set if the validation context is part of a parser context.
72-
*/
73-
#define XML_VCTXT_USE_PCTXT (1u << 1)
74-
#endif
75-
7661
/*
7762
* xmlValidCtxt:
7863
* An xmlValidCtxt is used for error reporting when validating.

0 commit comments

Comments
 (0)