Not sure how this got missed...
This commit is contained in:
parent
4d2e75024e
commit
5ff6aa8a8b
|
@ -23,29 +23,28 @@
|
|||
#include "tidybuffio.h"
|
||||
#include "locale.h" /* for determing and setting locale */
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h> /* Force console to UTF8. */
|
||||
# include <windows.h> /* Force console to UTF8. */
|
||||
#endif
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#include "sprtf.h"
|
||||
#ifdef _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
# include "sprtf.h"
|
||||
# ifdef _CRTDBG_MAP_ALLOC
|
||||
# include <stdlib.h>
|
||||
# include <crtdbg.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SPRTF
|
||||
#define SPRTF printf
|
||||
# define SPRTF printf
|
||||
#endif
|
||||
|
||||
/** Tidy will send errors to this file, which will be stderr later. */
|
||||
static FILE* errout = NULL;
|
||||
|
||||
#if defined(_WIN32)
|
||||
/** On Windows, we will store the original code page here. */
|
||||
static uint win_cp; /* original Windows code page */
|
||||
#if (defined(_MSC_VER) && (_MSC_VER < 1900))
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
static uint win_cp; /* original Windows code page */
|
||||
# if (defined(_MSC_VER) && (_MSC_VER < 1900))
|
||||
# define snprintf _snprintf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -2015,11 +2014,10 @@ int main( int argc, char** argv )
|
|||
uint accessWarnings = 0;
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if defined(_CRTDBG_MAP_ALLOC)
|
||||
# if defined(_CRTDBG_MAP_ALLOC)
|
||||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||
#endif
|
||||
set_log_file((char *)"temptidy.txt", 0);
|
||||
/* add_append_log(1); */
|
||||
# endif
|
||||
set_log_file((char *)"temptidy.txt", 0); /* add_append_log(1); */
|
||||
#endif
|
||||
|
||||
tdoc = tidyCreate();
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "tidy.h"
|
||||
#include "forward.h"
|
||||
#ifdef DEBUG_MEMORY
|
||||
#include "sprtf.h"
|
||||
# include "sprtf.h"
|
||||
#endif
|
||||
|
||||
static TidyMalloc g_malloc = NULL;
|
||||
|
|
14
src/attrs.c
14
src/attrs.c
|
@ -582,7 +582,6 @@ static ctmbstr GetColorName(ctmbstr code)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if ATTRIBUTE_HASH_LOOKUP
|
||||
static uint attrsHash(ctmbstr s)
|
||||
{
|
||||
uint hashval;
|
||||
|
@ -652,21 +651,17 @@ static void attrsEmptyHash( TidyDocImpl* doc, TidyAttribImpl * attribs )
|
|||
attribs->hashtab[i] = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static const Attribute* attrsLookup(TidyDocImpl* doc,
|
||||
TidyAttribImpl* ARG_UNUSED(attribs),
|
||||
ctmbstr atnam)
|
||||
{
|
||||
const Attribute *np;
|
||||
#if ATTRIBUTE_HASH_LOOKUP
|
||||
const AttrHash *p;
|
||||
#endif
|
||||
|
||||
if (!atnam)
|
||||
return NULL;
|
||||
|
||||
#if ATTRIBUTE_HASH_LOOKUP
|
||||
for (p = attribs->hashtab[attrsHash(atnam)]; p && p->attr; p = p->next)
|
||||
if (TY_(tmbstrcasecmp)(atnam, p->attr->name) == 0)
|
||||
return p->attr;
|
||||
|
@ -674,11 +669,6 @@ static const Attribute* attrsLookup(TidyDocImpl* doc,
|
|||
for (np = attribute_defs; np && np->name; ++np)
|
||||
if (TY_(tmbstrcasecmp)(atnam, np->name) == 0)
|
||||
return attrsInstall(doc, attribs, np);
|
||||
#else
|
||||
for (np = attribute_defs; np && np->name; ++np)
|
||||
if (TY_(tmbstrcasecmp)(atnam, np->name) == 0)
|
||||
return np;
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1091,9 +1081,7 @@ static void FreeDeclaredAttributes( TidyDocImpl* doc )
|
|||
while ( NULL != (dict = attribs->declared_attr_list) )
|
||||
{
|
||||
attribs->declared_attr_list = dict->next;
|
||||
#if ATTRIBUTE_HASH_LOOKUP
|
||||
attrsRemoveFromHash( doc, &doc->attribs, dict->name );
|
||||
#endif
|
||||
TidyDocFree( doc, dict->name );
|
||||
TidyDocFree( doc, dict );
|
||||
}
|
||||
|
@ -1101,9 +1089,7 @@ static void FreeDeclaredAttributes( TidyDocImpl* doc )
|
|||
|
||||
void TY_(FreeAttrTable)( TidyDocImpl* doc )
|
||||
{
|
||||
#if ATTRIBUTE_HASH_LOOKUP
|
||||
attrsEmptyHash( doc, &doc->attribs );
|
||||
#endif
|
||||
TY_(FreeAnchors)( doc );
|
||||
FreeDeclaredAttributes( doc );
|
||||
}
|
||||
|
|
|
@ -36,11 +36,6 @@ struct _Anchor
|
|||
|
||||
typedef struct _Anchor Anchor;
|
||||
|
||||
#if !defined(ATTRIBUTE_HASH_LOOKUP)
|
||||
#define ATTRIBUTE_HASH_LOOKUP 1
|
||||
#endif
|
||||
|
||||
#if ATTRIBUTE_HASH_LOOKUP
|
||||
enum
|
||||
{
|
||||
ATTRIBUTE_HASH_SIZE=178u
|
||||
|
@ -53,7 +48,6 @@ struct _AttrHash
|
|||
};
|
||||
|
||||
typedef struct _AttrHash AttrHash;
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -78,9 +72,7 @@ struct _TidyAttribImpl
|
|||
/* Prioritized list of attributes to write */
|
||||
PriorityAttribs priorityAttribs;
|
||||
|
||||
#if ATTRIBUTE_HASH_LOOKUP
|
||||
AttrHash* hashtab[ATTRIBUTE_HASH_SIZE];
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct _TidyAttribImpl TidyAttribImpl;
|
||||
|
|
Loading…
Reference in a new issue