find_escape_strings: find outs2_broken faster

This commit is contained in:
Justin Viiret 2017-04-06 16:14:43 +10:00 committed by Matthew Barr
parent bfcb391580
commit 698653766b

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2016, Intel Corporation * Copyright (c) 2015-2017, Intel Corporation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
@ -379,16 +379,18 @@ accel_dfa_build_strat::find_escape_strings(dstate_id_t this_idx) const {
for (auto jj = cr_all_j.find_first(); jj != CharReach::npos; for (auto jj = cr_all_j.find_first(); jj != CharReach::npos;
jj = cr_all_j.find_next(jj)) { jj = cr_all_j.find_next(jj)) {
rv.double_byte.emplace((u8)ii, (u8)jj); rv.double_byte.emplace((u8)ii, (u8)jj);
if (rv.double_byte.size() > 8) {
DEBUG_PRINTF("outs2 too big\n");
outs2_broken = true;
goto done;
}
} }
} }
} }
} }
if (rv.double_byte.size() > 8) { done:
DEBUG_PRINTF("outs2 too big\n"); assert(outs2_broken || rv.double_byte.size() <= 8);
outs2_broken = true;
}
if (outs2_broken) { if (outs2_broken) {
rv.double_byte.clear(); rv.double_byte.clear();
} }