Skip to content

Commit 67eaeb6

Browse files
committed
Is #673 - Revert 350f7b4 and 86e62db
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
1 parent 0c182bb commit 67eaeb6

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/config.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ static const struct {
303303

304304

305305
/* forward declarations */
306+
static void AdjustConfig( TidyDocImpl* doc );
306307
static Bool GetPickListValue( ctmbstr value, PickListItems* pickList, uint *result );
307308

308309

@@ -711,6 +712,7 @@ void TY_(TakeConfigSnapshot)( TidyDocImpl* doc )
711712
const TidyOptionValue* value = &doc->config.value[ 0 ];
712713
TidyOptionValue* snap = &doc->config.snapshot[ 0 ];
713714

715+
AdjustConfig( doc ); /* Make sure it's consistent */
714716
for ( ixVal=0; ixVal < N_TIDY_OPTIONS; ++option, ++ixVal )
715717
{
716718
assert( ixVal == (uint) option->id );
@@ -759,6 +761,7 @@ void TY_(CopyConfig)( TidyDocImpl* docTo, TidyDocImpl* docFrom )
759761
}
760762
if ( needReparseTagsDecls )
761763
ReparseTagDecls( docTo, changedUserTags );
764+
AdjustConfig( docTo ); /* Make sure it's consistent */
762765
}
763766
}
764767

@@ -1052,6 +1055,8 @@ int TY_(ParseConfigFileEnc)( TidyDocImpl* doc, ctmbstr file, ctmbstr charenc )
10521055
if ( fname != (tmbstr) file )
10531056
TidyDocFree( doc, fname );
10541057

1058+
AdjustConfig( doc );
1059+
10551060
/* any new config errors? If so, return warning status. */
10561061
return (doc->optionErrors > opterrs ? 1 : 0);
10571062
}
@@ -1190,7 +1195,7 @@ Bool TY_(AdjustCharEncoding)( TidyDocImpl* doc, int encoding )
11901195

11911196

11921197
/* ensure that config is self consistent */
1193-
void TY_(AdjustConfig)( TidyDocImpl* doc )
1198+
static void AdjustConfig( TidyDocImpl* doc )
11941199
{
11951200
if ( cfgBool(doc, TidyEncloseBlockText) )
11961201
TY_(SetOptionBool)( doc, TidyEncloseBodyText, yes );

src/config.h

-6
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,6 @@ Bool TY_(ParseConfigValue)( TidyDocImpl* doc, TidyOptionId optId, ctmbstr optVa
335335
Bool TY_(AdjustCharEncoding)( TidyDocImpl* doc, int encoding );
336336

337337

338-
/** Ensure that the configuration options are self consistent.
339-
** @param doc The Tidy document to adjust.
340-
*/
341-
void TY_(AdjustConfig)( TidyDocImpl* doc );
342-
343-
344338
/** Indicates whether or not the current configuration is completely default.
345339
** @param doc The Tidy document.
346340
** @returns The result.

src/tidylib.c

-1
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,6 @@ int TY_(DocParseStream)( TidyDocImpl* doc, StreamIn* in )
14471447

14481448
TY_(ResetTags)(doc); /* reset table to html5 mode */
14491449
TY_(TakeConfigSnapshot)( doc ); /* Save config state */
1450-
TY_(AdjustConfig)( doc ); /* ensure config consistency */
14511450
TY_(FreeAnchors)( doc );
14521451

14531452
TY_(FreeNode)(doc, &doc->root);

0 commit comments

Comments
 (0)