
Go to the source code of this file.
Functions | |
| static struct cvec * | newcvec (int nchrs, int nranges) |
| static struct cvec * | clearcvec (struct cvec *cv) |
| static void | addchr (struct cvec *cv, chr c) |
| static void | addrange (struct cvec *cv, chr from, chr to) |
| static struct cvec * | getcvec (struct vars *v, int nchrs, int nranges) |
| static void | freecvec (struct cvec *cv) |
Definition at line 77 of file regc_cvec.c.
References assert, cvec::chrs, cvec::chrspace, and cvec::nchrs.
Referenced by allcases(), cclass(), eclass(), and range().
Definition at line 88 of file regc_cvec.c.
References assert, cvec::nranges, cvec::ranges, and cvec::rangespace.
Definition at line 65 of file regc_cvec.c.
References assert, cvec::nchrs, cvec::nranges, and NULL.
| static void freecvec | ( | struct cvec * | cv | ) | [static] |
Definition at line 110 of file regc_cvec.c.
References clearcvec(), vars::cv, ERR, freecvec(), newcvec(), NULL, and REG_ESPACE.
Referenced by allcases(), cclass(), eclass(), and range().
{
/* recycle existing transient cvec if large enough */
if (v->cv != NULL && nchrs <= v->cv->chrspace &&
nranges <= v->cv->rangespace)
return clearcvec(v->cv);
/* nope, make a new one */
if (v->cv != NULL)
freecvec(v->cv);
v->cv = newcvec(nchrs, nranges);
if (v->cv == NULL)
ERR(REG_ESPACE);
return v->cv;
}
| static struct cvec* newcvec | ( | int | nchrs, | |
| int | nranges | |||
| ) | [static, read] |
Definition at line 44 of file regc_cvec.c.
References cvec::chrs, cvec::chrspace, clearcvec(), MALLOC, NULL, cvec::ranges, and cvec::rangespace.
Referenced by getcvec().
{
size_t nc = (size_t) nchrs + (size_t) nranges * 2;
size_t n = sizeof(struct cvec) + nc * sizeof(chr);
struct cvec *cv = (struct cvec *) MALLOC(n);
if (cv == NULL)
return NULL;
cv->chrspace = nchrs;
cv->chrs = (chr *) (((char *) cv) + sizeof(struct cvec));
cv->ranges = cv->chrs + nchrs;
cv->rangespace = nranges;
return clearcvec(cv);
}
1.7.1