mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-02-24 05:57:54 +03:00
cleanup of global variables, marking some const or private. Daniel
* include/libxml/parserInternals.h include/libxml/HTMLparser.h xmlIO.c tree.c parserInternals.c entities.c encoding.c HTMLparser.c: cleanup of global variables, marking some const or private. Daniel
This commit is contained in:
parent
496be68388
commit
220907319a
@ -1,3 +1,10 @@
|
||||
Mon Jul 16 20:05:27 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||
|
||||
* include/libxml/parserInternals.h include/libxml/HTMLparser.h
|
||||
xmlIO.c tree.c parserInternals.c entities.c encoding.c
|
||||
HTMLparser.c: cleanup of global variables, marking some
|
||||
const or private.
|
||||
|
||||
Sun Jul 16 00:17:15 CEST 2001 Thomas Broyer <tbroyer@ltgt.net>
|
||||
|
||||
* include/libxml/xpath.h: exported xmlXPath{NAN,PINF,NINF}
|
||||
|
40
HTMLparser.c
40
HTMLparser.c
@ -48,7 +48,7 @@
|
||||
/* #define DEBUG */
|
||||
/* #define DEBUG_PUSH */
|
||||
|
||||
int htmlOmittedDefaultValue = 1;
|
||||
static int htmlOmittedDefaultValue = 1;
|
||||
|
||||
xmlChar * htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
|
||||
xmlChar end, xmlChar end2, xmlChar end3);
|
||||
@ -353,7 +353,8 @@ htmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
|
||||
*
|
||||
* Name,Start Tag,End Tag,Save End,Empty,Deprecated,DTD,inline,Description
|
||||
*/
|
||||
htmlElemDesc html40ElementTable[] = {
|
||||
static const htmlElemDesc
|
||||
html40ElementTable[] = {
|
||||
{ "a", 0, 0, 0, 0, 0, 0, 1, "anchor " },
|
||||
{ "abbr", 0, 0, 0, 0, 0, 0, 1, "abbreviated form" },
|
||||
{ "acronym", 0, 0, 0, 0, 0, 0, 1, "" },
|
||||
@ -447,27 +448,10 @@ htmlElemDesc html40ElementTable[] = {
|
||||
{ "var", 0, 0, 0, 0, 0, 0, 1, "instance of a variable or program argument" },
|
||||
};
|
||||
|
||||
/*
|
||||
* start tags that imply the end of a current element
|
||||
* any tag of each line implies the end of the current element if the type of
|
||||
* that element is in the same line
|
||||
*/
|
||||
const char *htmlEquEnd[] = {
|
||||
"dt", "dd", "li", "option", NULL,
|
||||
"h1", "h2", "h3", "h4", "h5", "h6", NULL,
|
||||
"ol", "menu", "dir", "address", "pre", "listing", "xmp", NULL,
|
||||
NULL
|
||||
};
|
||||
/*
|
||||
* acording the HTML DTD, HR should be added to the 2nd line above, as it
|
||||
* is not allowed within a H1, H2, H3, etc. But we should tolerate that case
|
||||
* because many documents contain rules in headings...
|
||||
*/
|
||||
|
||||
/*
|
||||
* start tags that imply the end of current element
|
||||
*/
|
||||
const char *htmlStartClose[] = {
|
||||
static const char *htmlStartClose[] = {
|
||||
"form", "form", "p", "hr", "h1", "h2", "h3", "h4", "h5", "h6",
|
||||
"dl", "ul", "ol", "menu", "dir", "address", "pre",
|
||||
"listing", "xmp", "head", NULL,
|
||||
@ -577,7 +561,7 @@ typedef struct {
|
||||
int priority;
|
||||
} elementPriority;
|
||||
|
||||
const elementPriority htmlEndPriority[] = {
|
||||
static const elementPriority htmlEndPriority[] = {
|
||||
{"div", 150},
|
||||
{"td", 160},
|
||||
{"th", 160},
|
||||
@ -632,14 +616,14 @@ htmlInitAutoClose(void) {
|
||||
*
|
||||
* Returns the related htmlElemDescPtr or NULL if not found.
|
||||
*/
|
||||
htmlElemDescPtr
|
||||
const htmlElemDescPtr
|
||||
htmlTagLookup(const xmlChar *tag) {
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < (sizeof(html40ElementTable) /
|
||||
sizeof(html40ElementTable[0]));i++) {
|
||||
if (!xmlStrcasecmp(tag, BAD_CAST html40ElementTable[i].name))
|
||||
return(&html40ElementTable[i]);
|
||||
return((const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) &html40ElementTable[i]);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
@ -1042,7 +1026,7 @@ htmlIsScriptAttribute(const xmlChar *name) {
|
||||
************************************************************************/
|
||||
|
||||
|
||||
htmlEntityDesc html40EntitiesTable[] = {
|
||||
static const htmlEntityDesc html40EntitiesTable[] = {
|
||||
/*
|
||||
* the 4 absolute ones, plus apostrophe.
|
||||
*/
|
||||
@ -1353,7 +1337,7 @@ htmlEntityDesc html40EntitiesTable[] = {
|
||||
*
|
||||
* Returns the associated htmlEntityDescPtr if found, NULL otherwise.
|
||||
*/
|
||||
htmlEntityDescPtr
|
||||
const htmlEntityDescPtr
|
||||
htmlEntityLookup(const xmlChar *name) {
|
||||
unsigned int i;
|
||||
|
||||
@ -1363,7 +1347,7 @@ htmlEntityLookup(const xmlChar *name) {
|
||||
#ifdef DEBUG
|
||||
xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", name);
|
||||
#endif
|
||||
return(&html40EntitiesTable[i]);
|
||||
return((const htmlEntityDescPtr) &html40EntitiesTable[i]);
|
||||
}
|
||||
}
|
||||
return(NULL);
|
||||
@ -1379,7 +1363,7 @@ htmlEntityLookup(const xmlChar *name) {
|
||||
*
|
||||
* Returns the associated htmlEntityDescPtr if found, NULL otherwise.
|
||||
*/
|
||||
htmlEntityDescPtr
|
||||
const htmlEntityDescPtr
|
||||
htmlEntityValueLookup(unsigned int value) {
|
||||
unsigned int i;
|
||||
#ifdef DEBUG
|
||||
@ -1394,7 +1378,7 @@ htmlEntityValueLookup(unsigned int value) {
|
||||
#ifdef DEBUG
|
||||
xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", html40EntitiesTable[i].name);
|
||||
#endif
|
||||
return(&html40EntitiesTable[i]);
|
||||
return((const htmlEntityDescPtr) &html40EntitiesTable[i]);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (lv > html40EntitiesTable[i].value) {
|
||||
|
@ -45,8 +45,8 @@
|
||||
#endif
|
||||
#include <libxml/xmlerror.h>
|
||||
|
||||
xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL;
|
||||
xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL;
|
||||
static xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL;
|
||||
static xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL;
|
||||
|
||||
typedef struct _xmlCharEncodingAlias xmlCharEncodingAlias;
|
||||
typedef xmlCharEncodingAlias *xmlCharEncodingAliasPtr;
|
||||
|
@ -26,7 +26,7 @@ struct xmlPredefinedEntityValue {
|
||||
const char *name;
|
||||
const char *value;
|
||||
};
|
||||
struct xmlPredefinedEntityValue xmlPredefinedEntityValues[] = {
|
||||
static struct xmlPredefinedEntityValue xmlPredefinedEntityValues[] = {
|
||||
{ "lt", "<" },
|
||||
{ "gt", ">" },
|
||||
{ "apos", "'" },
|
||||
@ -46,7 +46,8 @@ xmlHashTablePtr xmlPredefinedEntities = NULL;
|
||||
static void xmlFreeEntity(xmlEntityPtr entity) {
|
||||
if (entity == NULL) return;
|
||||
|
||||
if ((entity->children) && (entity->children->parent == entity))
|
||||
if ((entity->children) &&
|
||||
(entity == (xmlEntityPtr) entity->children->parent))
|
||||
xmlFreeNodeList(entity->children);
|
||||
if (entity->name != NULL)
|
||||
xmlFree((char *) entity->name);
|
||||
|
@ -58,9 +58,9 @@ struct _htmlEntityDesc {
|
||||
/*
|
||||
* There is only few public functions.
|
||||
*/
|
||||
htmlElemDescPtr htmlTagLookup (const xmlChar *tag);
|
||||
htmlEntityDescPtr htmlEntityLookup(const xmlChar *name);
|
||||
htmlEntityDescPtr htmlEntityValueLookup(unsigned int value);
|
||||
const htmlElemDescPtr htmlTagLookup (const xmlChar *tag);
|
||||
const htmlEntityDescPtr htmlEntityLookup(const xmlChar *name);
|
||||
const htmlEntityDescPtr htmlEntityValueLookup(unsigned int value);
|
||||
|
||||
int htmlIsAutoClosed(htmlDocPtr doc,
|
||||
htmlNodePtr elem);
|
||||
|
@ -185,9 +185,13 @@ LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
|
||||
LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
|
||||
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
|
||||
LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
|
||||
LIBXML_DLL_IMPORT extern xmlChar xmlStringText[];
|
||||
LIBXML_DLL_IMPORT extern xmlChar xmlStringTextNoenc[];
|
||||
LIBXML_DLL_IMPORT extern xmlChar xmlStringComment[];
|
||||
|
||||
/**
|
||||
* Global variables used for predefined strings
|
||||
*/
|
||||
LIBXML_DLL_IMPORT extern const xmlChar xmlStringText[];
|
||||
LIBXML_DLL_IMPORT extern const xmlChar xmlStringTextNoenc[];
|
||||
LIBXML_DLL_IMPORT extern const xmlChar xmlStringComment[];
|
||||
|
||||
/*
|
||||
* Function to finish teh work of the macros where needed
|
||||
|
@ -83,7 +83,7 @@ xmlCheckVersion(int version) {
|
||||
}
|
||||
|
||||
|
||||
const char *xmlFeaturesList[] = {
|
||||
static const char *xmlFeaturesList[] = {
|
||||
"validate",
|
||||
"load subset",
|
||||
"keep blanks",
|
||||
|
15
tree.c
15
tree.c
@ -36,17 +36,24 @@
|
||||
|
||||
xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Deprecated *
|
||||
* *
|
||||
************************************************************************/
|
||||
int oldXMLWDcompatibility = 0;
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* A few static variables and macros *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
|
||||
xmlChar xmlStringTextNoenc[] =
|
||||
const xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
|
||||
const xmlChar xmlStringTextNoenc[] =
|
||||
{ 't', 'e', 'x', 't', 'n', 'o', 'e', 'n', 'c', 0 };
|
||||
xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 };
|
||||
int oldXMLWDcompatibility = 0;
|
||||
const xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 };
|
||||
|
||||
int xmlIndentTreeOutput = 0;
|
||||
xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
|
||||
|
||||
|
12
xmlIO.c
12
xmlIO.c
@ -96,9 +96,9 @@ typedef struct _xmlInputCallback {
|
||||
|
||||
#define MAX_INPUT_CALLBACK 15
|
||||
|
||||
xmlInputCallback xmlInputCallbackTable[MAX_INPUT_CALLBACK];
|
||||
int xmlInputCallbackNr = 0;
|
||||
int xmlInputCallbackInitialized = 0;
|
||||
static xmlInputCallback xmlInputCallbackTable[MAX_INPUT_CALLBACK];
|
||||
static int xmlInputCallbackNr = 0;
|
||||
static int xmlInputCallbackInitialized = 0;
|
||||
|
||||
/*
|
||||
* Output I/O callback sets
|
||||
@ -112,9 +112,9 @@ typedef struct _xmlOutputCallback {
|
||||
|
||||
#define MAX_OUTPUT_CALLBACK 15
|
||||
|
||||
xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK];
|
||||
int xmlOutputCallbackNr = 0;
|
||||
int xmlOutputCallbackInitialized = 0;
|
||||
static xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK];
|
||||
static int xmlOutputCallbackNr = 0;
|
||||
static int xmlOutputCallbackInitialized = 0;
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
|
Loading…
x
Reference in New Issue
Block a user