ELEMENT_HASH_LOOKUP is no longer conditional, and is a permanent part of Tidy.
This commit is contained in:
parent
558082cbfc
commit
ff030aab7a
24
src/tags.c
24
src/tags.c
|
@ -332,7 +332,6 @@ static Dict tag_defs[] =
|
|||
{ (TidyTagId)0, NULL, 0, NULL, (0), NULL, NULL }
|
||||
};
|
||||
|
||||
#if ELEMENT_HASH_LOOKUP
|
||||
static uint tagsHash(ctmbstr s)
|
||||
{
|
||||
uint hashval;
|
||||
|
@ -401,19 +400,15 @@ static void tagsEmptyHash( TidyDocImpl* doc, TidyTagImpl* tags )
|
|||
tags->hashtab[i] = NULL;
|
||||
}
|
||||
}
|
||||
#endif /* ELEMENT_HASH_LOOKUP */
|
||||
|
||||
static const Dict* tagsLookup( TidyDocImpl* doc, TidyTagImpl* tags, ctmbstr s )
|
||||
{
|
||||
const Dict *np;
|
||||
#if ELEMENT_HASH_LOOKUP
|
||||
const DictHash* p;
|
||||
#endif
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
#if ELEMENT_HASH_LOOKUP
|
||||
/* this breaks if declared elements get changed between two */
|
||||
/* parser runs since Tidy would use the cached version rather */
|
||||
/* than the new one. */
|
||||
|
@ -430,17 +425,6 @@ static const Dict* tagsLookup( TidyDocImpl* doc, TidyTagImpl* tags, ctmbstr s )
|
|||
for (np = tags->declared_tag_list; np; np = np->next)
|
||||
if (TY_(tmbstrcmp)(s, np->name) == 0)
|
||||
return tagsInstall(doc, tags, np);
|
||||
#else
|
||||
|
||||
for (np = tag_defs + 1; np < tag_defs + N_TIDY_TAGS; ++np)
|
||||
if (TY_(tmbstrcmp)(s, np->name) == 0)
|
||||
return np;
|
||||
|
||||
for (np = tags->declared_tag_list; np; np = np->next)
|
||||
if (TY_(tmbstrcmp)(s, np->name) == 0)
|
||||
return np;
|
||||
|
||||
#endif /* ELEMENT_HASH_LOOKUP */
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -742,9 +726,7 @@ void TY_(FreeDeclaredTags)( TidyDocImpl* doc, UserTagType tagType )
|
|||
|
||||
if ( deleteIt )
|
||||
{
|
||||
#if ELEMENT_HASH_LOOKUP
|
||||
tagsRemoveFromHash( doc, &doc->tags, curr->name );
|
||||
#endif
|
||||
FreeDict( doc, curr );
|
||||
if ( prev )
|
||||
prev->next = next;
|
||||
|
@ -808,9 +790,7 @@ void TY_(AdjustTags)( TidyDocImpl *doc )
|
|||
np->parser = TY_(ParseBlock);
|
||||
}
|
||||
|
||||
#if ELEMENT_HASH_LOOKUP
|
||||
tagsEmptyHash(doc, tags); /* not sure this is really required, but to be sure */
|
||||
#endif
|
||||
doc->HTML5Mode = no; /* set *NOT* HTML5 mode */
|
||||
|
||||
}
|
||||
|
@ -857,9 +837,7 @@ void TY_(ResetTags)( TidyDocImpl *doc )
|
|||
np->parser = TY_(ParseInline);
|
||||
}
|
||||
|
||||
#if ELEMENT_HASH_LOOKUP
|
||||
tagsEmptyHash( doc, tags ); /* not sure this is really required, but to be sure */
|
||||
#endif
|
||||
doc->HTML5Mode = yes; /* set HTML5 mode */
|
||||
}
|
||||
|
||||
|
@ -867,9 +845,7 @@ void TY_(FreeTags)( TidyDocImpl* doc )
|
|||
{
|
||||
TidyTagImpl* tags = &doc->tags;
|
||||
|
||||
#if ELEMENT_HASH_LOOKUP
|
||||
tagsEmptyHash( doc, tags );
|
||||
#endif
|
||||
TY_(FreeDeclaredTags)( doc, tagtype_null );
|
||||
FreeDict( doc, tags->xml_tags );
|
||||
|
||||
|
|
|
@ -43,11 +43,6 @@ struct _Dict
|
|||
Dict* next;
|
||||
};
|
||||
|
||||
#if !defined(ELEMENT_HASH_LOOKUP)
|
||||
#define ELEMENT_HASH_LOOKUP 1
|
||||
#endif
|
||||
|
||||
#if ELEMENT_HASH_LOOKUP
|
||||
enum
|
||||
{
|
||||
ELEMENT_HASH_SIZE=178u
|
||||
|
@ -60,15 +55,12 @@ struct _DictHash
|
|||
};
|
||||
|
||||
typedef struct _DictHash DictHash;
|
||||
#endif
|
||||
|
||||
struct _TidyTagImpl
|
||||
{
|
||||
Dict* xml_tags; /* placeholder for all xml tags */
|
||||
Dict* declared_tag_list; /* User declared tags */
|
||||
#if ELEMENT_HASH_LOOKUP
|
||||
DictHash* hashtab[ELEMENT_HASH_SIZE];
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct _TidyTagImpl TidyTagImpl;
|
||||
|
|
Loading…
Reference in a new issue