ucp_table: clean up make_caseless

This commit is contained in:
Justin Viiret 2016-05-09 16:10:57 +10:00 committed by Matthew Barr
parent f48b8c937b
commit 97eaea043e

View File

@ -83,14 +83,13 @@ void make_caseless(CodePointSet *cps) {
CodePointSet base = *cps;
const unicase *uc_begin = ucp_caseless_def;
const unicase *const uc_end = ucp_caseless_def
+ ARRAY_LENGTH(ucp_caseless_def);
DEBUG_PRINTF("uc len %zd\n", uc_end - uc_begin);
auto uc_begin = begin(ucp_caseless_def);
auto uc_end = end(ucp_caseless_def);
DEBUG_PRINTF("uc len %zd\n", distance(uc_begin, uc_end));
for (auto it = base.begin(), ite = base.end(); it != ite; ++it) {
unichar b = lower(*it);
unichar e = upper(*it) + 1;
for (const auto &elem : base) {
unichar b = lower(elem);
unichar e = upper(elem) + 1;
for (; b < e; b++) {
DEBUG_PRINTF("decasing %x\n", b);
@ -101,7 +100,7 @@ void make_caseless(CodePointSet *cps) {
DEBUG_PRINTF("EOL\n");
return;
}
while (uc_begin->base == b) {
while (uc_begin != uc_end && uc_begin->base == b) {
DEBUG_PRINTF("at {%x,%x}\n", uc_begin->base, uc_begin->caseless);
cps->set(uc_begin->caseless);
++uc_begin;