hotfix
This commit is contained in:
parent
b0bd27e9c1
commit
f88328b893
|
@ -693,6 +693,10 @@ void GetOption( TidyDoc tdoc, TidyOption topt, OptionDesc *d )
|
||||||
** Array holding all options. Contains a trailing sentinel.
|
** Array holding all options. Contains a trailing sentinel.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
/* Some options aren't exposed in the API although they're available
|
||||||
|
in the enum. This struct is guaranteed to hold *all* Tidy options,
|
||||||
|
but be sure to use the public API iterators to access them!
|
||||||
|
*/
|
||||||
TidyOption topt[N_TIDY_OPTIONS];
|
TidyOption topt[N_TIDY_OPTIONS];
|
||||||
} AllOption_t;
|
} AllOption_t;
|
||||||
|
|
||||||
|
@ -723,8 +727,7 @@ static void getSortedOption( TidyDoc tdoc, AllOption_t *tOption )
|
||||||
tOption->topt[i] = NULL; /* sentinel */
|
tOption->topt[i] = NULL; /* sentinel */
|
||||||
|
|
||||||
qsort(tOption->topt,
|
qsort(tOption->topt,
|
||||||
/* Do not sort the sentinel: hence `-1' */
|
i, /* there are i items, not including the sentinal */
|
||||||
sizeof(tOption->topt)/sizeof(tOption->topt[0])-1,
|
|
||||||
sizeof(tOption->topt[0]),
|
sizeof(tOption->topt[0]),
|
||||||
cmpOpt);
|
cmpOpt);
|
||||||
}
|
}
|
||||||
|
|
27
src/config.c
27
src/config.c
|
@ -1595,20 +1595,21 @@ TidyIterator TY_(getOptionList)( TidyDocImpl* ARG_UNUSED(doc) )
|
||||||
const TidyOptionImpl* TY_(getNextOption)( TidyDocImpl* ARG_UNUSED(doc),
|
const TidyOptionImpl* TY_(getNextOption)( TidyDocImpl* ARG_UNUSED(doc),
|
||||||
TidyIterator* iter )
|
TidyIterator* iter )
|
||||||
{
|
{
|
||||||
const TidyOptionImpl* option = NULL;
|
const TidyOptionImpl* option = NULL;
|
||||||
size_t optId;
|
size_t optId;
|
||||||
assert( iter != NULL );
|
assert( iter != NULL );
|
||||||
optId = (size_t) *iter;
|
optId = (size_t) *iter;
|
||||||
if ( optId > TidyUnknownOption && optId < N_TIDY_OPTIONS )
|
if ( optId > TidyUnknownOption && optId < N_TIDY_OPTIONS )
|
||||||
{
|
{
|
||||||
option = &option_defs[ optId ];
|
/* Hide these internal options from the API entirely. */
|
||||||
optId++;
|
while ( optId == TidyEmacsFile || optId == TidyDoctypeMode )
|
||||||
/* Hide these internal options from the API entirely. */
|
optId++;
|
||||||
if ( optId == TidyEmacsFile || optId == TidyDoctypeMode )
|
|
||||||
|
option = &option_defs[ optId ];
|
||||||
optId++;
|
optId++;
|
||||||
}
|
}
|
||||||
*iter = (TidyIterator) ( optId < N_TIDY_OPTIONS ? optId : (size_t)0 );
|
*iter = (TidyIterator) ( optId < N_TIDY_OPTIONS ? optId : (size_t)0 );
|
||||||
return option;
|
return option;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use a 1-based array index as iterator: 0 == end-of-list
|
/* Use a 1-based array index as iterator: 0 == end-of-list
|
||||||
|
|
Loading…
Reference in a new issue