Simplify checking suppressed errors config

This commit is contained in:
Wilson Lin 2018-08-04 15:59:53 +12:00
parent bc2a935932
commit 250a704c2e
2 changed files with 7 additions and 3 deletions

View File

@ -3,8 +3,6 @@
#include <inttypes.h>
#include "../ext/nicehash/set/int32.h"
#include "../util/hbchar.h"
#include "../util/buffer.c"
#include "../util/pipe.c"
@ -15,6 +13,8 @@
#include "../rule/char/digit.c"
#include "../rule/char/hex.c"
#include "./streamoptions.c"
#define HBS_ENTITY_TYPE_NAME 1
#define HBS_ENTITY_TYPE_DECIMAL 2
#define HBS_ENTITY_TYPE_HEXADECIMAL 3
@ -26,7 +26,7 @@ static void _hbs_entity_interr_unknown_entity(void) {
}
static void _hbs_entity_handle_error(hbs_options_t so, hbu_pipe_t pipe, int type, hbu_buffer_t entity_raw, int consumed_semicolon, hbe_errcode_t errcode, const char *reason) {
if (nh_set_int32_has(so->suppressed_errors, errcode)) {
if (hbs_options_supressed_error(so, errcode)) {
switch (type) {
case -1:
hbu_pipe_write(pipe, '&');

View File

@ -71,6 +71,10 @@ int hbs_options_in_tags_list(nh_set_str_t set, hb_char_t *query) {
return nh_set_str_has(set, (char *) query);
}
int hbs_options_supressed_error(hbs_options_t opt, hbe_errcode_t errcode) {
return nh_set_int32_has(opt->suppressed_errors, errcode);
}
void hbs_options_log(hbs_options_t opt) {
hbe_info_kv_boolean("Trim `class` attributes", opt->trim_class_attr);
hbe_info_kv_boolean("Decode entities", opt->decode_entities);