/* - categorize - sort out character categories == static void categorize(struct parse *p, struct re_guts *g); */ static void categorize( struct parse *p, struct re_guts *g) { cat_t *cats; int c; int c2; cat_t cat; _DIAGASSERT(p != NULL); _DIAGASSERT(g != NULL); cats = g->categories; /* avoid making error situations worse */ if (p->error != 0) return; for (c = CHAR_MIN; c <= CHAR_MAX; c++) if (cats[c] == 0 && isinsets(g, c)) { cat = g->ncategories++; cats[c] = cat; for (c2 = c+1; c2 <= CHAR_MAX; c2++) if (cats[c2] == 0 && samesets(g, c, c2)) cats[c2] = cat; } }
/* - categorize - sort out character categories */ static void categorize(struct parse *p, struct re_guts *g) { cat_t *cats = g? g->categories : NULL; unsigned int c; unsigned int c2; cat_t cat; /* avoid making error situations worse */ if (!p || p->error != 0 || !cats ) return; for (c = CHAR_MIN; c <= CHAR_MAX; c++) if ( *(cats+c) && isinsets(g, c)) { cat = g->ncategories++; cats[c] = cat; for (c2 = c+1; c2 <= CHAR_MAX; c2++) if (cats[c2] == 0 && samesets(g, c, c2)) cats[c2] = cat; } }