mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +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:
@ -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>
|
Sun Jul 16 00:17:15 CEST 2001 Thomas Broyer <tbroyer@ltgt.net>
|
||||||
|
|
||||||
* include/libxml/xpath.h: exported xmlXPath{NAN,PINF,NINF}
|
* include/libxml/xpath.h: exported xmlXPath{NAN,PINF,NINF}
|
||||||
|
40
HTMLparser.c
40
HTMLparser.c
@ -48,7 +48,7 @@
|
|||||||
/* #define DEBUG */
|
/* #define DEBUG */
|
||||||
/* #define DEBUG_PUSH */
|
/* #define DEBUG_PUSH */
|
||||||
|
|
||||||
int htmlOmittedDefaultValue = 1;
|
static int htmlOmittedDefaultValue = 1;
|
||||||
|
|
||||||
xmlChar * htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
|
xmlChar * htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
|
||||||
xmlChar end, xmlChar end2, xmlChar end3);
|
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
|
* 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 " },
|
{ "a", 0, 0, 0, 0, 0, 0, 1, "anchor " },
|
||||||
{ "abbr", 0, 0, 0, 0, 0, 0, 1, "abbreviated form" },
|
{ "abbr", 0, 0, 0, 0, 0, 0, 1, "abbreviated form" },
|
||||||
{ "acronym", 0, 0, 0, 0, 0, 0, 1, "" },
|
{ "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" },
|
{ "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
|
* 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",
|
"form", "form", "p", "hr", "h1", "h2", "h3", "h4", "h5", "h6",
|
||||||
"dl", "ul", "ol", "menu", "dir", "address", "pre",
|
"dl", "ul", "ol", "menu", "dir", "address", "pre",
|
||||||
"listing", "xmp", "head", NULL,
|
"listing", "xmp", "head", NULL,
|
||||||
@ -577,7 +561,7 @@ typedef struct {
|
|||||||
int priority;
|
int priority;
|
||||||
} elementPriority;
|
} elementPriority;
|
||||||
|
|
||||||
const elementPriority htmlEndPriority[] = {
|
static const elementPriority htmlEndPriority[] = {
|
||||||
{"div", 150},
|
{"div", 150},
|
||||||
{"td", 160},
|
{"td", 160},
|
||||||
{"th", 160},
|
{"th", 160},
|
||||||
@ -632,14 +616,14 @@ htmlInitAutoClose(void) {
|
|||||||
*
|
*
|
||||||
* Returns the related htmlElemDescPtr or NULL if not found.
|
* Returns the related htmlElemDescPtr or NULL if not found.
|
||||||
*/
|
*/
|
||||||
htmlElemDescPtr
|
const htmlElemDescPtr
|
||||||
htmlTagLookup(const xmlChar *tag) {
|
htmlTagLookup(const xmlChar *tag) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < (sizeof(html40ElementTable) /
|
for (i = 0; i < (sizeof(html40ElementTable) /
|
||||||
sizeof(html40ElementTable[0]));i++) {
|
sizeof(html40ElementTable[0]));i++) {
|
||||||
if (!xmlStrcasecmp(tag, BAD_CAST html40ElementTable[i].name))
|
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);
|
return(NULL);
|
||||||
}
|
}
|
||||||
@ -1042,7 +1026,7 @@ htmlIsScriptAttribute(const xmlChar *name) {
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
htmlEntityDesc html40EntitiesTable[] = {
|
static const htmlEntityDesc html40EntitiesTable[] = {
|
||||||
/*
|
/*
|
||||||
* the 4 absolute ones, plus apostrophe.
|
* the 4 absolute ones, plus apostrophe.
|
||||||
*/
|
*/
|
||||||
@ -1353,7 +1337,7 @@ htmlEntityDesc html40EntitiesTable[] = {
|
|||||||
*
|
*
|
||||||
* Returns the associated htmlEntityDescPtr if found, NULL otherwise.
|
* Returns the associated htmlEntityDescPtr if found, NULL otherwise.
|
||||||
*/
|
*/
|
||||||
htmlEntityDescPtr
|
const htmlEntityDescPtr
|
||||||
htmlEntityLookup(const xmlChar *name) {
|
htmlEntityLookup(const xmlChar *name) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@ -1363,7 +1347,7 @@ htmlEntityLookup(const xmlChar *name) {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", name);
|
xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", name);
|
||||||
#endif
|
#endif
|
||||||
return(&html40EntitiesTable[i]);
|
return((const htmlEntityDescPtr) &html40EntitiesTable[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -1379,7 +1363,7 @@ htmlEntityLookup(const xmlChar *name) {
|
|||||||
*
|
*
|
||||||
* Returns the associated htmlEntityDescPtr if found, NULL otherwise.
|
* Returns the associated htmlEntityDescPtr if found, NULL otherwise.
|
||||||
*/
|
*/
|
||||||
htmlEntityDescPtr
|
const htmlEntityDescPtr
|
||||||
htmlEntityValueLookup(unsigned int value) {
|
htmlEntityValueLookup(unsigned int value) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -1394,7 +1378,7 @@ htmlEntityValueLookup(unsigned int value) {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", html40EntitiesTable[i].name);
|
xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", html40EntitiesTable[i].name);
|
||||||
#endif
|
#endif
|
||||||
return(&html40EntitiesTable[i]);
|
return((const htmlEntityDescPtr) &html40EntitiesTable[i]);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (lv > html40EntitiesTable[i].value) {
|
if (lv > html40EntitiesTable[i].value) {
|
||||||
|
@ -45,8 +45,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <libxml/xmlerror.h>
|
#include <libxml/xmlerror.h>
|
||||||
|
|
||||||
xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL;
|
static xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL;
|
||||||
xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL;
|
static xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL;
|
||||||
|
|
||||||
typedef struct _xmlCharEncodingAlias xmlCharEncodingAlias;
|
typedef struct _xmlCharEncodingAlias xmlCharEncodingAlias;
|
||||||
typedef xmlCharEncodingAlias *xmlCharEncodingAliasPtr;
|
typedef xmlCharEncodingAlias *xmlCharEncodingAliasPtr;
|
||||||
|
@ -26,7 +26,7 @@ struct xmlPredefinedEntityValue {
|
|||||||
const char *name;
|
const char *name;
|
||||||
const char *value;
|
const char *value;
|
||||||
};
|
};
|
||||||
struct xmlPredefinedEntityValue xmlPredefinedEntityValues[] = {
|
static struct xmlPredefinedEntityValue xmlPredefinedEntityValues[] = {
|
||||||
{ "lt", "<" },
|
{ "lt", "<" },
|
||||||
{ "gt", ">" },
|
{ "gt", ">" },
|
||||||
{ "apos", "'" },
|
{ "apos", "'" },
|
||||||
@ -46,7 +46,8 @@ xmlHashTablePtr xmlPredefinedEntities = NULL;
|
|||||||
static void xmlFreeEntity(xmlEntityPtr entity) {
|
static void xmlFreeEntity(xmlEntityPtr entity) {
|
||||||
if (entity == NULL) return;
|
if (entity == NULL) return;
|
||||||
|
|
||||||
if ((entity->children) && (entity->children->parent == entity))
|
if ((entity->children) &&
|
||||||
|
(entity == (xmlEntityPtr) entity->children->parent))
|
||||||
xmlFreeNodeList(entity->children);
|
xmlFreeNodeList(entity->children);
|
||||||
if (entity->name != NULL)
|
if (entity->name != NULL)
|
||||||
xmlFree((char *) entity->name);
|
xmlFree((char *) entity->name);
|
||||||
|
@ -58,9 +58,9 @@ struct _htmlEntityDesc {
|
|||||||
/*
|
/*
|
||||||
* There is only few public functions.
|
* There is only few public functions.
|
||||||
*/
|
*/
|
||||||
htmlElemDescPtr htmlTagLookup (const xmlChar *tag);
|
const htmlElemDescPtr htmlTagLookup (const xmlChar *tag);
|
||||||
htmlEntityDescPtr htmlEntityLookup(const xmlChar *name);
|
const htmlEntityDescPtr htmlEntityLookup(const xmlChar *name);
|
||||||
htmlEntityDescPtr htmlEntityValueLookup(unsigned int value);
|
const htmlEntityDescPtr htmlEntityValueLookup(unsigned int value);
|
||||||
|
|
||||||
int htmlIsAutoClosed(htmlDocPtr doc,
|
int htmlIsAutoClosed(htmlDocPtr doc,
|
||||||
htmlNodePtr elem);
|
htmlNodePtr elem);
|
||||||
|
@ -185,9 +185,13 @@ LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
|
|||||||
LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
|
LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
|
||||||
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
|
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
|
||||||
LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
|
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
|
* 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",
|
"validate",
|
||||||
"load subset",
|
"load subset",
|
||||||
"keep blanks",
|
"keep blanks",
|
||||||
|
15
tree.c
15
tree.c
@ -36,17 +36,24 @@
|
|||||||
|
|
||||||
xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
|
xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* *
|
||||||
|
* Deprecated *
|
||||||
|
* *
|
||||||
|
************************************************************************/
|
||||||
|
int oldXMLWDcompatibility = 0;
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* A few static variables and macros *
|
* A few static variables and macros *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
|
const xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
|
||||||
xmlChar xmlStringTextNoenc[] =
|
const xmlChar xmlStringTextNoenc[] =
|
||||||
{ 't', 'e', 'x', 't', 'n', 'o', 'e', 'n', 'c', 0 };
|
{ 't', 'e', 'x', 't', 'n', 'o', 'e', 'n', 'c', 0 };
|
||||||
xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 };
|
const xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 };
|
||||||
int oldXMLWDcompatibility = 0;
|
|
||||||
int xmlIndentTreeOutput = 0;
|
int xmlIndentTreeOutput = 0;
|
||||||
xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
|
xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
|
||||||
|
|
||||||
|
12
xmlIO.c
12
xmlIO.c
@ -96,9 +96,9 @@ typedef struct _xmlInputCallback {
|
|||||||
|
|
||||||
#define MAX_INPUT_CALLBACK 15
|
#define MAX_INPUT_CALLBACK 15
|
||||||
|
|
||||||
xmlInputCallback xmlInputCallbackTable[MAX_INPUT_CALLBACK];
|
static xmlInputCallback xmlInputCallbackTable[MAX_INPUT_CALLBACK];
|
||||||
int xmlInputCallbackNr = 0;
|
static int xmlInputCallbackNr = 0;
|
||||||
int xmlInputCallbackInitialized = 0;
|
static int xmlInputCallbackInitialized = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output I/O callback sets
|
* Output I/O callback sets
|
||||||
@ -112,9 +112,9 @@ typedef struct _xmlOutputCallback {
|
|||||||
|
|
||||||
#define MAX_OUTPUT_CALLBACK 15
|
#define MAX_OUTPUT_CALLBACK 15
|
||||||
|
|
||||||
xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK];
|
static xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK];
|
||||||
int xmlOutputCallbackNr = 0;
|
static int xmlOutputCallbackNr = 0;
|
||||||
int xmlOutputCallbackInitialized = 0;
|
static int xmlOutputCallbackInitialized = 0;
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
|
Reference in New Issue
Block a user