While these look like a code cleanup, they appear to have an adverse
consequence in the use of libtidy by PHP 7+, so have been reverted.

	modified:   src/config.c
	modified:   src/config.h
	modified:   src/tidylib.c
This commit is contained in:
Geoff McLane 2018-02-14 18:50:36 +01:00
parent 0c182bbfa1
commit 67eaeb6d18
3 changed files with 6 additions and 8 deletions

View file

@ -303,6 +303,7 @@ static const struct {
/* forward declarations */
static void AdjustConfig( TidyDocImpl* doc );
static Bool GetPickListValue( ctmbstr value, PickListItems* pickList, uint *result );
@ -711,6 +712,7 @@ void TY_(TakeConfigSnapshot)( TidyDocImpl* doc )
const TidyOptionValue* value = &doc->config.value[ 0 ];
TidyOptionValue* snap = &doc->config.snapshot[ 0 ];
AdjustConfig( doc ); /* Make sure it's consistent */
for ( ixVal=0; ixVal < N_TIDY_OPTIONS; ++option, ++ixVal )
{
assert( ixVal == (uint) option->id );
@ -759,6 +761,7 @@ void TY_(CopyConfig)( TidyDocImpl* docTo, TidyDocImpl* docFrom )
}
if ( needReparseTagsDecls )
ReparseTagDecls( docTo, changedUserTags );
AdjustConfig( docTo ); /* Make sure it's consistent */
}
}
@ -1052,6 +1055,8 @@ int TY_(ParseConfigFileEnc)( TidyDocImpl* doc, ctmbstr file, ctmbstr charenc )
if ( fname != (tmbstr) file )
TidyDocFree( doc, fname );
AdjustConfig( doc );
/* any new config errors? If so, return warning status. */
return (doc->optionErrors > opterrs ? 1 : 0);
}
@ -1190,7 +1195,7 @@ Bool TY_(AdjustCharEncoding)( TidyDocImpl* doc, int encoding )
/* ensure that config is self consistent */
void TY_(AdjustConfig)( TidyDocImpl* doc )
static void AdjustConfig( TidyDocImpl* doc )
{
if ( cfgBool(doc, TidyEncloseBlockText) )
TY_(SetOptionBool)( doc, TidyEncloseBodyText, yes );

View file

@ -335,12 +335,6 @@ Bool TY_(ParseConfigValue)( TidyDocImpl* doc, TidyOptionId optId, ctmbstr optVa
Bool TY_(AdjustCharEncoding)( TidyDocImpl* doc, int encoding );
/** Ensure that the configuration options are self consistent.
** @param doc The Tidy document to adjust.
*/
void TY_(AdjustConfig)( TidyDocImpl* doc );
/** Indicates whether or not the current configuration is completely default.
** @param doc The Tidy document.
** @returns The result.

View file

@ -1447,7 +1447,6 @@ int TY_(DocParseStream)( TidyDocImpl* doc, StreamIn* in )
TY_(ResetTags)(doc); /* reset table to html5 mode */
TY_(TakeConfigSnapshot)( doc ); /* Save config state */
TY_(AdjustConfig)( doc ); /* ensure config consistency */
TY_(FreeAnchors)( doc );
TY_(FreeNode)(doc, &doc->root);